mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-21 06:30:20 -06:00
Tests: Improve RunCMake.add_test error formatting
This commit is contained in:
@@ -2,27 +2,33 @@ set(testfile "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake")
|
|||||||
if(EXISTS "${testfile}")
|
if(EXISTS "${testfile}")
|
||||||
file(READ "${testfile}" testfile_contents)
|
file(READ "${testfile}" testfile_contents)
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Could not find expected CTestTestfile.cmake.")
|
set(RunCMake_TEST_FAILED "Could not find expected CTestTestfile.cmake.")
|
||||||
|
return()
|
||||||
endif()
|
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[(]DoesNotUseTestLauncher [^\n]+pseudo_test_launcher[^\n]+\n")
|
if(testfile_contents MATCHES "add_test[(]DoesNotUseTestLauncher [^\n]+pseudo_test_launcher[^\n]+\n")
|
||||||
message(SEND_ERROR "Used test launcher when it should not be used. ${error_details}")
|
set(RunCMake_TEST_FAILED "Used test launcher when it should not be used. ${error_details}")
|
||||||
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT testfile_contents MATCHES "add_test[(]UsesTestLauncher [^\n]+pseudo_test_launcher[^\n]+\n")
|
if(NOT testfile_contents MATCHES "add_test[(]UsesTestLauncher [^\n]+pseudo_test_launcher[^\n]+\n")
|
||||||
message(SEND_ERROR "Did not use test launcher when it should be used. ${error_details}")
|
set(RunCMake_TEST_FAILED "Did not use test launcher when it should be used. ${error_details}")
|
||||||
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(testfile_contents MATCHES "add_test[(]DoesNotUseTestLauncherWithGenex [^\n]+pseudo_test_launcher[^\n]+\n")
|
if(testfile_contents MATCHES "add_test[(]DoesNotUseTestLauncherWithGenex [^\n]+pseudo_test_launcher[^\n]+\n")
|
||||||
message(SEND_ERROR "Used test launcher when it should not be used. ${error_details}")
|
set(RunCMake_TEST_FAILED "Used test launcher when it should not be used. ${error_details}")
|
||||||
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT testfile_contents MATCHES "add_test[(]UsesTestLauncherWithExecTargetFromSubdirAddedWithoutGenex [^\n]+pseudo_test_launcher[^\n]+\n")
|
if(NOT testfile_contents MATCHES "add_test[(]UsesTestLauncherWithExecTargetFromSubdirAddedWithoutGenex [^\n]+pseudo_test_launcher[^\n]+\n")
|
||||||
message(SEND_ERROR "Did not use test launcher when it should be used. ${error_details}")
|
set(RunCMake_TEST_FAILED "Did not use test launcher when it should be used. ${error_details}")
|
||||||
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(testfile_contents MATCHES "add_test[(]DoesNotUseTestLauncherWithExecTargetFromSubdirAddedWithGenex [^\n]+pseudo_test_launcher[^\n]+\n")
|
if(testfile_contents MATCHES "add_test[(]DoesNotUseTestLauncherWithExecTargetFromSubdirAddedWithGenex [^\n]+pseudo_test_launcher[^\n]+\n")
|
||||||
message(SEND_ERROR "Used test launcher when it should not be used. ${error_details}")
|
set(RunCMake_TEST_FAILED "Used test launcher when it should not be used. ${error_details}")
|
||||||
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
Reference in New Issue
Block a user