about summary refs log tree commit diff stats
path: root/runTest.cmake
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2022-01-07 10:17:15 +0100
committerGitHub <noreply@github.com>2022-01-07 10:17:15 +0100
commit667dc36962dbe86e2bb34715af5bb59ea1310e8e (patch)
tree77e7a3c57bda249e0a28fc2325bfe8240a3117f5 /runTest.cmake
parente249a33d3e038f0e3c17f2f6c3eb5b8d7a21a2c3 (diff)
parentf5d06338c73429f945881cf4e89920c5f2ca56c2 (diff)
downloadbox64-667dc36962dbe86e2bb34715af5bb59ea1310e8e.tar.gz
box64-667dc36962dbe86e2bb34715af5bb59ea1310e8e.zip
Merge pull request #204 from Seas0/main
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}" )