RunCleanerTest1.cmake 755 B

12345678910111213141516171819202122
  1. set (RUNS 3)
  2. foreach (iter RANGE 1 ${RUNS})
  3. set (ENV{GOOGLE_LOG_DIR} ${TEST_DIR})
  4. execute_process (COMMAND ${LOGCLEANUP} RESULT_VARIABLE _RESULT)
  5. if (NOT _RESULT EQUAL 0)
  6. message (FATAL_ERROR "Failed to run logcleanup_unittest (error: ${_RESULT})")
  7. endif (NOT _RESULT EQUAL 0)
  8. # Ensure the log files to have different modification timestamps such that
  9. # exactly one log file remains at the end. Otherwise all log files will be
  10. # retained.
  11. execute_process (COMMAND ${CMAKE_COMMAND} -E sleep 1)
  12. endforeach (iter)
  13. file (GLOB LOG_FILES ${TEST_DIR}/*.foobar)
  14. list (LENGTH LOG_FILES NUM_FILES)
  15. if (NOT NUM_FILES EQUAL 1)
  16. message (SEND_ERROR "Expected 1 log file in log directory but found ${NUM_FILES}")
  17. endif (NOT NUM_FILES EQUAL 1)