[python3] Simplify generated wrapper post-processing
[xapian.git] / xapian-core / tests / runsrv.in
blob2a8201f461796d34d8b0d37f37fc6d3500bd1cac
1 #!/bin/sh
2 # @configure_input@
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 and we were told to build the library without SSE instructions.
10 # The issue is that valgrind's emulation of excess FP precision isn't exact,
11 # which causes test failures.
13 # We don't actually need valgrind's checking here, so we use "--tool=none"
14 # which is much quicker than using valgrind's default memcheck tool.
16 # Copyright (C) 2003,2004,2007,2009,2012 Olly Betts
18 # This program is free software; you can redistribute it and/or
19 # modify it under the terms of the GNU General Public License as
20 # published by the Free Software Foundation; either version 2 of the
21 # License, or (at your option) any later version.
23 # This program is distributed in the hope that it will be useful,
24 # but WITHOUT ANY WARRANTY; without even the implied warranty of
25 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 # GNU General Public License for more details.
28 # You should have received a copy of the GNU General Public License
29 # along with this program; if not, write to the Free Software
30 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
31 # USA
33 if test 0 = "$#"; then
34 echo "syntax: $0 <remote backend server program> <arguments>"
35 exit 1
38 # Just run the server if valgrind's imperfect x87 emulation isn't an issue.
39 [ "x@FP_EXCESS_PRECISION@" = "xno" ] && exec "$@"
41 # Set srcdir if it isn't already.
42 : ${srcdir="@srcdir@"}
43 export srcdir
45 # We're only run from BackendManager if it's running under valgrind, so if
46 # we can't find valgrind, something is wrong.
47 test -z "${VALGRIND+set}" && VALGRIND="@VALGRIND@"
48 if test -z "$VALGRIND" ; then
49 echo "VALGRIND not set"
50 exit 1
53 # Get libtool to run the test program under valgrind. We have to use
54 # libtool --mode=execute because we want to run valgrind on the compiled
55 # C++ test program, not on the shell running the shell script wrapper libtool
56 # generates.
57 LIBTOOL=`echo '@LIBTOOL@'|sed 's,\$(SHELL),@SHELL@,g;s,\$(top_builddir),@top_builddir@,g'`
59 vg_opts='-q --tool=none'
60 exec $LIBTOOL --mode=execute $VALGRIND $vg_opts "$@"