From 0a5b63f70eb8c7f079825d8345a49bcda2237eb0 Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Fri, 11 Jan 2013 18:16:29 +0100 Subject: [PATCH] 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). --- tests/run-vtu-test.sh | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/tests/run-vtu-test.sh b/tests/run-vtu-test.sh index 03b94c21c..59f317d81 100755 --- a/tests/run-vtu-test.sh +++ b/tests/run-vtu-test.sh @@ -14,6 +14,24 @@ function usage() { 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_NAME="$2" TEST_ARGS="${@:3:100}" @@ -68,22 +86,7 @@ case "$TEST_TYPE" in exit 1 fi - REFERENCE_RESULT="referencesolutions/$TEST_RESULT" - 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" + validateResults $TEST_RESULT $SIM_NAME exit 0 ;;