AddTest-CMP0158-NEW-check.cmake 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. set(testfile "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake")
  2. if(EXISTS "${testfile}")
  3. file(READ "${testfile}" testfile_contents)
  4. else()
  5. set(RunCMake_TEST_FAILED "Could not find expected CTestTestfile.cmake.")
  6. return()
  7. endif()
  8. set(error_details "There is a problem with generated test file:\n ${testfile}")
  9. if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulator [^$<>\n]+pseudo_emulator[^$<>\n]+\n")
  10. set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
  11. return()
  12. endif()
  13. if(testfile_contents MATCHES "add_test[(]ShouldNotUseEmulator [^$<>\n]+pseudo_emulator[^$<>\n]+\n")
  14. set(RunCMake_TEST_FAILED "Used emulator when it should be used. ${error_details}")
  15. return()
  16. endif()
  17. if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithGenex [^$<>\n]+pseudo_emulator[^$<>\n]+\n")
  18. set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
  19. return()
  20. endif()
  21. if(testfile_contents MATCHES "add_test[(]ShouldNotUseEmulatorWithExecTargetFromSubdirAddedWithoutGenex [^$<>\n]+pseudo_emulator[^$<>\n]+\n")
  22. set(RunCMake_TEST_FAILED "Used emulator when it should be used. ${error_details}")
  23. return()
  24. endif()
  25. if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex [^$<>\n]+pseudo_emulator[^$<>\n]+\n")
  26. set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
  27. return()
  28. endif()