Skip to content

Commit

Permalink
Sync test macros
Browse files Browse the repository at this point in the history
  • Loading branch information
byrnHDF committed Nov 14, 2023
1 parent 9953b34 commit 1e68226
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 20 deletions.
21 changes: 19 additions & 2 deletions HDF5Examples/config/cmake/jrunTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ endif ()
# run the test program, capture the stdout/stderr and the result var
execute_process (
COMMAND ${TEST_TESTER} -Xmx1024M
-Dorg.slf4j.simpleLogger.defaultLogLevel=${LOG_LEVEL}
-Djava.library.path=${TEST_LIBRARY_DIRECTORY}
-cp "${TEST_CLASSPATH}" ${TEST_ARGS} ${TEST_PROGRAM}
${ARGN}
Expand Down Expand Up @@ -133,7 +134,7 @@ if (NOT TEST_SKIP_COMPARE)
if (NOT TEST_SORT_COMPARE)
# now compare the output with the reference
execute_process (
COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_IGNORE_EOL} ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE}
COMMAND ${CMAKE_COMMAND} -E compare_files --ignore-eol ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE}
RESULT_VARIABLE TEST_COMPARE_RESULT
)
else ()
Expand Down Expand Up @@ -203,7 +204,7 @@ if (NOT TEST_SKIP_COMPARE)

# now compare the error output with the error reference
execute_process (
COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_IGNORE_EOL} ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF}
COMMAND ${CMAKE_COMMAND} -E compare_files --ignore-eol ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF}
RESULT_VARIABLE TEST_ERRREF_RESULT
)
if (TEST_ERRREF_RESULT)
Expand Down Expand Up @@ -283,6 +284,22 @@ if (TEST_SKIP_COMPARE AND NOT TEST_NO_DISPLAY)
endif ()
endif ()

if (NOT DEFINED ENV{HDF5_NOCLEANUP})
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 (TEST_DELETE_LIST)
foreach (dfile in ${TEST_DELETE_LIST})
file (REMOVE ${dfile})
endforeach ()
endif ()
endif ()

# everything went fine...
message (STATUS "${TEST_PROGRAM} Passed")

40 changes: 22 additions & 18 deletions HDF5Examples/config/cmake/runTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ if (NOT TEST_RESULT EQUAL TEST_EXPECT)
file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
message (STATUS "Output :\n${TEST_STREAM}")
endif ()
if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err")
file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM)
message (STATUS "Error Output :\n${TEST_STREAM}")
endif ()
endif ()
message (FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != ${TEST_EXPECT}.\n${TEST_ERROR}")
endif ()
Expand Down Expand Up @@ -214,19 +218,11 @@ if (NOT TEST_SKIP_COMPARE)
file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM)
list (LENGTH TEST_STREAM test_len)
if (test_len GREATER 0)
if (WIN32)
configure_file(${TEST_FOLDER}/${TEST_REFERENCE} ${TEST_FOLDER}/${TEST_REFERENCE}.tmp NEWLINE_STYLE CRLF)
if (EXISTS "${TEST_FOLDER}/${TEST_REFERENCE}.tmp")
file(RENAME ${TEST_FOLDER}/${TEST_REFERENCE}.tmp ${TEST_FOLDER}/${TEST_REFERENCE})
endif ()
#file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM)
#file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}")
endif ()

if (NOT TEST_SORT_COMPARE)
# now compare the output with the reference
execute_process (
COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_IGNORE_EOL} ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE}
COMMAND ${CMAKE_COMMAND} -E compare_files --ignore-eol ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE}
RESULT_VARIABLE TEST_COMPARE_RESULT
)
else ()
Expand Down Expand Up @@ -289,18 +285,10 @@ if (NOT TEST_SKIP_COMPARE)
file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM)
list (LENGTH TEST_STREAM test_len)
if (test_len GREATER 0)
if (WIN32)
configure_file(${TEST_FOLDER}/${TEST_ERRREF} ${TEST_FOLDER}/${TEST_ERRREF}.tmp NEWLINE_STYLE CRLF)
if (EXISTS "${TEST_FOLDER}/${TEST_ERRREF}.tmp")
file(RENAME ${TEST_FOLDER}/${TEST_ERRREF}.tmp ${TEST_FOLDER}/${TEST_ERRREF})
endif ()
#file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM)
#file (WRITE ${TEST_FOLDER}/${TEST_ERRREF} "${TEST_STREAM}")
endif ()

# now compare the error output with the error reference
execute_process (
COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_IGNORE_EOL} ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF}
COMMAND ${CMAKE_COMMAND} -E compare_files --ignore-eol ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF}
RESULT_VARIABLE TEST_ERRREF_RESULT
)
if (TEST_ERRREF_RESULT)
Expand Down Expand Up @@ -378,6 +366,22 @@ if (TEST_SKIP_COMPARE AND NOT TEST_NO_DISPLAY)
)
endif ()

if (NOT DEFINED ENV{HDF5_NOCLEANUP})
if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}" AND NOT TEST_SAVE)
file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT})
endif ()

if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err")
file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err)
endif ()

if (TEST_DELETE_LIST)
foreach (dfile in ${TEST_DELETE_LIST})
file (REMOVE ${dfile})
endforeach ()
endif ()
endif ()

# everything went fine...
message (STATUS "${TEST_PROGRAM} Passed")

0 comments on commit 1e68226

Please sign in to comment.