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

test(sqlite_header): improve sqlite_header tests #288

Merged
merged 4 commits into from
Sep 20, 2022

Conversation

aloisklink
Copy link
Contributor

The test_sqlite_header test is intermittently failing in GitHub Actions.

I'm not 100% sure why this the test is failing.
One thing I did notice is that CMocka performs really poorly in multi-threaded applications.

As recommended in the CMocka docs, I've added the CMOCKA_TEST_ABORT=1 environment variable so that CMocka automatically aborts() if a test fails, see https://api.cmocka.org/#main-threads

I've also removed all of the assert_*() macros from the non-main threads, since CMocka doesn't properly handle these. Instead, we pass an error_message string to the main thread, and the main thread then calls asssert_string_equal() on it.

This might fix #252, but even if it doesn't, hopefully this will improve the logs and make it easier to debug in the future.

The test_sqlite_header test is intermittently failing in
GitHub Actions.

I'm not 100% sure why this the test is failing.
One thing I did notice is that CMocka performs really poorly
in multi-threaded applications.

As recommended in the CMocka docs, I've added the CMOCKA_TEST_ABORT=1
environment variable so that CMocka automatically `aborts()` if a test
fails, see https://api.cmocka.org/#main-threads

I've also removed all of the `assert_*()` macros from the non-main
threads, since CMocka doesn't properly handle these. Instead, we
pass an error_message string to the main thread, and the main thread
then calls `asssert_string_equal()` on it.

This might fix #252,
but even if it doesn't, hopefully this will improve the logs and make
it easier to debug in the future.
@codecov
Copy link

codecov bot commented Sep 20, 2022

Codecov Report

❗ No coverage uploaded for pull request base (main@d5431f6). Click here to learn what that means.
The diff coverage is 59.09%.

@@           Coverage Diff           @@
##             main     #288   +/-   ##
=======================================
  Coverage        ?   49.04%           
=======================================
  Files           ?      116           
  Lines           ?    18519           
  Branches        ?        0           
=======================================
  Hits            ?     9083           
  Misses          ?     9436           
  Partials        ?        0           
Impacted Files Coverage Δ
tests/capture/middlewares/test_sqlite_header.c 75.67% <59.09%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@mereacre mereacre merged commit 73be2a4 into main Sep 20, 2022
@mereacre mereacre deleted the test/improve-sqlite-header-tests branch September 20, 2022 13:20
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.

Intermittent failing CI due to Failed to execute statement: disk I/O error
2 participants