blob: 7fbdd3352d065c6359d1145b408131c77293fa9f [file] [log] [blame]
sewardj3b290482011-05-06 21:02:55 +00001#! /bin/sh
2
3# (must be called from the valgrind top source dir).
4#
5# Make local links in the gdbserver_tests directory
6# so that tests needing gdb can be disabled if
7# a tool old version of gdb is provided or if no gdb is
8# provided.
9#
10# The vgdb link is needed either for gdb tests
11# or for standalone vgdb tests.
12
bart09e22c62011-05-15 06:18:24 +000013if [ -x "$1" ]
sewardj3b290482011-05-06 21:02:55 +000014then
bart09e22c62011-05-15 06:18:24 +000015 ln -f -s "$1" gdbserver_tests/gdb
sewardj3b290482011-05-06 21:02:55 +000016 # Try to extract the gdb version.
barta4f9ae22011-05-15 17:07:47 +000017 VERSIONLINE=`gdbserver_tests/gdb --version | head -n 1`
sewardj3b290482011-05-06 21:02:55 +000018 VERSION=`echo $VERSIONLINE |
19 sed -e 's/[^0-9\.]//g' -e 's/\./ /g'`
20
21 # We need at least a 6.5 version to run any gdb test
22 VERSIONOK=`echo $VERSION |
23 awk '{ if ( ($1 >= 7) || (($1 == 6) && ($2 >= 5)) ) print "version ok"}'`
24 if [ "$VERSIONOK" = "" ]
25 then
sewardj6b7357b2011-05-27 13:23:44 +000026 echo "gdbserver tests suppressed as $1 version is < 6.5: " $VERSIONLINE
27 rm -f gdbserver_tests/gdb
28 fi
29
30 # We need at least a 7.1 version on ARM to run tests doing step/next/...
31 # (gdb 7.0 has bugs in the 'guess next pc' heuristic in thumb mode).
32 if tests/arch_test arm
33 then
34 VERSIONOK=`echo $VERSION |
35 awk '{ if ( ($1 >= 8) || (($1 == 7) && ($2 >= 1)) ) print "version ok"}'`
36 if [ "$VERSIONOK" = "" ]
37 then
38 echo "gdbserver 'step/next' tests suppressed as arm $1 version is < 7.1: " $VERSIONLINE
39 rm -f gdbserver_tests/gdb.step
40 else
41 touch gdbserver_tests/gdb.step
42 fi
43 else
44 touch gdbserver_tests/gdb.step
sewardj3b290482011-05-06 21:02:55 +000045 fi
46
47 # We need at least a 7.2 version for gdb tests using eval command
48 VERSIONOK=`echo $VERSION |
49 awk '{ if ( ($1 >= 8) || (($1 == 7) && ($2 >= 2)) ) print "version ok"}'`
50 if [ "$VERSIONOK" = "" ]
51 then
sewardj6b7357b2011-05-27 13:23:44 +000052 echo "gdbserver eval tests suppressed as $1 version is < 7.2: " $VERSIONLINE
sewardj3b290482011-05-06 21:02:55 +000053 rm -f gdbserver_tests/gdb.eval
54 else
55 touch gdbserver_tests/gdb.eval
56 fi
57else
58 echo "gdbserver gdb tests suppressed as $1 is not executable"
59fi
60
61ln -f -s ../coregrind/vgdb gdbserver_tests/vgdb
62
63# if ptrace not implemented in vgdb or OS restricts the initial attach,
64# some tests would block for a loooonnnng time.
65if gdbserver_tests/vgdb --help 2>&1 |
66 grep -e 'ptrace invoker not implemented' \
67 -e 'kernel restricts ptrace invoker' > /dev/null
68then
69 rm -f gdbserver_tests/vgdb.ptraceinvoker
70else
71 touch gdbserver_tests/vgdb.ptraceinvoker
72fi
73
74# cleanup the possibly big garbage previously collected output
75rm -f gdbserver_tests/garbage.filtered.out