Skip to contentSkip to conversation

tests: Add check-native and check-nonnative make targets

PATCH In review Glenn Washburn 2 participants 2 messages Feb 8, 2022 – Feb 9, 2022 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tests: Add check-native and check-nonnative make targets

This allows for testing only tests that run directly on the build machine or only tests that run in a virtualized environment. When testing multiple targets on the same build machine the native tests only need to be run once for all targets. Whereas, the nonnative tests must be run for each target because the test is potentially compiled differently for each target.

---
v2: Fix new warnings in bootstrap pointed out by Daniel K

Glenn

---
Range-diff against v1:
1: 0fa3194bd ! 1: 60195f95e tests: Add check-native and check-nonnative make targets
@@ Makefile.util.def: program = {

## conf/Makefile.common ##
@@ conf/Makefile.common: KERNEL_HEADER_FILES =
+
bin_SCRIPTS =
bin_PROGRAMS =
- check_SCRIPTS =
+-check_SCRIPTS =
+-check_PROGRAMS =
+check_SCRIPTS_native = +check_SCRIPTS_nonnative =
- check_PROGRAMS = +check_PROGRAMS_native = +check_PROGRAMS_nonnative = dist_grubconf_DATA =
dist_noinst_DATA =
grubconf_SCRIPTS =
+@@ conf/Makefile.common: platform_PROGRAMS =
+ sbin_SCRIPTS =
+ sbin_PROGRAMS =
+
+-TESTS =
+ EXTRA_DIST =
+ CLEANFILES =
+ BUILT_SOURCES =

## gentpl.py ##
@@ gentpl.py: def program(defn, platform, test=False):

 Makefile.am          |   9 +++
 Makefile.util.def    | 164 +++++++++++++++++++++----------------------
 conf/Makefile.common |   7 +-
 gentpl.py            |   6 +-
 4 files changed, 97 insertions(+), 89 deletions(-)
Makefile.am +9 -0
index bf9c1ba64..10faf670b 100644
@@ -24,6 +24,15 @@ CCASFLAGS_PROGRAM += $(CCASFLAGS_GNULIB)
 
 include $(srcdir)/Makefile.util.am
 
+check_SCRIPTS = $(check_SCRIPTS_native) $(check_SCRIPTS_nonnative)
+check_PROGRAMS = $(check_PROGRAMS_native) $(check_PROGRAMS_nonnative)
+TESTS = $(check_SCRIPTS) $(check_PROGRAMS)
+
+check-native:
+	$(MAKE) TESTS="$(check_PROGRAMS_native) $(check_SCRIPTS_native)" check
+check-nonnative:
+	$(MAKE) TESTS="$(check_PROGRAMS_nonnative) $(check_SCRIPTS_nonnative)" check
+
 # XXX Use Automake's LEX & YACC support
 grub_script.tab.h: $(top_srcdir)/grub-core/script/parser.y
 	$(YACC) -d -p grub_script_yy -b grub_script $(top_srcdir)/grub-core/script/parser.y
Makefile.util.def +82 -82

580 lines not on this page · raw message

conf/Makefile.common +4 -3
index 68a032ce0..fb0c57a4d 100644
@@ -105,8 +105,10 @@ KERNEL_HEADER_FILES =
 
 bin_SCRIPTS =
 bin_PROGRAMS =
-check_SCRIPTS =
-check_PROGRAMS =
+check_SCRIPTS_native =
+check_SCRIPTS_nonnative =
+check_PROGRAMS_native =
+check_PROGRAMS_nonnative =
 dist_grubconf_DATA =
 dist_noinst_DATA =
 grubconf_SCRIPTS =
@@ -122,7 +124,6 @@ platform_PROGRAMS =
 sbin_SCRIPTS =
 sbin_PROGRAMS =
 
-TESTS =
 EXTRA_DIST =
 CLEANFILES =
 BUILT_SOURCES =
gentpl.py +2 -4
index c86550d4f..28ec24209 100644
@@ -817,8 +817,7 @@ def program(defn, platform, test=False):
     set_canonical_name_suffix("")
 
     if 'testcase' in defn:
-        gvar_add("check_PROGRAMS", name)
-        gvar_add("TESTS", name)
+        gvar_add("check_PROGRAMS_" + defn['testcase'], name)
     else:
         var_add(installdir(defn) + "_PROGRAMS", name)
         if 'mansection' in defn:
@@ -859,8 +858,7 @@ def script(defn, platform):
     name = defn['name']
 
     if 'testcase' in defn:
-        gvar_add("check_SCRIPTS", name)
-        gvar_add ("TESTS", name)
+        gvar_add("check_SCRIPTS_" + defn['testcase'], name)
     else:
         var_add(installdir(defn) + "_SCRIPTS", name)
         if 'mansection' in defn:
Signature · 1 line
2.27.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines · Glenn Washburn

This allows for testing only tests that run directly on the build machine or only tests that run in a virtualized environment. When testing multiple targets on the same build machine the native tests only need to be run once for all targets. Whereas, the nonnative tests must be run for each target because the test is potentially compiled differently for each target.

Daniel