LD_LIBRARY_PATH=$(ld-library-path):$(common-objpfx)dlfcn
tst-tls9-static-ENV = $(static-dlopen-environment)
tst-single_threaded-static-dlopen-ENV = $(static-dlopen-environment)
+tst-rootdir-ENV = LD_LIBRARY_PATH=/
tests += \
argv0test \
tst-dlopen-tlsmodid-container \
tst-pldd \
tst-preload-pthread-libc \
+ tst-rootdir \
# tests-container
test-srcs = \
tst-relsort1mod1 \
tst-relsort1mod2 \
tst-ro-dynamic-mod \
+ tst-rootdir-lib \
tst-single_threaded-mod1 \
tst-single_threaded-mod2 \
tst-single_threaded-mod3 \
--- /dev/null
+/* Simple library for testing locating library in root directories.
+ Copyright The GNU Toolchain Authors.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+const char *
+test_func (void)
+{
+ return "Success";
+}
--- /dev/null
+/* Test code for locating libraries in root directories.
+ Copyright The GNU Toolchain Authors.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <support/test-driver.h>
+#include <support/check.h>
+#include <dlfcn.h>
+#include <assert.h>
+
+static int
+do_test (void)
+{
+ void *handle = dlopen ("libtest.so", RTLD_LAZY);
+ TEST_VERIFY_EXIT (handle != NULL);
+ typedef const char *(test_func_t) (void);
+ test_func_t *func = dlsym (handle, "test_func");
+ assert (func != NULL);
+ TEST_COMPARE_STRING (func (), "Success");
+ dlclose (handle);
+ return 0;
+}
+
+#include <support/test-driver.c>