mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-20 06:00:30 -06:00
Tests: Improve RunCMake.CrosscompilingEmulator error formatting
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
foreach(output IN ITEMS output1 output2 output3 output4)
|
||||
if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/${output}")
|
||||
message(FATAL_ERROR "Failed to create output: ${RunCMake_TEST_BINARY_DIR}/${output}")
|
||||
set(RunCMake_TEST_FAILED "Failed to create output:\n ${RunCMake_TEST_BINARY_DIR}/${output}")
|
||||
return()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/output")
|
||||
message(FATAL_ERROR "Failed to create output: ${RunCMake_TEST_BINARY_DIR}/output")
|
||||
set(RunCMake_TEST_FAILED "Failed to create output:\n ${RunCMake_TEST_BINARY_DIR}/output")
|
||||
return()
|
||||
endif()
|
||||
|
||||
@@ -2,27 +2,33 @@ set(testfile "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake")
|
||||
if(EXISTS "${testfile}")
|
||||
file(READ "${testfile}" testfile_contents)
|
||||
else()
|
||||
message(FATAL_ERROR "Could not find expected CTestTestfile.cmake.")
|
||||
set(RunCMake_TEST_FAILED "Could not find expected CTestTestfile.cmake.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(error_details "There is a problem with generated test file: ${testfile}")
|
||||
set(error_details "There is a problem with generated test file:\n ${testfile}")
|
||||
|
||||
if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulator [^\n]+pseudo_emulator[^\n]+\n")
|
||||
message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
|
||||
set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(testfile_contents MATCHES "add_test[(]ShouldNotUseEmulator [^\n]+pseudo_emulator[^\n]+\n")
|
||||
message(SEND_ERROR "Used emulator when it should be used. ${error_details}")
|
||||
set(RunCMake_TEST_FAILED "Used emulator when it should be used. ${error_details}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithGenex [^\n]+pseudo_emulator[^\n]+\n")
|
||||
message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
|
||||
set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(testfile_contents MATCHES "add_test[(]ShouldNotUseEmulatorWithExecTargetFromSubdirAddedWithoutGenex [^\n]+pseudo_emulator[^\n]+\n")
|
||||
message(SEND_ERROR "Used emulator when it should be used. ${error_details}")
|
||||
set(RunCMake_TEST_FAILED "Used emulator when it should be used. ${error_details}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex [^\n]+pseudo_emulator[^\n]+\n")
|
||||
message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
|
||||
set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
@@ -2,27 +2,33 @@ set(testfile "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake")
|
||||
if(EXISTS "${testfile}")
|
||||
file(READ "${testfile}" testfile_contents)
|
||||
else()
|
||||
message(FATAL_ERROR "Could not find expected CTestTestfile.cmake.")
|
||||
set(RunCMake_TEST_FAILED "Could not find expected CTestTestfile.cmake.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(error_details "There is a problem with generated test file: ${testfile}")
|
||||
set(error_details "There is a problem with generated test file:\n ${testfile}")
|
||||
|
||||
if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulator [^\n]+pseudo_emulator[^\n]+\n")
|
||||
message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
|
||||
set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT testfile_contents MATCHES "add_test[(]UsesEmulator [^\n]+pseudo_emulator[^\n]+\n")
|
||||
message(SEND_ERROR "Did not use emulator when it should be used. ${error_details}")
|
||||
set(RunCMake_TEST_FAILED "Did not use emulator when it should be used. ${error_details}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithGenex [^\n]+pseudo_emulator[^\n]+\n")
|
||||
message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
|
||||
set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT testfile_contents MATCHES "add_test[(]UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex [^\n]+pseudo_emulator[^\n]+\n")
|
||||
message(SEND_ERROR "Did not use emulator when it should be used. ${error_details}")
|
||||
set(RunCMake_TEST_FAILED "Did not use emulator when it should be used. ${error_details}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex [^\n]+pseudo_emulator[^\n]+\n")
|
||||
message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
|
||||
set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
@@ -2,31 +2,38 @@ set(testfile "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake")
|
||||
if(EXISTS "${testfile}")
|
||||
file(READ "${testfile}" testfile_contents)
|
||||
else()
|
||||
message(FATAL_ERROR "Could not find expected CTestTestfile.cmake.")
|
||||
set(RunCMake_TEST_FAILED "Could not find expected CTestTestfile.cmake.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(error_details "There is a problem with generated test file: ${testfile}")
|
||||
set(error_details "There is a problem with generated test file:\n ${testfile}")
|
||||
|
||||
if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulator [^\n]+pseudo_emulator[^\n]+\n")
|
||||
message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
|
||||
set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT testfile_contents MATCHES "add_test[(]UsesEmulator [^\n]+pseudo_emulator[^\n]+\n")
|
||||
message(SEND_ERROR "Did not use emulator when it should be used. ${error_details}")
|
||||
set(RunCMake_TEST_FAILED "Did not use emulator when it should be used. ${error_details}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithGenex [^\n]+pseudo_emulator[^\n]+\n")
|
||||
message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
|
||||
set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT testfile_contents MATCHES "add_test[(]UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex [^\n]+pseudo_emulator[^\n]+\n")
|
||||
message(SEND_ERROR "Did not use emulator when it should be used. ${error_details}")
|
||||
set(RunCMake_TEST_FAILED "Did not use emulator when it should be used. ${error_details}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex [^\n]+pseudo_emulator[^\n]+\n")
|
||||
message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
|
||||
set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT testfile_contents MATCHES "add_test[(]UsesTestLauncherAndEmulator[^\n]+pseudo_test_launcher.*pseudo_emulator[^\n]+\n")
|
||||
message(SEND_ERROR "Did not use test launcher and emulator when they should be used. ${error_details}")
|
||||
set(RunCMake_TEST_FAILED "Did not use test launcher and emulator when they should be used. ${error_details}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user