Chris@372: #!/bin/bash Chris@372: Chris@372: if [ -z "$1" ]; then Chris@372: echo "Usage: $0 " Chris@372: exit 2 Chris@372: fi Chris@372: Chris@372: platformtag="$1" Chris@372: Chris@372: set -eu Chris@372: Chris@372: ippdir=/opt/intel/ipp Chris@372: Chris@372: echo Chris@372: if [ -d "$ippdir" ]; then Chris@372: echo "Found IPP directory $ippdir, considering IPP as well as other options" Chris@372: else Chris@372: echo "No IPP directory $ippdir, not testing with IPP" Chris@372: fi Chris@372: Chris@372: if valgrind --version >/dev/null 2>&1 ; Chris@372: then Chris@372: have_valgrind=yes Chris@372: else Chris@372: echo Chris@372: echo "No valgrind executable found, not using valgrind" Chris@372: have_valgrind=no Chris@372: fi Chris@372: Chris@372: tmpfile=$(mktemp "/tmp/test_XXXXXX") Chris@372: trap "rm -f $tmpfile" 0 Chris@372: Chris@372: run() { Chris@372: successtext="$1" Chris@372: shift Chris@372: echo -n "Running \"$@\"..." Chris@372: if "$@" > "$tmpfile" 2>&1 ; then Chris@372: if [ -z "$successtext" ] || fgrep -q "$successtext" "$tmpfile" ; then Chris@372: echo " OK" Chris@372: return 0 Chris@372: else Chris@372: echo " Failed" Chris@372: cat "$tmpfile" Chris@372: return 1 Chris@372: fi Chris@372: else Chris@372: echo " Failed" Chris@372: cat "$tmpfile" Chris@372: return 1 Chris@372: fi Chris@372: } Chris@372: Chris@372: for mf in Makefile build/Makefile.$platformtag build/Makefile.$platformtag.* ; do Chris@372: Chris@372: case "$mf" in Chris@372: *~) continue;; Chris@372: *.bak) continue;; Chris@372: *ipp) Chris@372: if [ ! -d "$ippdir" ]; then Chris@372: continue Chris@372: fi;; Chris@372: esac Chris@372: Chris@372: if [ ! -f "$mf" ]; then Chris@372: continue Chris@372: fi Chris@372: Chris@372: echo Chris@372: echo "Building and testing with $mf:" Chris@372: echo Chris@372: Chris@372: make -f "$mf" clean >/dev/null Chris@372: run "No errors detected" make -f "$mf" test Chris@372: Chris@372: if [ "$have_valgrind" = "yes" ]; then Chris@372: for t in test-* ; do Chris@372: if [ -x "$t" ]; then Chris@372: run "no leaks are possible" valgrind --leak-check=full ./"$t" Chris@372: fi Chris@372: done Chris@372: fi Chris@372: done Chris@372: Chris@372: