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

tests: Report more error info in MI/sync/tclk driver API tests #949

Merged
merged 1 commit into from
Jun 9, 2023

Conversation

bkeryan
Copy link
Contributor

@bkeryan bkeryan commented Jun 8, 2023

What does this Pull Request accomplish?

In initialize_driver_session(), use client::raise_if_error(), which throws an exception that includes the full error message.

Change ASSERT_* to EXPECT_* in some helper functions so that they print more failure output instead of returning. ASSERT_* returns from the current function, so calling it in a helper function doesn't terminate the current test.

Why should this Pull Request be merged?

When initialize_driver_session fails, it doesn't print any useful information about the error:

[ RUN      ] NiFgenDriverApiTest.AllocateNamedWaveform_WriteNamedWaveformF64_WaveformWrittenSuccessfully
/home/runner/work/grpc-device/grpc-device/source/tests/system/nifgen_driver_api_tests.cpp:71: Failure
Value of: status.ok()
  Actual: false
Expected: true
/home/runner/work/grpc-device/grpc-device/source/tests/system/nifgen_driver_api_tests.cpp:101: Failure
Value of: status.ok()
  Actual: false
Expected: true
[  FAILED  ] NiFgenDriverApiTest.AllocateNamedWaveform_WriteNamedWaveformF64_WaveformWrittenSuccessfully (81 ms)

What testing has been done?

Ran nidmm, nidigital, nifgen, niscope, niswitch, and nitclk tests on my test machine. (They passed.)

In initialize_driver_session(), use client::raise_if_error(), which throws
an exception that includes the full error message.

Change `ASSERT_*` to `EXPECT_*` in some helper functions so that they
print more failure output instead of returning. `ASSERT_*` returns from
the current function, so calling it in a helper function doesn't terminate
the current test.

Signed-off-by: Brad Keryan <[email protected]>
@bkeryan bkeryan requested review from reckenro and astarche as code owners June 8, 2023 15:20
@bkeryan
Copy link
Contributor Author

bkeryan commented Jun 8, 2023

These are not the test failures I wanted to see.

[ RUN      ] NiRFmxLTEDriverApiTests.NBIoTModAccFromExample_FetchData_DataLooksReasonable
D:\a\grpc-device\grpc-device\source\tests\system\nirfmxlte_driver_api_tests.cpp(380): error: Expected: (actualStatus) >= (0), actual: -376649 vs 0
[  FAILED  ] NiRFmxLTEDriverApiTests.NBIoTModAccFromExample_FetchData_DataLooksReasonable (5026 ms)
[ RUN      ] NiRFmxSpecAnRestrictedDriverApiTests.CacheResult_ReturnsNonEmptyResult
unknown file: error: C++ exception with description "-380407: A measurement with the same name is already in progress." thrown in the test body.
[  FAILED  ] NiRFmxSpecAnRestrictedDriverApiTests.CacheResult_ReturnsNonEmptyResult (1272 ms)

@bkeryan bkeryan merged commit b8f2fad into main Jun 9, 2023
@bkeryan bkeryan deleted the users/bkeryan/initialize-driver-session-errors branch June 9, 2023 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants