diff options
Diffstat (limited to 'Tests')
7 files changed, 24 insertions, 0 deletions
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 4e19871..dd49423 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -484,6 +484,14 @@ set(RunCMake_TEST_OPTIONS --trace-expand --warn-uninitialized) run_cmake(trace-expand-warn-uninitialized) unset(RunCMake_TEST_OPTIONS) +set(RunCMake_TEST_OPTIONS --trace-redirect=${RunCMake_BINARY_DIR}/redirected.trace) +run_cmake(trace-redirect) +unset(RunCMake_TEST_OPTIONS) + +set(RunCMake_TEST_OPTIONS --trace-redirect=/no/such/file.txt) +run_cmake(trace-redirect-nofile) +unset(RunCMake_TEST_OPTIONS) + set(RunCMake_TEST_OPTIONS -Wno-deprecated --warn-uninitialized) run_cmake(warn-uninitialized) unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/RunCMake/CommandLine/trace-redirect-check.cmake b/Tests/RunCMake/CommandLine/trace-redirect-check.cmake new file mode 100644 index 0000000..1ee0e0d --- /dev/null +++ b/Tests/RunCMake/CommandLine/trace-redirect-check.cmake @@ -0,0 +1,13 @@ +file(READ ${RunCMake_SOURCE_DIR}/trace-stderr.txt expected_content) +string(REGEX REPLACE "\n+$" "" expected_content "${expected_content}") + +file(READ ${RunCMake_BINARY_DIR}/redirected.trace actual_content) +string(REGEX REPLACE "\r\n" "\n" actual_content "${actual_content}") +string(REGEX REPLACE "\n+$" "" actual_content "${actual_content}") +if(NOT "${actual_content}" MATCHES "${expected_content}") + set(RunCMake_TEST_FAILED + "Trace file content does not match that expected." + "Expected to match:\n${expected_content}\n" + "Actual content:\n${actual_content}\n" + ) +endif() diff --git a/Tests/RunCMake/CommandLine/trace-redirect-nofile-result.txt b/Tests/RunCMake/CommandLine/trace-redirect-nofile-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/trace-redirect-nofile-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/trace-redirect-nofile-stderr.txt b/Tests/RunCMake/CommandLine/trace-redirect-nofile-stderr.txt new file mode 100644 index 0000000..edb0c8e --- /dev/null +++ b/Tests/RunCMake/CommandLine/trace-redirect-nofile-stderr.txt @@ -0,0 +1 @@ +^CMake Error: Error opening trace file /no/such/file.txt: .+$ diff --git a/Tests/RunCMake/CommandLine/trace-redirect-nofile.cmake b/Tests/RunCMake/CommandLine/trace-redirect-nofile.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CommandLine/trace-redirect-nofile.cmake diff --git a/Tests/RunCMake/CommandLine/trace-redirect-stdout.txt b/Tests/RunCMake/CommandLine/trace-redirect-stdout.txt new file mode 100644 index 0000000..775f2b5 --- /dev/null +++ b/Tests/RunCMake/CommandLine/trace-redirect-stdout.txt @@ -0,0 +1 @@ +^.*Trace will be written to .+redirected.trace.*$ diff --git a/Tests/RunCMake/CommandLine/trace-redirect.cmake b/Tests/RunCMake/CommandLine/trace-redirect.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CommandLine/trace-redirect.cmake |