summaryrefslogtreecommitdiff
path: root/Tests/RunCMake/CommandLine/trace-redirect-check.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake/CommandLine/trace-redirect-check.cmake')
-rw-r--r--Tests/RunCMake/CommandLine/trace-redirect-check.cmake13
1 files changed, 13 insertions, 0 deletions
diff --git a/Tests/RunCMake/CommandLine/trace-redirect-check.cmake b/Tests/RunCMake/CommandLine/trace-redirect-check.cmake
new file mode 100644
index 000000000..1ee0e0de6
--- /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()