fix test; make test scripts PWD-independent

This commit is contained in:
Simon Cruanes 2014-11-04 17:48:22 +01:00
parent f5563a554f
commit e95dec0663
4 changed files with 11 additions and 9 deletions

View file

@ -26,7 +26,6 @@ test-full: $(TEST)
$(TEST): $(LIB) $(TEST): $(LIB)
$(COMP) $(FLAGS) $(DIRS) $(TEST) $(COMP) $(FLAGS) $(DIRS) $(TEST)
cp $(TEST) tests/main && rm $(TEST)
log: log:
cat _build/$(LOG) || true cat _build/$(LOG) || true

View file

@ -1,12 +1,13 @@
#!/bin/bash #!/bin/bash
CURDIR=`dirname $0` CURDIR=`dirname $0`
SOLVER="$CURDIR/../test.native"
solvertest () { solvertest () {
for f in `find -L $1 -name *.cnf -type f` for f in `find -L $1 -name *.cnf -type f`
do do
echo -ne "\r\033[KTesting $f..." echo -ne "\r\033[KTesting $f..."
"$CURDIR/../tests/main" -t 5s -s 1G $f | grep $2 > /dev/null 2> /dev/null "$SOLVER" -t 5s -s 1G $f | grep $2 > /dev/null 2> /dev/null
RET=$? RET=$?
if [ $RET -ne 0 ]; if [ $RET -ne 0 ];
then then
@ -18,8 +19,8 @@ solvertest () {
} }
all () { all () {
solvertest "$CURDIR/flatgraph/" "Sat" solvertest "$CURDIR/flatgraph/" "Sat"
solvertest "$CURDIR/morphgraph/" "Sat" solvertest "$CURDIR/morphgraph/" "Sat"
} }
time all time all

View file

@ -425,5 +425,4 @@ p cnf 90 415
63 62 61 60 59 58 57 56 55 0 63 62 61 60 59 58 57 56 55 0
72 71 70 69 68 67 66 65 64 0 72 71 70 69 68 67 66 65 64 0
81 80 79 78 77 76 75 74 73 0 81 80 79 78 77 76 75 74 73 0
90 89 88 87 86 85 84 83 82 90 89 88 87 86 85 84 83 82 0
0

View file

@ -1,10 +1,13 @@
#!/bin/bash #!/bin/bash
CURDIR=`dirname $0`
SOLVER="$CURDIR/../test.native"
solvertest () { solvertest () {
for f in `find -L $1 -name *.cnf -type f` for f in `find -L $1 -name *.cnf -type f`
do do
echo -ne "\r\033[KTesting $f..." echo -ne "\r\033[KTesting $f..."
tests/main -t 30s -s 1G $f | grep $2 > /dev/null 2> /dev/null "$SOLVER" -t 30s -s 1G $f | grep $2 > /dev/null 2> /dev/null
RET=$? RET=$?
if [ $RET -ne 0 ]; if [ $RET -ne 0 ];
then then
@ -15,5 +18,5 @@ solvertest () {
echo -e "\r\033[K\e[32m[OK]\e[0m $2" echo -e "\r\033[K\e[32m[OK]\e[0m $2"
} }
solvertest "tests/sat/" "Sat" solvertest "$CURDIR/sat/" "Sat"
solvertest "tests/unsat/" "Unsat" solvertest "$CURDIR/unsat/" "Unsat"