AddTest-check.cmake 1.3 KB

12345678910111213141516171819202122232425262728
  1. set(testfile "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake")
  2. if(EXISTS "${testfile}")
  3. file(READ "${testfile}" testfile_contents)
  4. else()
  5. message(FATAL_ERROR "Could not find expected CTestTestfile.cmake.")
  6. endif()
  7. set(error_details "There is a problem with generated test file: ${testfile}")
  8. if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulator [^\n]+pseudo_emulator[^\n]+\n")
  9. message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
  10. endif()
  11. if(NOT testfile_contents MATCHES "add_test[(]UsesEmulator [^\n]+pseudo_emulator[^\n]+\n")
  12. message(SEND_ERROR "Did not use emulator when it should be used. ${error_details}")
  13. endif()
  14. if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithGenex [^\n]+pseudo_emulator[^\n]+\n")
  15. message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
  16. endif()
  17. if(NOT testfile_contents MATCHES "add_test[(]UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex [^\n]+pseudo_emulator[^\n]+\n")
  18. message(SEND_ERROR "Did not use emulator when it should be used. ${error_details}")
  19. endif()
  20. if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex [^\n]+pseudo_emulator[^\n]+\n")
  21. message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
  22. endif()