aboutsummaryrefslogtreecommitdiff
path: root/printer/test/diff.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'printer/test/diff.cmake')
-rw-r--r--printer/test/diff.cmake21
1 files changed, 21 insertions, 0 deletions
diff --git a/printer/test/diff.cmake b/printer/test/diff.cmake
new file mode 100644
index 0000000..dc61a65
--- /dev/null
+++ b/printer/test/diff.cmake
@@ -0,0 +1,21 @@
+set(ENV{SYST_UNITTESTING} "1")
+string(REPLACE "^" ";" OPTIONS ${OPTIONS})
+
+execute_process(
+ COMMAND ${EXECUTABLE} ${OPTIONS}
+ OUTPUT_FILE ${TEST_OUTPUT}
+ RESULT_VARIABLE EXIT_CODE
+)
+
+if(EXIT_CODE)
+ message(FATAL_ERROR "execution of ${EXECUTABLE} ${OPTIONS} failed")
+endif(EXIT_CODE)
+
+execute_process(
+ COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_REFERENCE} ${TEST_OUTPUT}
+ RESULT_VARIABLE DIFF_FAIL
+)
+
+if (DIFF_FAIL)
+ message(FATAL_ERROR "Reference match failed.")
+endif(DIFF_FAIL) \ No newline at end of file