File: run-platform-tests.sh

package info (click to toggle)
sonic-visualiser 5.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 24,744 kB
  • sloc: cpp: 158,888; ansic: 11,920; sh: 1,785; makefile: 517; xml: 64; perl: 31
file content (84 lines) | stat: -rwxr-xr-x 1,485 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash

if [ -z "$1" ]; then
    echo "Usage: $0 <platformtag>"
    exit 2
fi

platformtag="$1"

set -eu

ippdir=/opt/intel/ipp

echo
if [ -d "$ippdir" ]; then
    echo "Found IPP directory $ippdir, considering IPP as well as other options"
else
    echo "No IPP directory $ippdir, not testing with IPP"
fi

if valgrind --version >/dev/null 2>&1 ;
then
    have_valgrind=yes
else
    echo
    echo "No valgrind executable found, not using valgrind"
    have_valgrind=no
fi

tmpfile=$(mktemp "/tmp/test_XXXXXX")
trap "rm -f $tmpfile" 0

run() {
    successtext="$1"
    shift
    echo -n "Running \"$@\"..."
    if "$@" > "$tmpfile" 2>&1 ; then
	if [ -z "$successtext" ] || fgrep -q "$successtext" "$tmpfile" ; then
	    echo " OK"
	    return 0
	else
	    echo " Failed"
	    cat "$tmpfile"
	    return 1
	fi
    else
	echo " Failed"
	cat "$tmpfile"
	return 1
    fi
}

for mf in Makefile build/Makefile.$platformtag build/Makefile.$platformtag.* ; do

    case "$mf" in
	*~) continue;;
	*.bak) continue;;
	*ipp)
	    if [ ! -d "$ippdir" ]; then
		continue
	    fi;;
    esac

    if [ ! -f "$mf" ]; then
	continue
    fi
    
    echo
    echo "Building and testing with $mf:"
    echo
    
    make -f "$mf" clean >/dev/null
    run "No errors detected" make -f "$mf" test

    if [ "$have_valgrind" = "yes" ]; then
	for t in test-* ; do
	    if [ -x "$t" ]; then
		run "no leaks are possible" valgrind --leak-check=full --show-leak-kinds=all ./"$t"
	    fi
	done
    fi
done