Skip to content
Snippets Groups Projects
Commit c04f6cda authored by Andreas Lauser's avatar Andreas Lauser
Browse files

unit tests: make sure the results are correct

where correct means "identical to the reference solution". so far,
only a reference solution for the test of the 2p box model is provided

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@7076 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 6c5efca1
No related branches found
No related tags found
No related merge requests found
......@@ -186,7 +186,7 @@ ENABLE_TESTING()
INCLUDE(CTest)
ADD_TEST(test_1p test/boxmodels/1p/test_1p test/boxmodels/1p/grids/test_1p_2d.dgf 1 1)
add_test(test_1p2c test/boxmodels/1p2c/test_1p2c test/boxmodels/1p2c/grids/test_1p2c.dgf 1 1)
add_test(test_2p test/boxmodels/2p/test_2p 1 1)
add_test(test_2p util/runTest.sh test/boxmodels/2p/lens-reference.vtu test/boxmodels/2p/lens-00022.vtu test/boxmodels/2p/test_2p 30e3 250)
add_test(test_2pni test/boxmodels/2pni/test_2pni test/boxmodels/2pni/grids/test_2pni.dgf 1 1)
add_test(test_2p2c test/boxmodels/2p2c/test_2p2c test/boxmodels/2p2c/grids/test_2p2c.dgf 1 1)
add_test(test_2p2cni test/boxmodels/2p2cni/test_2p2cni test/boxmodels/2p2cni/grids/test_2p2cni.dgf 1 1)
......
This diff is collapsed.
#! /bin/bash
#
# Runs a test from the test directory and compare the resulting VTU files.
#
# Usage:
#
# runTest.sh REFERENCE_RESULT_FILE TEST_RESULT_FILE TEST_BINARY TEST_ARGS
#
function usage() {
echo "Usage:"
echo
echo "runTest.sh REFERENCE_RESULT_FILE TEST_RESULT_FILE TEST_BINARY [TEST_ARGS]"
};
REFERENCE_RESULT="$1"
TEST_RESULT="$2"
TEST_BINARY="$3"
TEST_ARGS="${@:4:100}"
# make sure we have at least 3 parameters
if test "$#" -lt 3; then
echo "Wrong number of parameters"
echo
usage
exit 1
fi
# make sure the reference result exists
if ! test -r "$REFERENCE_RESULT"; then
echo "File $REFERENCE_RESULT does not exist or is not readable"
echo
usage
exit 1
fi
# make sure the binary is of the test is present
if ! test -x "$TEST_BINARY"; then
echo "$TEST_BINARY does not exist or is not executable"
echo
usage
exit 1
fi
#run the test
echo "######################"
echo "# Running test"
echo "######################"
if ! "$TEST_BINARY" $TEST_ARGS; then
echo "Executing the binary failed!"
exit 1
fi
# compare the results
echo "######################"
echo "# Comparing results"
echo "######################"
if ! test -r "$TEST_RESULT"; then
echo "File $TEST_RESULT does not exist or is not readable"
exit 1
fi
if ! diff --suppress-common-lines -y "$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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment