Skip to content

Commit

Permalink
cmake: clean up on successful runs and randomise test scheduling (#202)
Browse files Browse the repository at this point in the history
In the case where we create the test path, we should clean up after the
run finishes as done in the Makefile, due to garbage that is left behind
by tests and accumulates.

While at it, randomise test scheduling in order to increase the likelihood
of surfacing latent bugs that are hidden by the execution order.
  • Loading branch information
isaac-io authored and Yuval-Ariel committed Nov 25, 2022
1 parent 6b6c27e commit ee041c1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmake/CTestRunner.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,9 @@ else()
endif()

# Run all tests, and show test output on failure
execute_process(COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure --timeout ${test_timeout})
execute_process(COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure --schedule-random --timeout ${test_timeout} RESULT_VARIABLE rv)

# Clean up after ourselves if the run was successful
if(DEFINED tmpdir AND DEFINED rv AND ${rv} EQUAL 0)
file(REMOVE_RECURSE ${tmpdir})
endif()

0 comments on commit ee041c1

Please sign in to comment.