about summary refs log tree commit diff stats
path: root/runTest.cmake
diff options
context:
space:
mode:
authorSeas0 <30485844+Seas0@users.noreply.github.com>2022-01-07 16:37:23 +0800
committerSeas0 <30485844+Seas0@users.noreply.github.com>2022-01-07 16:43:52 +0800
commit42ab23a8332aaeee4e4a47e2608fba09833b46be (patch)
treec44b9a1341ba13806c811ebe6362e3cf83d6b149 /runTest.cmake
parent5e01769622b0d5edda8e42c994eff171887cc1d8 (diff)
downloadbox64-42ab23a8332aaeee4e4a47e2608fba09833b46be.tar.gz
box64-42ab23a8332aaeee4e4a47e2608fba09833b46be.zip
Sync configuration from box86
Diffstat (limited to 'runTest.cmake')
-rwxr-xr-xrunTest.cmake11
1 files changed, 11 insertions, 0 deletions
diff --git a/runTest.cmake b/runTest.cmake
index cb6706ae..11ab75fe 100755
--- a/runTest.cmake
+++ b/runTest.cmake
@@ -32,6 +32,9 @@ execute_process(
 
 # if the return value is !=0 bail out
 if( TEST_RESULT )
+  get_filename_component(TESTNAME "${TEST_ARGS}" NAME)
+  file(RENAME "${TEST_OUTPUT}" "${CMAKE_BINARY_DIR}/${TESTNAME}.out")
+  file(WRITE  "${CMAKE_BINARY_DIR}/${TESTNAME}.err" ${TEST_ERROR})
   message( FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != 0.\n${TEST_ERROR}" )
 endif( TEST_RESULT )
 
@@ -43,8 +46,16 @@ execute_process(
 
 # again, if return value is !=0 scream and shout
 if( TEST_RESULT )
+  get_filename_component(TESTNAME "${TEST_ARGS}" NAME)
+  file(RENAME "${TEST_OUTPUT}" "${CMAKE_BINARY_DIR}/${TESTNAME}.out")
+  file(WRITE  "${CMAKE_BINARY_DIR}/${TESTNAME}.err" ${TEST_ERROR})
   message( FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not match ${TEST_REFERENCE}")
 endif( TEST_RESULT )
 
+# remove the temporary files if they exist
+if( EXISTS ${TEST_OUTPUT} )
+  file(REMOVE "${TEST_OUTPUT}")
+endif()
+
 # everything went fine...
 message( "Passed: The output of ${TEST_PROGRAM} matches ${TEST_REFERENCE}" )