diff mbox series

Add support for static internal tests

Message ID 87y2ew3108.fsf@oldenburg.str.redhat.com
State New
Headers show
Series Add support for static internal tests | expand

Commit Message

Florian Weimer March 9, 2021, 1:33 p.m. UTC
Tests whose names are added to the tests-internal-static Makefile
variable are linked statically and built as internal tests.

---
 Makeconfig |  6 +++---
 Makerules  | 12 +++++++++---
 Rules      | 10 ++++++----
 3 files changed, 18 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/Makeconfig b/Makeconfig
index 0a4811b5e5..9e88506ef4 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -732,11 +732,11 @@  $(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\
 # $(run-via-rtld-prefix) is a command that, when prepended to the name
 # of a program built with the newly built library, produces a command
 # that, executed on the host for which the library is built, runs that
-# program.  For tests listed in tests-static or xtests-static, it is
-# empty.
+# program.  For tests listed in binaries-static-tests (from
+# tests-static, xtests-static, tests-internal-static), it is empty.
 run-via-rtld-prefix =							      \
   $(if $(strip $(filter $(notdir $(built-program-file)),		      \
-			$(tests-static) $(xtests-static))),, $(rtld-prefix))
+			$(binaries-static-tests))),, $(rtld-prefix))
 else
 run-via-rtld-prefix =
 endif
diff --git a/Makerules b/Makerules
index ca9885436e..997e218a58 100644
--- a/Makerules
+++ b/Makerules
@@ -771,7 +771,8 @@  endif
 	     $(patsubst %.o,%.d,$(filter %.o,$(extra-objs:.os=.o))) \
 	     $(patsubst %.oS,%.d,$(filter %.oS,$(extra-objs))) \
 	     $(patsubst %.o,%.d,$(filter %.o,$(extra-test-objs:.os=.o))) \
-	     $(addsuffix .d,$(tests) $(tests-internal) $(xtests) $(test-srcs))
+	     $(addsuffix .d,$(tests) $(tests-internal) \
+	       $(tests-internal-static)  $(xtests) $(test-srcs))
 ifeq ($(build-programs),yes)
 +depfiles += $(addsuffix .d,$(others) $(sysdep-others))
 endif
@@ -1297,8 +1298,8 @@  lib := testsuite
 include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))
 endif
 
-all-nonlib := $(strip $(tests-internal) $(test-internal-extras) \
-		      $(others) $(others-extras))
+all-nonlib := $(strip $(tests-internal) $(tests-internal-static) \
+		  $(test-internal-extras) $(others) $(others-extras))
 ifneq (,$(all-nonlib))
 cpp-srcs-left = $(all-nonlib)
 lib := nonlib
@@ -1457,10 +1458,12 @@  mostlyclean: common-mostlyclean
 do-tests-clean:
 	-rm -f $(addprefix $(objpfx),$(addsuffix .out,$(tests) \
 						      $(tests-internal) \
+						      $(tests-internal-static) \
 						      $(xtests) \
 						      $(test-srcs)) \
 				     $(addsuffix .test-result,$(tests) \
 							      $(tests-internal) \
+							      $(tests-internal-static) \
 							      $(xtests) \
 							      $(test-srcs)))
 
@@ -1471,16 +1474,19 @@  common-mostlyclean:
 				     $(others) $(sysdep-others) stubs \
 				     $(addsuffix .o,$(tests) \
 						    $(tests-internal) \
+						    $(tests-internal-static) \
 						    $(xtests) \
 						    $(test-srcs) \
 						    $(others) \
 						    $(sysdep-others)) \
 				     $(addsuffix .out,$(tests) \
 						      $(tests-internal) \
+						      $(tests-internal-static) \
 						      $(xtests) \
 						      $(test-srcs)) \
 				     $(addsuffix .test-result,$(tests) \
 							      $(tests-internal) \
+							      $(tests-internal-static) \
 							      $(xtests) \
 							      $(test-srcs)))
 	-rm -f $(addprefix $(objpfx),$(extra-objs) $(extra-test-objs) \
diff --git a/Rules b/Rules
index 082625bb71..87a2842641 100644
--- a/Rules
+++ b/Rules
@@ -179,11 +179,12 @@  xtests:
 
 ifeq ($(build-programs),yes)
 binaries-all-notests = $(others) $(sysdep-others)
-binaries-all-tests = $(tests) $(tests-internal) $(xtests) $(test-srcs) \
-		     $(tests-container)
+binaries-all-tests = $(tests) $(tests-internal) $(tests-internal-static) \
+  $(xtests) $(test-srcs) $(tests-container)
 binaries-all = $(binaries-all-notests) $(binaries-all-tests)
 binaries-static-notests = $(others-static)
-binaries-static-tests = $(tests-static) $(xtests-static)
+binaries-static-tests = \
+  $(tests-static) $(tests-internal-static) $(xtests-static)
 binaries-static = $(binaries-static-notests) $(binaries-static-tests)
 ifeq (yesyes,$(have-fpie)$(build-shared))
 binaries-pie-tests = $(tests-pie) $(xtests-pie)
@@ -195,7 +196,8 @@  endif
 binaries-mcheck-tests = $(tests-mcheck:%=%-mcheck)
 else
 binaries-all-notests =
-binaries-all-tests = $(tests) $(tests-internal) $(xtests) $(test-srcs)
+binaries-all-tests = $(tests) $(tests-internal) $(tests-internal-static) \
+  $(xtests) $(test-srcs)
 binaries-all = $(binaries-all-tests)
 binaries-static-notests =
 binaries-static-tests =