Add file existence tests.

This commit is contained in:
Ye Luo 2022-09-09 11:44:13 -05:00
parent f0b740b379
commit 8b42da1bd5
2 changed files with 19 additions and 0 deletions

View File

@ -654,3 +654,16 @@ function(
set_property(TEST ${FULLNAME} APPEND PROPERTY PASS_REGULAR_EXPRESSION "Time limit reached for")
endif()
endfunction()
# Add a test to see if a file exists in the desired location.
function(add_test_check_file_existence TEST_DEP_IN FILE_NAME SHOULD_SUCCEED)
if(TEST ${TEST_DEP_IN})
get_test_property(${TEST_DEP_IN} WORKING_DIRECTORY TEST_DEP_IN_WORK_DIR)
set(TESTNAME ${TEST_DEP_IN}-exists-${FILE_NAME})
add_test(NAME ${TESTNAME} COMMAND ls ${TEST_DEP_IN_WORK_DIR}/${FILE_NAME})
if (NOT SHOULD_SUCCEED)
set_property(TEST ${TESTNAME} PROPERTY WILL_FAIL TRUE)
endif()
set_tests_properties(${TESTNAME} PROPERTIES DEPENDS ${TEST_DEP_IN})
endif()
endfunction()

View File

@ -107,6 +107,12 @@ if(NOT QMC_CUDA)
2
check.sh
false)
add_test_check_file_existence(deterministic-restart_batch-8-2 qmc_short_batch.s000.config.h5 TRUE)
add_test_check_file_existence(deterministic-restart_batch-8-2 qmc_short_batch.s000.random.h5 TRUE)
add_test_check_file_existence(deterministic-restart_batch-8-2 qmc_short_batch.s001.config.h5 FALSE)
add_test_check_file_existence(deterministic-restart_batch-8-2 qmc_short_batch.s001.random.h5 FALSE)
run_restart_and_check(
deterministic-restart_batch
"${qmcpack_SOURCE_DIR}/tests/io/restart_batch"