Removed submodules
This commit is contained in:
Executable
+97
@@ -0,0 +1,97 @@
|
||||
#!/bin/bash
|
||||
|
||||
EXE="../digduke"
|
||||
|
||||
function run_test {
|
||||
|
||||
# parameters
|
||||
TAG=$1
|
||||
shift
|
||||
ARGS=$1
|
||||
shift
|
||||
|
||||
PTAG=$(printf '%-30s' "$TAG")
|
||||
if [[ $(echo $TAG | cut -d'_' -f1) == $SKIP_C ||
|
||||
$(echo $TAG | cut -d'_' -f1) == $SKIP_B ||
|
||||
$(echo $TAG | cut -d'_' -f1) == $SKIP_A ]] ; then
|
||||
echo "$PTAG SKIPPED (previous phases not complete)"
|
||||
return
|
||||
fi
|
||||
|
||||
# file paths
|
||||
OUTPUT=outputs/$TAG.txt
|
||||
DIFF=outputs/$TAG.diff
|
||||
EXPECT=expected/$TAG.txt
|
||||
VALGRND=valgrind/$TAG.txt
|
||||
|
||||
# run test and compare output to the expected version
|
||||
./dukens -s 2 >/dev/null 2>&1 &
|
||||
sleep 1
|
||||
$EXE $ARGS 2>/dev/null >"$OUTPUT"
|
||||
for ARG in "$@" ; do
|
||||
$EXE $ARG 2>/dev/null >>"$OUTPUT"
|
||||
done
|
||||
|
||||
diff -u "$OUTPUT" "$EXPECT" >"$DIFF"
|
||||
passed=false
|
||||
EFILES=$(find expected -type f -name "$TAG-*.txt")
|
||||
if [ ! -s "$DIFF" ]; then
|
||||
passed=true
|
||||
elif [ "$EFILES" != "" ]; then
|
||||
for EF in $EFILES ; do
|
||||
DF=$(echo $EF | sed 's/^expected/outputs/' | sed 's/txt$/diff/')
|
||||
diff -u "$OUTPUT" "$EF" >"$DF"
|
||||
if [ ! -s "$DF" ]; then
|
||||
passed=true
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if [[ $passed = true ]] ; then
|
||||
echo "$PTAG pass"
|
||||
rm outputs/$TAG*diff
|
||||
else
|
||||
echo "$PTAG FAIL - Command line: $EXE $ARGS"
|
||||
if [ "$EFILES" != "" ] ; then
|
||||
echo "$(printf '%30s' ' ') *WARNING* This test has more than one possible output file."
|
||||
echo "$(printf '%30s' ' ') *WARNING* Please inspect each manually for comparison."
|
||||
else
|
||||
echo "$(printf '%30s' ' ') See $DIFF for diff with expected output"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
if [[ $(echo $PTAG | cut -d'_' -f1) == 'D' ]] ; then
|
||||
SKIP_C="C"
|
||||
SKIP_B="B"
|
||||
SKIP_A="A"
|
||||
elif [[ $(echo $PTAG | cut -d'_' -f1) == 'C' ]] ; then
|
||||
SKIP_B="B"
|
||||
SKIP_A="A"
|
||||
elif [[ $(echo $PTAG | cut -d'_' -f1) == 'B' ]] ; then
|
||||
SKIP_A="A"
|
||||
fi
|
||||
fi
|
||||
|
||||
# run valgrind
|
||||
#./dukens -s 2 >/dev/null 2>&1 &
|
||||
# sleep 1
|
||||
# valgrind $EXE $ARGS >"$VALGRND" 2>&1
|
||||
}
|
||||
|
||||
# initialize output folders
|
||||
mkdir -p outputs
|
||||
mkdir -p valgrind
|
||||
rm -f outputs/* valgrind/*
|
||||
|
||||
# run individual tests
|
||||
source itests.include
|
||||
|
||||
# check for memory leaks
|
||||
#LEAK=`cat valgrind/*.txt | grep 'definitely lost' | grep -v ' 0 bytes in 0 blocks'`
|
||||
LEAK=
|
||||
if [ -z "$LEAK" ]; then
|
||||
echo "No memory leak found."
|
||||
else
|
||||
echo "Memory leak(s) found. See files listed below for details."
|
||||
grep 'definitely lost' valgrind/*.txt | sed -e 's/:.*$//g' | sed -e 's/^/ - /g'
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user