1
0

AddTest-check.cmake 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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(NOT testfile_contents MATCHES "add_test[(]UsesEmulator [^\n]+pseudo_emulator[^\n]+\n")
  14. set(RunCMake_TEST_FAILED "Did not use 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(NOT testfile_contents MATCHES "add_test[(]UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex [^\n]+pseudo_emulator[^\n]+\n")
  22. set(RunCMake_TEST_FAILED "Did not use 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()
  29. if(NOT testfile_contents MATCHES "add_test[(]UsesTestLauncherAndEmulator[^\n]+pseudo_emulator[^\n]+pseudo_emulator[^\n]+\n")
  30. set(RunCMake_TEST_FAILED "Did not use test launcher and emulator when they should be used. ${error_details}")
  31. return()
  32. endif()