summaryrefslogtreecommitdiff
path: root/tests/valgrind-version.sh
blob: fbfd326b4c427195548f9e1c96f1ada3c7e42889 (plain)
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
#!/bin/sh

valgrind=`which valgrind`
awk=`which awk`
if test "x$valgrind" = "x" ; then
    echo "valgrind-not-present" ;
    exit ;
fi


valgrind_version=`$valgrind --version`
if test "x$valgrind_version" = x ; then
    echo "not-present" ;
    exit
fi

if test "x$awk" = x ; then
    echo "awk-not-present"
    exit
fi

string_version=`echo $valgrind_version | $awk -F '-' '{print $2}'`

if test "x$string_version" = "x" ; then
    echo "valgrind-version-unknown"
    exit
fi

major=`echo $string_version | $awk -F '.' '{print $1}'`
minor=`echo $string_version | $awk -F '.' '{print $2}'`
micro=`echo $string_version | $awk -F '.' '{print $3}'`

version=`expr $major \* 10000 + $minor \* 100 + $micro`

if test "x$version" = "x" ; then
    echo "valgrind-version-unknown"
    exit ;
fi

if test "$version" -ge "20101" ; then
    echo "okay"
    exit ;
else
    echo "valgrind-version-lower"
    exit ;
fi