test runner: allow an arbitrary number of reference results

if one of the files matches (fuzzyly, obviously), the test counts as
passed if none matches it counts as failed. this lets us add reference
results for hosts that need the same number of time steps, but for
whatever reason produce a different result. also, the number of time
steps required to produce the result do not matter anymore, as long as
the data is the same (in the fuzzy sense).
This commit is contained in:
Andreas Lauser 2013-01-11 18:16:29 +01:00
parent dcc162d3a7
commit 0a5b63f70e

View File

@ -14,6 +14,24 @@ function usage() {
echo "where TEST_TYPE can either be --plain or --simulation" echo "where TEST_TYPE can either be --plain or --simulation"
}; };
function validateResults() {
OUTPUT_FILE="$1"
SIM_NAME="$1"
for REFERENCE_RESULT in referencesolutions/$SIM_NAME*; do
if python bin/fuzzycomparevtu.py "$REFERENCE_RESULT" "$TEST_RESULT"; then
# SUCCESS!!!!!!
echo "Result file '$TEST_RESULT' and reference result '$REFERENCE_RESULT' are identical"
return 0
fi
done
echo "The files \"$TEST_RESULT\" and \"$REFERENCE_RESULT\" are different."
echo "Make sure the contents of \"$TEST_RESULT\" are still valid and "
echo "make it the reference result if necessary."
exit 1
}
TEST_TYPE="$1" TEST_TYPE="$1"
TEST_NAME="$2" TEST_NAME="$2"
TEST_ARGS="${@:3:100}" TEST_ARGS="${@:3:100}"
@ -68,22 +86,7 @@ case "$TEST_TYPE" in
exit 1 exit 1
fi fi
REFERENCE_RESULT="referencesolutions/$TEST_RESULT" validateResults $TEST_RESULT $SIM_NAME
if ! test -r "$REFERENCE_RESULT"; then
echo "File $REFERENCE_RESULT does not exist or is not readable"
exit 1
fi
if ! python bin/fuzzycomparevtu.py "$REFERENCE_RESULT" "$TEST_RESULT"; then
echo "The files \"$TEST_RESULT\" and \"$REFERENCE_RESULT\" are different."
echo "Make sure the contents of \"$TEST_RESULT\" are still valid and "
echo "make it the reference result if necessary."
exit 1
fi
# SUCCESS!!!!!!
echo "Result and reference result are identical"
exit 0 exit 0
;; ;;