diff options
author | Brad King <brad.king@kitware.com> | 2019-01-16 19:32:29 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-01-17 17:01:07 (GMT) |
commit | cae9d2a61afea3948c8dfaf1f7dbc39ebaa71055 (patch) | |
tree | e3d073b40e2f1bb5a99976b0e7859b29fe00ddb2 | |
parent | 7370b02c36b45bcd92b6c5bb7cc65ecff75b9b2b (diff) | |
download | CMake-cae9d2a61afea3948c8dfaf1f7dbc39ebaa71055.zip CMake-cae9d2a61afea3948c8dfaf1f7dbc39ebaa71055.tar.gz CMake-cae9d2a61afea3948c8dfaf1f7dbc39ebaa71055.tar.bz2 |
CTest: Teach --show-only= to reject unknown values
5 files changed, 8 insertions, 0 deletions
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 65c0d91..ccd74c0 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1944,6 +1944,9 @@ bool cmCTest::HandleCommandLineArguments(size_t& i, this->Quiet = true; this->OutputAsJson = true; this->OutputAsJsonVersion = 1; + } else if (format != "human") { + errormsg = "'--show-only=' given unknown value '" + format + "'"; + return false; } } diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 82bd963..d524f41 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -203,6 +203,8 @@ function(run_ShowOnly) set_tests_properties(ShowOnly PROPERTIES WILL_FAIL true _BACKTRACE_TRIPLES \"file1;1;add_test;file0;;\") add_test(ShowOnlyNotAvailable NOT_AVAILABLE) ") + run_cmake_command(show-only_human ${CMAKE_CTEST_COMMAND} --show-only=human) + run_cmake_command(show-only_bad ${CMAKE_CTEST_COMMAND} --show-only=bad) run_cmake_command(show-only_json-v1 ${CMAKE_CTEST_COMMAND} --show-only=json-v1) endfunction() run_ShowOnly() diff --git a/Tests/RunCMake/CTestCommandLine/show-only_bad-result.txt b/Tests/RunCMake/CTestCommandLine/show-only_bad-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/show-only_bad-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CTestCommandLine/show-only_bad-stderr.txt b/Tests/RunCMake/CTestCommandLine/show-only_bad-stderr.txt new file mode 100644 index 0000000..cc55ab3 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/show-only_bad-stderr.txt @@ -0,0 +1 @@ +^CMake Error: '--show-only=' given unknown value 'bad'$ diff --git a/Tests/RunCMake/CTestCommandLine/show-only_human-stdout.txt b/Tests/RunCMake/CTestCommandLine/show-only_human-stdout.txt new file mode 100644 index 0000000..1332149 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/show-only_human-stdout.txt @@ -0,0 +1 @@ +Test #1: ShowOnly |