This repository has been archived on 2024-08-13. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
libcyberiadamlpp/run-tests.sh
Alexey Fedoseev 6611fda149 TODO for future
2024-04-23 21:22:57 +03:00

52 lines
888 B
Bash
Executable File

#!/bin/bash
DEBUG=1 make
DEBUG=1 make tests
if [ $? != 0 ]
then
echo "make test failed!"
exit 1
fi
echo
echo "tests ready!"
echo
for t in $(ls tests/*.test); do
num=$(echo $t | grep -Poe '\d+')
echo -n "$num $t... "
if [ -f "$t-input.graphml" -o -f "tests/$num-output.txt" ]
then
$t > "$t.txt"
else
$t
fi
if [ $? != 0 ]
then
echo "test $num run failed!"
continue
fi
if [ -f "tests/$num-output.graphml" ]
then
# TODO: think about xmldiff here
diff "$t.graphml" "tests/$num-output.graphml"
if [ $? != 0 ]
then
echo "test $num failed: graphml file didn't match the pattern!"
continue
fi
fi
if [ -f "tests/$num-output.txt" ]
then
diff "$t.txt" "tests/$num-output.txt"
if [ $? != 0 ]
then
echo "test $num failed: output didn't match the pattern!"
continue
fi
fi
echo "ok"
done
exit 0