Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add C++-to-JS test for Smart Card Connector API #869

Open
emaxx-google opened this issue Aug 1, 2023 · 0 comments
Open

Add C++-to-JS test for Smart Card Connector API #869

emaxx-google opened this issue Aug 1, 2023 · 0 comments

Comments

@emaxx-google
Copy link
Collaborator

With #816 implemented, we have a framework that allows writing JavaScript tests that exercise both JavaScript and C/C++ code.

We should employ this to write basic tests for verifying the PC/SC API exposed by the Connector.

emaxx-google added a commit that referenced this issue Aug 1, 2023
Add build scripts and an empty test for testing Smart Card
Connector. This boilerplate can be used for adding functional tests in
follow-ups as tracked by #869.
emaxx-google added a commit that referenced this issue Aug 1, 2023
Add build scripts and an empty test for testing Smart Card
Connector. This boilerplate can be used for adding functional tests in
follow-ups as tracked by #869.
emaxx-google added a commit that referenced this issue Aug 1, 2023
Add build scripts and an empty test for testing Smart Card
Connector. This boilerplate can be used for adding functional tests in
follow-ups as tracked by #869.
@emaxx-google emaxx-google self-assigned this Aug 1, 2023
emaxx-google added a commit that referenced this issue Aug 1, 2023
Add build scripts and an empty test for testing Smart Card
Connector. This boilerplate can be used for adding functional tests in
follow-ups as tracked by #869.
emaxx-google added a commit that referenced this issue Aug 1, 2023
Change IntegrationTestHelper::SetUp() to return its result
asynchronously via a callback.

These asynchronous helpers will be used in follow-up PRs for doing
startup/shutdown of the PC/SC server in JS-to-C++ tests of Smart Card
Connector, tracked by #869.
emaxx-google added a commit that referenced this issue Aug 1, 2023
Change IntegrationTestHelper::SetUp() to return its result
asynchronously via a callback.

These asynchronous helpers will be used in follow-up PRs for doing
startup/shutdown of the PC/SC server in JS-to-C++ tests of Smart Card
Connector, tracked by #869.
emaxx-google added a commit that referenced this issue Aug 1, 2023
Assert (and crash if it fails) that by the time
IntegrationTestService::Deactivate() is called all previously set up
helpers have been torn down.

This is anyway guaranteed by the current behavior of the test
controller. Also this assumption greatly simplifies transition to the
asynchronous teardown model, because it'll be hard to make
Deactivate() asynchronous as well (it's called in the "entry point"
class destructor).

This commit contributes to #869.
emaxx-google added a commit that referenced this issue Aug 1, 2023
Change IntegrationTestHelper::TearDown() to report its completion
asynchronously via a callback.

This change is similar to the previous change for SetUp(), except that
teardown doesn't need to return any value, and that we have to properly
accoutn for callbacks in the bulk "tear down all helpers" operation.

This commit contributes to #869.
emaxx-google added a commit that referenced this issue Aug 2, 2023
Add SmartCardConnectorApplicationTestHelper that allows the JS side to
start the instance of the application (i.e., the PC/SC daemon) in tests.

The helper currently only supports the most basic operations: startup
and shutdown.

Its usages and additional operations will be added in follow-ups tracked
by #869.
emaxx-google added a commit that referenced this issue Aug 2, 2023
Add SmartCardConnectorApplicationTestHelper that allows the JS side to
start the instance of the application (i.e., the PC/SC daemon) in tests.

The helper currently only supports the most basic operations: startup
and shutdown.

Its usages and additional operations will be added in follow-ups tracked
by #869.
emaxx-google added a commit that referenced this issue Aug 2, 2023
Add a test that verifies the PC/SC server successfully started up.

Technically, the JS side does this by asking the C++ side to set up the
"SmartCardConnectorApplicationTestHelper", and then waiting until the
C++ side sends the "ready" message to the JS.

Follow-ups will use this approach for testing actual PC/SC
functionality, as tracked by #869.
emaxx-google added a commit that referenced this issue Aug 2, 2023
Closure Library's standard test timeout - 1 second - is insufficient for
JS-to-C++ tests that spend multiple seconds alone on setup/teardown of
the executable module.

Increase the limit to 60 seconds for now.

This commit contributes to #869.
emaxx-google added a commit that referenced this issue Aug 2, 2023
Change IntegrationTestHelper::SetUp() to return its result
asynchronously via a callback.

These asynchronous helpers will be used in follow-up PRs for doing
startup/shutdown of the PC/SC server in JS-to-C++ tests of Smart Card
Connector, tracked by #869.
emaxx-google added a commit that referenced this issue Aug 2, 2023
Assert (and crash if it fails) that by the time
IntegrationTestService::Deactivate() is called all previously set up
helpers have been torn down.

This is anyway guaranteed by the current behavior of the test
controller. Also this assumption greatly simplifies transition to the
asynchronous teardown model, because it'll be hard to make
Deactivate() asynchronous as well (it's called in the "entry point"
class destructor).

This commit contributes to #869.
emaxx-google added a commit that referenced this issue Aug 2, 2023
Assert (and crash if it fails) that by the time
IntegrationTestService::Deactivate() is called all previously set up
helpers have been torn down.

This is anyway guaranteed by the current behavior of the test
controller. Also this assumption greatly simplifies transition to the
asynchronous teardown model, because it'll be hard to make
Deactivate() asynchronous as well (it's called in the "entry point"
class destructor).

This commit contributes to #869.
emaxx-google added a commit that referenced this issue Aug 2, 2023
Change IntegrationTestHelper::TearDown() to report its completion
asynchronously via a callback.

This change is similar to the previous change for SetUp(), except that
teardown doesn't need to return any value, and that we have to properly
accoutn for callbacks in the bulk "tear down all helpers" operation.

This commit contributes to #869.
emaxx-google added a commit that referenced this issue Aug 2, 2023
Change IntegrationTestHelper::TearDown() to report its completion
asynchronously via a callback.

This change is similar to the previous change for SetUp(), except that
teardown doesn't need to return any value, and that we have to properly
accoutn for callbacks in the bulk "tear down all helpers" operation.

This commit contributes to #869.
emaxx-google added a commit that referenced this issue Aug 2, 2023
Add SmartCardConnectorApplicationTestHelper that allows the JS side to
start the instance of the application (i.e., the PC/SC daemon) in tests.

The helper currently only supports the most basic operations: startup
and shutdown.

Its usages and additional operations will be added in follow-ups tracked
by #869.
emaxx-google added a commit that referenced this issue Aug 2, 2023
Add SmartCardConnectorApplicationTestHelper that allows the JS side to
start the instance of the application (i.e., the PC/SC daemon) in tests.

The helper currently only supports the most basic operations: startup
and shutdown.

Its usages and additional operations will be added in follow-ups tracked
by #869.
emaxx-google added a commit that referenced this issue Aug 2, 2023
Add a test that verifies the PC/SC server successfully started up.

Technically, the JS side does this by asking the C++ side to set up the
"SmartCardConnectorApplicationTestHelper", and then waiting until the
C++ side sends the "ready" message to the JS.

Follow-ups will use this approach for testing actual PC/SC
functionality, as tracked by #869.
emaxx-google added a commit that referenced this issue Aug 2, 2023
Add a test that verifies the PC/SC server successfully started up.

Technically, the JS side does this by asking the C++ side to set up the
"SmartCardConnectorApplicationTestHelper", and then waiting until the
C++ side sends the "ready" message to the JS.

Follow-ups will use this approach for testing actual PC/SC
functionality, as tracked by #869.
emaxx-google added a commit that referenced this issue Aug 2, 2023
Specify a generous timeout when running JS-to-C++ tests in Emscripten
mode (via run-js-tests.py, which in turn uses Chromedriver). The default
timeout of 60 seconds is insufficient for anything more than a single
test case with the PC/SC server startup+shutdown.

This contributes to #869.
emaxx-google added a commit that referenced this issue Aug 29, 2023
Verify the JavaScript API's SCardGetStatusChange() behavior on reader
plug/unplug events.

This commit contributes to #869.
emaxx-google added a commit that referenced this issue Aug 29, 2023
Verify the JavaScript API's SCardGetStatusChange() behavior on reader
plug/unplug events.

This commit contributes to #869.
emaxx-google added a commit that referenced this issue Aug 29, 2023
Verify the JavaScript API's SCardGetStatusChange() behavior on card
insertion/removal events.

This commit contributes to #869.
emaxx-google added a commit that referenced this issue Aug 29, 2023
Verify the JavaScript API's SCardGetStatusChange() behavior on card
insertion/removal events.

This commit contributes to #869.
emaxx-google added a commit that referenced this issue Aug 29, 2023
Verify the JavaScript API's SCardCancel() behavior on canceling a
blocking SCardGetStatusChange() call.

This commit contributes to #869.
emaxx-google added a commit that referenced this issue Aug 29, 2023
Verify the JavaScript API's SCardCancel() behavior on canceling a
blocking SCardGetStatusChange() call.

This commit contributes to #869.
emaxx-google added a commit that referenced this issue Aug 29, 2023
Test various edge cases of receiving incorrect PC/SC requests. The only
thing to verify we don't crash for them.

This commit contributes to #869.
emaxx-google added a commit that referenced this issue Aug 29, 2023
Test various edge cases of receiving incorrect PC/SC requests. The only
thing to verify we don't crash for them.

This commit contributes to #869.
emaxx-google added a commit that referenced this issue Aug 29, 2023
Verify the JavaScript API's SCardGetStatusChange() behavior on card
insertion/removal events.

This commit contributes to #869.
emaxx-google added a commit that referenced this issue Aug 29, 2023
Create a separate static library containing the Connector's
application.cc logic, as opposed to compiling this file 3 times for each
target that needed it (executable_module, cpp_unittests,
js_to_cxx_tests).

This reduces duplication across different makefiles and should slightly
improve overall build times. This contributes to #869 as it introduced
one extra recompilation of the same source.
emaxx-google added a commit that referenced this issue Aug 29, 2023
Create a separate static library containing the Connector's
application.cc logic, as opposed to compiling this file 3 times for each
target that needed it (executable_module, cpp_unittests,
js_to_cxx_tests).

This reduces duplication across different makefiles and should slightly
improve overall build times. This contributes to #869 as it introduced
one extra recompilation of the same source.
emaxx-google added a commit that referenced this issue Aug 29, 2023
Create a separate static library containing the Connector's
application.cc logic, as opposed to compiling this file 3 times for each
target that needed it (executable_module, cpp_unittests,
js_to_cxx_tests).

This reduces duplication across different makefiles and should slightly
improve overall build times. This contributes to #869 as it introduced
one extra recompilation of the same source.
emaxx-google added a commit that referenced this issue Aug 30, 2023
Make JS-to-C++ tests also work in NaCl builds, by initializing the
nacl_io library (and hence allowing to perform file operations).

This contributes to effort tracked by #869.
emaxx-google added a commit that referenced this issue Aug 30, 2023
Verify the JavaScript API's SCardGetStatusChange() behavior on card
insertion/removal events.

This commit contributes to #869.
emaxx-google added a commit that referenced this issue Aug 30, 2023
Create a separate static library containing the Connector's
application.cc logic, as opposed to compiling this file 3 times for each
target that needed it (executable_module, cpp_unittests,
js_to_cxx_tests).

This reduces duplication across different makefiles and should slightly
improve overall build times. This contributes to #869 as it introduced
one extra recompilation of the same source.
emaxx-google added a commit that referenced this issue Aug 30, 2023
Make JS-to-C++ tests also work in NaCl builds, by initializing the
nacl_io library (and hence allowing to perform file operations).

This contributes to effort tracked by #869.
emaxx-google added a commit that referenced this issue Aug 30, 2023
Test various edge cases of receiving incorrect PC/SC requests. The only
thing to verify we don't crash for them.

This commit contributes to #869.
emaxx-google added a commit that referenced this issue Aug 30, 2023
Test various edge cases of receiving incorrect PC/SC requests. The only
thing to verify is that we don't crash.

This commit contributes to #869.
@emaxx-google emaxx-google added this to In progress in Continuous integration Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant