Skip to content

Commit

Permalink
add error handling to test1.sh and c++ runtime dependency to windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jcschaff committed Jul 25, 2024
1 parent 29da1b3 commit f358eaf
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ jobs:
mingw-w64-clang-x86_64-netcdf
mingw-w64-clang-x86_64-zlib
mingw-w64-clang-x86_64-libaec
mingw-w64-clang-x86_64-libc++
mingw-w64-x86_64-libc++
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
Expand Down Expand Up @@ -249,6 +251,8 @@ jobs:
echo "working dir is $PWD"
cd build
PATH="/c/Program\ Files/LLVM/bin:$PATH"
ctest -VV
Expand Down
2 changes: 1 addition & 1 deletion NFsim_v1.11/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ enable_testing()
add_executable(${exe_target} ${SRC_FILES})
target_link_libraries(${exe_target} vcommons vcellmessaging)

add_test(NAME ${exe_target}_test2 COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/test1.sh ${CMAKE_BINARY_DIR}/bin/${exe_target} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests)
add_test(NAME ${exe_target}_test1 COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/test1.sh ${CMAKE_BINARY_DIR}/bin/${exe_target} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests)

install(TARGETS ${exe_target} RUNTIME DESTINATION ${OPTION_EXE_DIRECTORY})

46 changes: 43 additions & 3 deletions NFsim_v1.11/tests/test1.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,53 @@
#!/bin/bash
set -e
set -x
EXE=$1
INPUT="data/SimID_273069657_0_.nfsimInput"
OUTPUT="data/SimID_273069657_0_.gdat"
EXPECTED_OUTPUT="data/SimID_273069657_0_.gdat.expected"
SPECIES="data/SimID_273069657_0_.species"
EXPECTED_SPECIES="data/SimID_273069657_0_.species.expected"

if [ ! -f $EXE ]; then
echo "NFsim executable $EXE not found. Exiting..."
exit 1
fi
if [ ! -f $INPUT ]; then
echo "Input file $INPUT not found. Exiting..."
exit 1
fi
if [ ! -f $EXPECTED_OUTPUT ]; then
echo "Expected output file $EXPECTED_OUTPUT not found. Exiting..."
exit 1
fi
if [ ! -f $EXPECTED_SPECIES ]; then
echo "Expected species file $EXPECTED_SPECIES not found. Exiting..."
exit 1
fi


command="$EXE -seed 505790288 -vcell -xml $INPUT -o $OUTPUT -sim 1.0 -ss $SPECIES -oStep 20 -notf -utl 1000 -cb -pcmatch -tid 0"
$EXE $command
if ! $command; then
echo "NFsim failed to run. Exiting..."
exit 1
fi

# verify that the output files exist
if [ ! -f $OUTPUT ]; then
echo "Output file $OUTPUT not found. Exiting..."
exit 1
fi
if [ ! -f $SPECIES ]; then
echo "Species file $SPECIES not found. Exiting..."
exit 1
fi

diff $OUTPUT $EXPECTED_OUTPUT
diff $SPECIES $EXPECTED_SPECIES
# verify that the output files match the expected output files
if ! diff $OUTPUT $EXPECTED_OUTPUT; then
echo "Output file $OUTPUT does not match expected output $EXPECTED_OUTPUT. Exiting..."
exit 1
fi
if ! diff $SPECIES $EXPECTED_SPECIES; then
echo "Species file $SPECIES does not match expected species $EXPECTED_SPECIES. Exiting..."
exit 1
fi

0 comments on commit f358eaf

Please sign in to comment.