test1-timeout.cmake 636 B

1234567891011121314
  1. # This is run by test test1 in repeat-after-timeout-cmake.cmake with cmake -P.
  2. # It reads the file TEST_OUTPUT_FILE and increments the number
  3. # found in the file by 1. Unless the number is 2, then the
  4. # code sends out a cmake error causing the test to not timeout only on
  5. # the second time it is run.
  6. message("TEST_OUTPUT_FILE = ${TEST_OUTPUT_FILE}")
  7. file(READ "${TEST_OUTPUT_FILE}" COUNT)
  8. message("COUNT= ${COUNT}")
  9. math(EXPR COUNT "${COUNT} + 1")
  10. file(WRITE "${TEST_OUTPUT_FILE}" "${COUNT}")
  11. if(NOT COUNT EQUAL 2)
  12. message("this test times out except on the 2nd run")
  13. execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 10)
  14. endif()