1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-04 23:29:42 +02:00

add regression test infrastructure

This commit is contained in:
Werner Almesberger 2012-05-30 12:02:14 -03:00
parent 60de30cea0
commit 88ad25e42c
2 changed files with 76 additions and 0 deletions

View File

@ -93,3 +93,15 @@ spotless: clean
try:
$(VALGRIND) ./boom HIERARCHY -c CHAR -x CURR -p PROVIDER -i INV \
-s SUBST
# ----- Tests -----------------------------------------------------------------
test tests: all
LANG= sh -c \
'passed=0 && cd test && \
for n in [a-z]*; do \
[ $$n != core ] && SCRIPT=$$n . ./$$n; done; \
echo "Passed all $$passed tests"'
valgrind:
VALGRIND="valgrind -q" $(MAKE) tests

64
b2/test/Common Executable file
View File

@ -0,0 +1,64 @@
#!/bin/bash -x
#
# Common - Elements shared by all regression tests for BOOM
#
# Written 2012 by Werner Almesberger
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
run_boom()
{
args="-N file-h <(sed -n '/^!-/q;p' _in)"
for n in c i x p s b X; do
if grep ^!-$n _in >/dev/null; then
args="$args -N file-$n"
args="$args -$n <(sed -n '1,/^!-$n/d;/^!-/q;p' _in)"
fi
done
eval $VALGRIND ../boom "$args" "$@"
}
tst()
{
echo -n "$1: " 1>&2
shift
cat >_in
run_boom "$@" >_out 2>&1 || {
echo FAILED "($SCRIPT)" 1>&2
cat _out
exit 1
}
}
tst_fail()
{
echo -n "$1: " 1>&2
shift
cat >_in
run_boom "$@" >_out 2>&1 && {
echo FAILED "($SCRIPT)" 1>&2
cat _out
exit 1
}
rm -f _in
}
expect()
{
diff -u - "$@" _out >_diff || {
echo FAILED "($SCRIPT)" 1>&2
cat _diff 1>&2
exit 1
}
echo PASSED 1>&2
rm -f _in _out _diff
passed=`expr ${passed:-0} + 1`
}