tests: Include LDADDS in qemu_LDADDS
[libvirt/ericb.git] / run.in
blob9a1c6ea11a94b64ea196eff2b56741838ca6dcb1
1 #!/bin/sh
2 # libvirt 'run' programs locally script
3 # Copyright (C) 2012-2013 Red Hat, Inc.
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License, or (at your option) any later version.
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; If not, see
17 # <http://www.gnu.org/licenses/>.
19 #----------------------------------------------------------------------
21 # With this script you can run libvirt programs without needing to
22 # install them first. You just have to do for example:
24 # ./run ./tools/virsh [args ...]
26 # If you are already in the tools/ subdirectory, then the following
27 # command will also work:
29 # ../run ./virsh [...]
31 # You can also run the C programs under valgrind like this:
33 # ./run valgrind [valgrind opts...] ./program
35 # or under gdb:
37 # ./run gdb --args ./program
39 # This also works with sudo (eg. if you need root access for libvirt):
41 # sudo ./run ./tools/virsh list --all
43 #----------------------------------------------------------------------
45 # Find this script.
46 b=@abs_builddir@
48 library_path="$b/src/.libs"
49 if [ -z "$LD_LIBRARY_PATH" ]; then
50 LD_LIBRARY_PATH=$library_path
51 else
52 LD_LIBRARY_PATH="$library_path:$LD_LIBRARY_PATH"
54 export LD_LIBRARY_PATH
56 if [ -z "$PKG_CONFIG_PATH" ]; then
57 PKG_CONFIG_PATH="$b/src"
58 else
59 PKG_CONFIG_PATH="$b/src:$PKG_CONFIG_PATH"
61 export PKG_CONFIG_PATH
63 # This is a cheap way to find some use-after-free and uninitialized
64 # read problems when using glibc.
65 random_val="$(awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)"
66 export MALLOC_PERTURB_=$random_val
68 # Run the program.
69 exec $b/libtool --mode=execute "$@"