From 048a4b53025f3bdebb8ca467c9b98d54a94058f1 Mon Sep 17 00:00:00 2001 From: Leandro Martinez Date: Fri, 12 Jul 2024 09:52:27 -0300 Subject: [PATCH] restore testing of generation of failed packing files --- testing/test.sh | 5 ++++- testing/test_failed.sh | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100755 testing/test_failed.sh diff --git a/testing/test.sh b/testing/test.sh index 3467aab..4c33e00 100755 --- a/testing/test.sh +++ b/testing/test.sh @@ -4,4 +4,7 @@ curl -fsSL https://install.julialang.org | sh # Run the tests julia runtests.jl water_box.inp \ - ieee_signaling.inp \ No newline at end of file + ieee_signaling.inp + +# check if output files are properly generated in a failed run +./test_failed.sh water_box_failed.inp packmol.log "FORCED" diff --git a/testing/test_failed.sh b/testing/test_failed.sh new file mode 100755 index 0000000..45ad787 --- /dev/null +++ b/testing/test_failed.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# +# First argument: input file name +# Second argument: log file name +# +# Third argument: string to be searched in the log file, to declare that +# the test passed +# +# Example: ./test.sh "water_box.inp" "packmol.log" "FORCED" +# +if ! [ -f $1 ]; then + echo "Error: input file not found: $1" + exit 1 +fi +../packmol < $1 > $2 +if ! [ -f $2 ]; then + echo "Error: Log file not generated: $2" + exit 1 +fi +if ! grep -q $3 $2; then + echo "Error: could not find $3 in $2" + exit 1 +fi +exit 0