summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2018-07-06 01:10:41 -0400
committerDJ Delorie <dj@redhat.com>2018-08-22 21:20:37 -0400
commit561b0bec4448f0302cb4915bf67c919bde4a1c57 (patch)
treea05c836bfe23e523ec7d357203e7b6599b287f98 /Makefile
parentb35d3509caee04b2e196bb832138e4e4042347db (diff)
Add test-in-container infrastructure.
* Makefile (testroot.pristine): New rules to initialize the test-in-container "testroot". * Makerules (all-testsuite): Add tests-container. * Rules (tests-expected): Add tests-container. (binaries-all-tests): Likewise. (tests-container): New, run these tests in the testroot container. * support/Makefile (others): Add *-container, support_paths.c, xmkdirp, and links-dso-program. * support/links-dso-program-c.c: New. * support/links-dso-program.cc: New. * support/test-container.c: New. * support/shell-container.c: New. * support/echo-container.c: New. * support/true-container.c: New. * support/xmkdirp.c: New. * support/xsymlink.c: New. * support/support_paths.c: New. * support/support.h: Add support paths prototypes. * support/xunistd.h: Add xmkdirp () and xsymlink (). * nss/tst-nss-test3.c: Convert to test-in-container. * nss/tst-nss-test3.root/: New.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile56
1 files changed, 56 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index d3f25a525a..3df55e689a 100644
--- a/Makefile
+++ b/Makefile
@@ -340,6 +340,62 @@ define summarize-tests
@! egrep -q -v '^(X?PASS|XFAIL|UNSUPPORTED):' $(objpfx)$1
endef
+# The intention here is to do ONE install of our build into the
+# testroot.pristine/ directory, then rsync (internal to
+# support/test-container) that to testroot.root/ at the start of each
+# test. That way we can promise each test a "clean" install, without
+# having to do the install for each test.
+#
+# In addition, we have to copy some files (which we build) into this
+# root in addition to what glibc installs. For example, many tests
+# require additional programs including /bin/sh, /bin/true, and
+# /bin/echo, all of which we build below to limit library dependencies
+# to just those things in glibc and language support libraries which
+# we also copy into the into the rootfs. To determine what language
+# support libraries we need we build a "test" program in either C or
+# (if available) C++ just so we can copy in any shared objects
+# (which we do not build) that GCC-compiled programs depend on.
+
+
+ifeq (,$(CXX))
+LINKS_DSO_PROGRAM = links-dso-program-c
+else
+LINKS_DSO_PROGRAM = links-dso-program
+endif
+
+$(tests-container) $(addsuffix /tests,$(subdirs)) : \
+ $(objpfx)testroot.pristine/install.stamp
+$(objpfx)testroot.pristine/install.stamp :
+ test -d $(objpfx)testroot.pristine || \
+ mkdir $(objpfx)testroot.pristine
+ # We need a working /bin/sh for some of the tests.
+ test -d $(objpfx)testroot.pristine/bin || \
+ mkdir $(objpfx)testroot.pristine/bin
+ cp $(objpfx)support/shell-container $(objpfx)testroot.pristine/bin/sh
+ cp $(objpfx)support/echo-container $(objpfx)testroot.pristine/bin/echo
+ cp $(objpfx)support/true-container $(objpfx)testroot.pristine/bin/true
+ # Copy these DSOs first so we can overwrite them with our own.
+ for dso in `$(test-wrapper-env) LD_TRACE_LOADED_OBJECTS=1 \
+ $(objpfx)elf/$(rtld-installed-name) \
+ $(objpfx)testroot.pristine/bin/sh \
+ | grep / | sed 's/^[^/]*//' | sed 's/ .*//'` ;\
+ do \
+ test -d `dirname $(objpfx)testroot.pristine$$dso` || \
+ mkdir -p `dirname $(objpfx)testroot.pristine$$dso` ;\
+ $(test-wrapper) cp $$dso $(objpfx)testroot.pristine$$dso ;\
+ done
+ for dso in `$(test-wrapper-env) LD_TRACE_LOADED_OBJECTS=1 \
+ $(objpfx)elf/$(rtld-installed-name) \
+ $(objpfx)support/$(LINKS_DSO_PROGRAM) \
+ | grep / | sed 's/^[^/]*//' | sed 's/ .*//'` ;\
+ do \
+ test -d `dirname $(objpfx)testroot.pristine$$dso` || \
+ mkdir -p `dirname $(objpfx)testroot.pristine$$dso` ;\
+ $(test-wrapper) cp $$dso $(objpfx)testroot.pristine$$dso ;\
+ done
+ $(MAKE) install DESTDIR=$(objpfx)testroot.pristine
+ touch $(objpfx)testroot.pristine/install.stamp
+
tests-special-notdir = $(patsubst $(objpfx)%, %, $(tests-special))
tests: $(tests-special)
$(..)scripts/merge-test-results.sh -s $(objpfx) "" \