blob: d3b51e35529e4c5c8b441ade70122388d5ee2e03 [file] [log] [blame]
James Kuszmaulba0ac1a2022-08-12 16:29:30 -07001set (RUNS 3)
2
3foreach (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)
15endforeach (iter)
16
17file (GLOB LOG_FILES ${TEST_DIR}/test_cleanup_*.barfoo)
18list (LENGTH LOG_FILES NUM_FILES)
19
20if (NOT NUM_FILES EQUAL 1)
21 message (SEND_ERROR "Expected 1 log file in build directory ${TEST_DIR} but found ${NUM_FILES}")
22endif (NOT NUM_FILES EQUAL 1)