sewardj | 3b29048 | 2011-05-06 21:02:55 +0000 | [diff] [blame] | 1 | #! /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 | |
bart | 09e22c6 | 2011-05-15 06:18:24 +0000 | [diff] [blame] | 13 | if [ -x "$1" ] |
sewardj | 3b29048 | 2011-05-06 21:02:55 +0000 | [diff] [blame] | 14 | then |
bart | 09e22c6 | 2011-05-15 06:18:24 +0000 | [diff] [blame] | 15 | ln -f -s "$1" gdbserver_tests/gdb |
sewardj | 3b29048 | 2011-05-06 21:02:55 +0000 | [diff] [blame] | 16 | # Try to extract the gdb version. |
bart | a4f9ae2 | 2011-05-15 17:07:47 +0000 | [diff] [blame] | 17 | VERSIONLINE=`gdbserver_tests/gdb --version | head -n 1` |
sewardj | 3b29048 | 2011-05-06 21:02:55 +0000 | [diff] [blame] | 18 | 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 |
sewardj | 6b7357b | 2011-05-27 13:23:44 +0000 | [diff] [blame^] | 26 | 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 |
sewardj | 3b29048 | 2011-05-06 21:02:55 +0000 | [diff] [blame] | 45 | 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 |
sewardj | 6b7357b | 2011-05-27 13:23:44 +0000 | [diff] [blame^] | 52 | echo "gdbserver eval tests suppressed as $1 version is < 7.2: " $VERSIONLINE |
sewardj | 3b29048 | 2011-05-06 21:02:55 +0000 | [diff] [blame] | 53 | rm -f gdbserver_tests/gdb.eval |
| 54 | else |
| 55 | touch gdbserver_tests/gdb.eval |
| 56 | fi |
| 57 | else |
| 58 | echo "gdbserver gdb tests suppressed as $1 is not executable" |
| 59 | fi |
| 60 | |
| 61 | ln -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. |
| 65 | if gdbserver_tests/vgdb --help 2>&1 | |
| 66 | grep -e 'ptrace invoker not implemented' \ |
| 67 | -e 'kernel restricts ptrace invoker' > /dev/null |
| 68 | then |
| 69 | rm -f gdbserver_tests/vgdb.ptraceinvoker |
| 70 | else |
| 71 | touch gdbserver_tests/vgdb.ptraceinvoker |
| 72 | fi |
| 73 | |
| 74 | # cleanup the possibly big garbage previously collected output |
| 75 | rm -f gdbserver_tests/garbage.filtered.out |