runtest.sh: make it work in parallel

This commit is contained in:
Andreas Lauser 2012-10-22 22:44:42 +02:00
parent 0d5099da19
commit c601a65931

View File

@ -42,27 +42,33 @@ echo "######################"
echo "# Running test '$TEST_NAME'"
echo "######################"
if ! "$TEST_BINARY" $TEST_ARGS; then
RND="$RANDOM"
"$TEST_BINARY" $TEST_ARGS | tee "test-$RND.log"
RET="${PIPESTATUS[0]}"
if test "$RET" != "0"; then
echo "Executing the binary failed!"
rm "test-$RND.log"
exit 1
fi
case "$TEST_TYPE" in
"--simulation")
# compare the results
echo "######################"
echo "# Comparing results"
echo "######################"
TEST_RESULT=$(ls --sort=time *.vtu *.vtp | head -n 1 2> /dev/null)
SIM_NAME=$(grep "Writing result file for" test-$RND.log | sed "s/.*\"\(.*\)\".*/\1/" | head -n1)
TEST_RESULT=$(ls $SIM_NAME*.vtu $SIM_NAME*.vtp 2> /dev/null | sort | tail -n 1)
if ! test -r "$TEST_RESULT"; then
echo "File $TEST_RESULT does not exist or is not readable"
rm "test-$RND.log"
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"
rm "test-$RND.log"
exit 1
fi
@ -71,15 +77,18 @@ case "$TEST_TYPE" in
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."
rm "test-$RND.log"
exit 1
fi
# SUCCESS!!!!!!
echo "Result and reference result are identical"
rm "test-$RND.log"
exit 0
;;
*)
rm "test-$RND.log"
exit 0
;;
esac