From 5d830b1873c67def2d781acf9cc14ea8c3304c02 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 27 Mar 2017 10:41:30 -0500 Subject: Update with extra checks for reference --- config/cmake/jrunTest.cmake | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/config/cmake/jrunTest.cmake b/config/cmake/jrunTest.cmake index 0e0106f..67b42fb 100644 --- a/config/cmake/jrunTest.cmake +++ b/config/cmake/jrunTest.cmake @@ -25,6 +25,15 @@ if (NOT TEST_REFERENCE) message (FATAL_ERROR "Require TEST_REFERENCE to be defined") endif () +if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) + file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}) +endif () + +if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) + file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) +endif () + +# if there is not an error reference file add the error output to the stdout file if (NOT TEST_ERRREF) if (NOT SKIP_APPEND) # append error file since skip was not defined @@ -60,6 +69,7 @@ execute_process ( message (STATUS "COMMAND Result: ${TEST_RESULT}") +# if the .err file exists and ERRROR_APPEND is enabled if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) if (TEST_MASK_FILE) @@ -75,6 +85,7 @@ if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) endif () endif () +# if the output file or the .err file needs to mask out error stack info if (TEST_MASK_ERROR) if (NOT TEST_ERRREF) # the error stack has been appended to the output file @@ -125,7 +136,7 @@ if (NOT TEST_SKIP_COMPARE) list (LENGTH test_act len_act) file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) list (LENGTH test_ref len_ref) - if (NOT ${len_act} STREQUAL "0") + if (NOT ${len_act} STREQUAL "0" AND NOT ${len_ref} STREQUAL "0") math (EXPR _FP_LEN "${len_ref} - 1") foreach (line RANGE 0 ${_FP_LEN}) list (GET test_act ${line} str_act) @@ -137,6 +148,13 @@ if (NOT TEST_SKIP_COMPARE) endif () endif () endforeach () + else () + if (${len_act} STREQUAL "0") + message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty") + endif () + if (${len_ref} STREQUAL "0") + message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty") + endif () endif () if (NOT ${len_act} STREQUAL ${len_ref}) set (TEST_RESULT 1) @@ -169,7 +187,7 @@ if (NOT TEST_SKIP_COMPARE) file (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref) list (LENGTH test_ref len_ref) math (EXPR _FP_LEN "${len_ref} - 1") - if (NOT ${len_act} STREQUAL "0") + if (NOT ${len_act} STREQUAL "0" AND NOT ${len_ref} STREQUAL "0") math (EXPR _FP_LEN "${len_ref} - 1") foreach (line RANGE 0 ${_FP_LEN}) list (GET test_act ${line} str_act) @@ -181,7 +199,14 @@ if (NOT TEST_SKIP_COMPARE) endif () endif () endforeach () - endif () + else () + if (${len_act} STREQUAL "0") + message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT}.err is empty") + endif () + if (${len_ref} STREQUAL "0") + message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_ERRREF} is empty") + endif () + endif() if (NOT ${len_act} STREQUAL ${len_ref}) set (TEST_RESULT 1) endif () -- cgit v0.12