aboutsummaryrefslogtreecommitdiff
path: root/tests/runtests.sh
diff options
context:
space:
mode:
authorGertjan van den Burg <gertjanvandenburg@gmail.com>2016-05-17 23:02:04 +0200
committerGertjan van den Burg <gertjanvandenburg@gmail.com>2016-05-17 23:02:04 +0200
commit7d9f7e9341ab22599ea541959dbf9323661c777f (patch)
tree93b9262f64b606089b6b85aceafc47fa631887e8 /tests/runtests.sh
parentmake blas and lapack calls more compact (diff)
downloadgensvm-7d9f7e9341ab22599ea541959dbf9323661c777f.tar.gz
gensvm-7d9f7e9341ab22599ea541959dbf9323661c777f.zip
start adding unit tests
Diffstat (limited to 'tests/runtests.sh')
-rwxr-xr-xtests/runtests.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/runtests.sh b/tests/runtests.sh
new file mode 100755
index 0000000..0de79d8
--- /dev/null
+++ b/tests/runtests.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+echo -e "\033[95mRunning unit tests:\033[0m"
+
+for i in bin/test_*
+do
+ if test -f $i
+ then
+ if $VALGRIND ./$i 2>> ./tests.log
+ then
+ echo $i PASS
+ else
+ echo "ERROR in test $i: here's ./tests.log"
+ echo "------"
+ tail ./tests.log
+ exit 1
+ fi
+ if [ ! -z "$VALGRIND" ]
+ then
+ for log in `ls /tmp/valgrind-*.log`;
+ do
+ cmdstr=$(head -n 4 $log | tail -n 1)
+ if [[ $cmdstr == *"$i"* ]]
+ then
+ tailstr=$(tail -n 1 $log)
+ if [[ $tailstr == *"0 errors from 0 contexts"* ]]
+ then
+ echo -e "\033[92mVALGRIND GOOD\033[0m"
+ else
+ echo -e "\033[91mVALGRIND BAD\033[0m"
+ fi
+ fi
+ done
+ fi
+ fi
+done
+
+echo ""