Skip to content

Prevent test colision when running in parallel via RESOURCE_LOCK#1637

Open
marty1885 wants to merge 1 commit intoopen-source-parsers:masterfrom
marty1885:fix-parallel-test-run
Open

Prevent test colision when running in parallel via RESOURCE_LOCK#1637
marty1885 wants to merge 1 commit intoopen-source-parsers:masterfrom
marty1885:fix-parallel-test-run

Conversation

@marty1885
Copy link

Hi, while working with jsoncpp I noticed that jsoncpp's tests fails if it's running in parallel via ctest -j. See the following logs for detail

❯ ctest -j
Test project /home/marty/Documents/not-my-projects/jsoncpp/build
    Start 2: jsoncpp_readerwriter_json_checker
    Start 1: jsoncpp_readerwriter
    Start 3: jsoncpp_test
1/3 Test #3: jsoncpp_test ........................   Passed    0.01 sec
2/3 Test #2: jsoncpp_readerwriter_json_checker ...***Failed    0.27 sec
3/3 Test #1: jsoncpp_readerwriter ................   Passed    0.60 sec

67% tests passed, 1 tests failed out of 3

Total Test time (real) =   0.61 sec

The following tests FAILED:
          2 - jsoncpp_readerwriter_json_checker (Failed)
Errors while running CTest
Output from these tests are in: /home/marty/Documents/not-my-projects/jsoncpp/build/Testing/Temporary/LastTest.log
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.

The root cause seems to be that both tests writes to the same output/intermid file and colides. ctest by default is single-threaded thus hiding this bug.

This PR fixes the problem by setting RESOURCE_LOCK to serialize the tests even when ctest is instructed to run parallel.

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.

1 participant