4 # Wrapper script for running xapian-progsrv and xapian-tcpsrv from test
5 # programs (using libtool and valgrind if required).
7 # We use this wrapper script so that we can run the remote servers under
8 # valgrind if required. This is needed on x86 when the testsuite is using
9 # valgrind to avoid issues due to valgrind not supporting x87 excess precision.
11 # We don't actually need valgrind's checking here, so we use "--tool=none"
12 # which is much quicker than using valgrind's default memcheck tool.
14 # Copyright (C) 2003,2004,2007,2009,2012,2019 Olly Betts
16 # This program is free software; you can redistribute it and/or
17 # modify it under the terms of the GNU General Public License as
18 # published by the Free Software Foundation; either version 2 of the
19 # License, or (at your option) any later version.
21 # This program is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 # GNU General Public License for more details.
26 # You should have received a copy of the GNU General Public License
27 # along with this program; if not, write to the Free Software
28 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
31 if test 0 = "$#"; then
32 echo "syntax: $0 <remote backend server program> <arguments>"
36 # We used to only do this on x86 when also building the library without SSE
37 # instructions (which works around valgrind implementing 80 bit FP using
38 # 64 bit FP instructions), but the addition of multi_glass_remoteprog_glass
39 # resulted in 3 failing testcases under valgrind on x86 even when built with
40 # -msse2 - presumably there's some libc function using x87 FP.
44 # Just run the server directly for other architectures.
48 # Set srcdir if it isn't already.
49 : ${srcdir="@srcdir@"}
52 # We're only run from BackendManager if it's running under valgrind, so if
53 # we can't find valgrind, something is wrong.
54 test -z "${VALGRIND+set}" && VALGRIND
="@VALGRIND@"
55 if test -z "$VALGRIND" ; then
56 echo "VALGRIND not set"
60 # Get libtool to run the test program under valgrind. We have to use
61 # libtool --mode=execute because we want to run valgrind on the compiled
62 # C++ test program, not on the shell running the shell script wrapper libtool
64 LIBTOOL
=`echo '@LIBTOOL@'|sed 's,\$(SHELL),@SHELL@,g;s,\$(top_builddir),@top_builddir@,g'`
66 vg_opts
='-q --tool=none'
67 exec $LIBTOOL --mode=execute
$VALGRIND $vg_opts "$@"