Solaris: fix a few compiler warnings
[valgrind.git] / gdbserver_tests / make_local_links
blob001609a99cd65235d5f346272cbd30e25ee6e3fb
1 #! /bin/sh
3 # (must be called from the valgrind top source dir).
5 # Make local links in the gdbserver_tests directory
6 # so that tests needing gdb can be disabled if
7 # a too old version of gdb is provided or if no gdb is
8 # provided.
10 # The vgdb link is needed either for gdb tests
11 # or for standalone vgdb tests.
13 # Make sure we're in the correct directory, i.e. the root of the valgrind
14 # source tree. We use the existence of the coregrind directory as evidence
15 # that we're in the right place.
16 if [ ! -d "coregrind" ]; then
17 echo "make_local_links is not invoked from the top-of-tree directory" 1>&2
18 exit 1
21 # Make sure there is an argument
22 if [ "x$1" = "x" ]; then
23 echo "usage: make_local_links /path/to/gdb" 1>&2
24 exit 1
28 export GDB=""
29 export GDBVERSIONLINE=""
30 export GDBMAJ=""
31 export GDBMIN=""
33 # $1 = Major.Minor gdb version needed
34 # $2 = marker file to touch (if version ok) or to remove (version not ok)
35 # $3 and following: msg in output
36 check_version()
38 NEEDED=$1
39 shift
40 NEEDEDMAJ=$(echo $NEEDED | awk -F\. '{ print $1 }')
41 NEEDEDMIN=$(echo $NEEDED | awk -F\. '{ print $2 }')
43 MARKERFILE=$1
44 shift
46 if [ \( $GDBMAJ -gt $NEEDEDMAJ \) \
47 -o \( \( $GDBMAJ -eq $NEEDEDMAJ \) \
48 -a \( $GDBMIN -ge $NEEDEDMIN \) \) ]
49 then
50 if [ ! -f $MARKERFILE ]
51 then
52 touch $MARKERFILE
54 else
55 echo "$@" "suppressed as $GDB version" $GDBVERSIONLINE "is <" $NEEDED
56 rm -f $MARKERFILE
60 if [ -x "$1" ]
61 then
62 GDB=$1
63 ln -f -s "$GDB" gdbserver_tests/gdb
64 # Try to extract the gdb version major and minor numbers.
65 # We assume these are the first two integers separated by a .
66 GDBVERSIONLINE=`gdbserver_tests/gdb --version | head -n 1`
67 GDBMAJ=`echo $GDBVERSIONLINE | sed -e 's/[^0-9\.]//g' |
68 awk -F\. '{print $1}'`
69 GDBMIN=`echo $GDBVERSIONLINE | sed -e 's/[^0-9\.]//g' |
70 awk -F\. '{print $2}'`
72 # We need at least a 6.5 version to use the Valgrind gdbserver.
73 # However, the gdb tests are only supported/maintained for gdb >= 7
74 check_version 7.0 gdbserver_tests/gdb "gdbserver gdb tests"
76 # We need at least a 7.1 version to run the 'pic' executable tests
77 # (with 7.0, it fails on many platforms)
78 check_version 7.1 gdbserver_tests/gdb.pic "pic executable tests"
80 # by default, we can run tests needed next/step/...
81 # But on ARM, we need at least 7.1 to run the 'next/step/...' tests.
82 # (gdb 7.0 has bugs in the 'guess next pc' heuristic in thumb mode).
83 if tests/arch_test arm
84 then
85 check_version 7.1 gdbserver_tests/gdb.step "gdbserver next/step/... tests ARM"
86 else
87 check_version 7.0 gdbserver_tests/gdb.step "gdbserver next/step/... tests"
90 # We need at least a 7.2 version for gdb tests using eval command
91 check_version 7.2 gdbserver_tests/gdb.eval "gdbserver eval tests"
93 else
94 echo "gdbserver gdb tests suppressed as $1 is not executable"
97 ln -f -s ../coregrind/vgdb gdbserver_tests/vgdb
98 ln -f -s ../../coregrind/vgdb gdbserver_tests/solaris/vgdb
100 # if ptrace not implemented in vgdb or OS restricts the initial attach,
101 # some tests would block for a loooonnnng time.
102 if gdbserver_tests/vgdb --help 2>&1 |
103 grep -e 'invoker not implemented' > /dev/null
104 then
105 rm -f gdbserver_tests/vgdb.invoker
106 else
107 touch gdbserver_tests/vgdb.invoker
110 # cleanup the possibly big garbage previously collected output
111 rm -f gdbserver_tests/garbage.filtered.out
112 rm -f gdbserver_tests/solaris/garbage.filtered.out