CTest: Teach --show-only= to reject unknown values

This commit is contained in:
Brad King
2019-01-16 14:32:29 -05:00
parent 7370b02c36
commit cae9d2a61a
5 changed files with 8 additions and 0 deletions

View File

@@ -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;
}
}

View File

@@ -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()

View File

@@ -0,0 +1 @@
1

View File

@@ -0,0 +1 @@
^CMake Error: '--show-only=' given unknown value 'bad'$

View File

@@ -0,0 +1 @@
Test #1: ShowOnly