diff options
author | Brad King <brad.king@kitware.com> | 2024-01-26 19:42:01 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-01-27 15:01:18 (GMT) |
commit | 54edf3471e470595dd18e9dcc8d0bc59bab75559 (patch) | |
tree | 389be149d1877c880d4dde54861e3a0145aaf596 | |
parent | 2b5447d4a8a35f58e97a42270202a5dad3277dc4 (diff) | |
download | CMake-54edf3471e470595dd18e9dcc8d0bc59bab75559.zip CMake-54edf3471e470595dd18e9dcc8d0bc59bab75559.tar.gz CMake-54edf3471e470595dd18e9dcc8d0bc59bab75559.tar.bz2 |
Tests: Improve RunCMake.CrosscompilingEmulator error formatting
5 files changed, 45 insertions, 24 deletions
diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand-build-check.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand-build-check.cmake index e10b161..67fe8ec 100644 --- a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand-build-check.cmake +++ b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand-build-check.cmake @@ -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() diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommandWithArg-build-check.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommandWithArg-build-check.cmake index 9ca6106..691191d 100644 --- a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommandWithArg-build-check.cmake +++ b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommandWithArg-build-check.cmake @@ -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() diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-NEW-check.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-NEW-check.cmake index 8a6a702..6d5128a 100644 --- a/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-NEW-check.cmake +++ b/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-NEW-check.cmake @@ -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() diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD-check.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD-check.cmake index 588b77b..079e45c 100644 --- a/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD-check.cmake +++ b/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD-check.cmake @@ -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() diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake index 459e922..81b145b 100644 --- a/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake +++ b/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake @@ -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() |