openafs/tests/libwrap
Benjamin Kaduk 9fd396adab tests: use exec to call libwrap'd executables
No need to leave the shell process hanging around.

In particular, if we are manually running softsig-helper under
libwrap to debug test failures, the child process of the shell is
another shell, which interprets some signals that we wanted to
be passed through, like SIGTERM.  On the other hand, once the
softsig-helper is exec()'d, you basically need another shell to
terminate it, which is a different problem....

Change-Id: Iff7c519886a018cb68e692746d40c427b6299457
Reviewed-on: https://gerrit.openafs.org/12490
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Anders Kaseorg <andersk@mit.edu>
Tested-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2016-12-16 16:25:58 -05:00

49 lines
937 B
Bash
Executable File

#!/bin/sh
# libwrap - run a command with the specified library paths
# Parameters: path_to_library command_to_run command_parameters
#
# This was written to help run the OpenAFS test suite.
#
# License: MIT
NEWLIB_PATH="$1"
export NEWLIB_PATH
shift
TEST_COMMAND="$1"
# Linux, HP-UX (64bit), Solaris, BSD
if [ -z "$LD_LIBRARY_PATH" ] ; then
LD_LIBRARY_PATH="$NEWLIB_PATH"
else
LD_LIBRARY_PATH="$NEWLIB_PATH:$LD_LIBRARY_PATH"
fi
export LD_LIBRARY_PATH
# Mac OS X
if [ -z "$DYLD_LIBRARY_PATH" ] ; then
DYLD_LIBRARY_PATH="$NEWLIB_PATH"
else
DYLD_LIBRARY_PATH="$NEWLIB_PATH:$DYLD_LIBRARY_PATH"
fi
export DYLD_LIBRARY_PATH
# HP-UX (32bit)
if [ -z "$SHLIB_PATH" ] ; then
SHLIB_PATH="$NEWLIB_PATH"
else
SHLIB_PATH="$NEWLIB_PATH:$SHLIB_PATH"
fi
export SHLIB_PATH
# AIX
if [ -z "$LIBPATH" ] ; then
LIBPATH="$NEWLIB_PATH"
else
LIBPATH="$NEWLIB_PATH:$LIBPATH"
fi
export LIBPATH
shift
exec "$TEST_COMMAND" "$@"