James Kuszmaul | ba0ac1a | 2022-08-12 16:29:30 -0700 | [diff] [blame] | 1 | set (RUNS 3) |
| 2 | |
| 3 | foreach (iter RANGE 1 ${RUNS}) |
| 4 | execute_process (COMMAND ${LOGCLEANUP} -log_dir=${TEST_DIR} |
| 5 | RESULT_VARIABLE _RESULT) |
| 6 | |
| 7 | if (NOT _RESULT EQUAL 0) |
| 8 | message (FATAL_ERROR "Failed to run logcleanup_unittest (error: ${_RESULT})") |
| 9 | endif (NOT _RESULT EQUAL 0) |
| 10 | |
| 11 | # Ensure the log files to have different modification timestamps such that |
| 12 | # exactly one log file remains at the end. Otherwise all log files will be |
| 13 | # retained. |
| 14 | execute_process (COMMAND ${CMAKE_COMMAND} -E sleep 1) |
| 15 | endforeach (iter) |
| 16 | |
| 17 | file (GLOB LOG_FILES ${TEST_DIR}/test_cleanup_*.barfoo) |
| 18 | list (LENGTH LOG_FILES NUM_FILES) |
| 19 | |
| 20 | if (NOT NUM_FILES EQUAL 1) |
| 21 | message (SEND_ERROR "Expected 1 log file in build directory ${TEST_DIR} but found ${NUM_FILES}") |
| 22 | endif (NOT NUM_FILES EQUAL 1) |