TESTS: Add the libwrap script to "make check" to handle library paths
authorJason Edgecombe <jason@rampaginggeek.com>
Fri, 13 Apr 2012 01:30:47 +0000 (21:30 -0400)
committerDerrick Brashear <shadow@dementix.org>
Mon, 16 Apr 2012 13:02:53 +0000 (06:02 -0700)
LICENSE MIT

Change-Id: I5f77d8703a163b8b9224f64010b9e008bb386c59
Reviewed-on: http://gerrit.openafs.org/7202
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Garrett Wollman <wollman@csail.mit.edu>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

tests/Makefile.in
tests/libwrap [new file with mode: 0755]

index f62f248..cb0ad70 100644 (file)
@@ -19,7 +19,7 @@ runtests: runtests.o
 
 check test tests: runtests
        @for A in $(SUBDIRS); do cd $$A && $(MAKE) $@ && cd .. || exit 1; done
-       LD_LIBRARY_PATH=@TOP_OBJDIR@/lib \
+       ./libwrap @TOP_OBJDIR@/lib \
            ./runtests $(abs_top_srcdir)/tests/TESTS
 
 install:
diff --git a/tests/libwrap b/tests/libwrap
new file mode 100755 (executable)
index 0000000..ae32588
--- /dev/null
@@ -0,0 +1,48 @@
+#!/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
+"$TEST_COMMAND" "$@"