Skip to contentSkip to conversation

Add check-native and check-nonnative as make targets

PATCH Superseded Glenn Washburn 2 participants 6 messages Jan 13, 2022 – Feb 8, 2022 Kbuild

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Add check-native and check-nonnative as make targets

Tests can be put into two categories, native (tests that run on the build system) and non-native (tests run in QEMU). For any two targets (even of completely different architectures), the native tests will be running the same binary code (because they will be compiled for and run on the build machine), and thus will have the same result. So when building and running tests for multiple targets on a build machine, the native tests on need be run once. This can decrease the runtime of a multi-target test run significantly (like hours). This patch series makes it possible to run only run the non-native tests (skipping the native tests) by partitioning the set of tests into native and non-native based on whether QEMU is used by the test. The first patch is not necessary, but makes things look cleaner.

Phcoder, could you confirm that the logic above is sound?

Glenn

Glenn Washburn (2):
conf/Makefile.common: Order alphabetically variables
tests: Add check-native and check-nonnative make targets

 Makefile.am          |   9 +++
 Makefile.util.def    | 164 +++++++++++++++++++++----------------------
 conf/Makefile.common |  22 +++---
 gentpl.py            |   6 +-
 4 files changed, 106 insertions(+), 95 deletions(-)
Signature · 1 line
2.27.0
#1 lore raw

PATCH 1/2 conf/Makefile.common: Order alphabetically variables

---
 conf/Makefile.common | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
conf/Makefile.common +9 -9
index 2a1a886f6..f0bb6e160 100644
@@ -102,24 +102,24 @@ MODULE_FILES =
 MARKER_FILES =
 KERNEL_HEADER_FILES =
 
-man_MANS =
-noinst_DATA =
-pkgdata_DATA =
 bin_SCRIPTS =
-sbin_SCRIPTS =
 bin_PROGRAMS =
-platform_DATA =
-sbin_PROGRAMS =
 check_SCRIPTS =
-dist_grubconf_DATA =
 check_PROGRAMS =
+dist_grubconf_DATA =
+dist_noinst_DATA =
+grubconf_SCRIPTS =
+man_MANS =
+noinst_DATA =
 noinst_SCRIPTS =
 noinst_PROGRAMS =
-grubconf_SCRIPTS =
 noinst_LIBRARIES =
-dist_noinst_DATA =
+pkgdata_DATA =
+platform_DATA =
 platform_SCRIPTS =
 platform_PROGRAMS =
+sbin_SCRIPTS =
+sbin_PROGRAMS =
 
 TESTS =
 EXTRA_DIST =
Signature · 1 line
2.27.0
#2 lore raw

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

In reply to 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.

---
 Makefile.am          |   9 +++
 Makefile.util.def    | 164 +++++++++++++++++++++----------------------
 conf/Makefile.common |   4 ++
 gentpl.py            |   6 +-
 4 files changed, 97 insertions(+), 86 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 -0
index f0bb6e160..02107898d 100644
@@ -105,7 +105,11 @@ KERNEL_HEADER_FILES =
 bin_SCRIPTS =
 bin_PROGRAMS =
 check_SCRIPTS =
+check_SCRIPTS_native =
+check_SCRIPTS_nonnative =
 check_PROGRAMS =
+check_PROGRAMS_native =
+check_PROGRAMS_nonnative =
 dist_grubconf_DATA =
 dist_noinst_DATA =
 grubconf_SCRIPTS =
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
#3 lore raw

Re: [PATCH 2/2] tests: Add check-native and check-nonnative make targets

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.

This patch makes bootstrap unhappy:
Makefile.am:27: warning: check_SCRIPTS multiply defined in condition TRUE ... conf/Makefile.common:107: ... 'check_SCRIPTS' previously defined here
Makefile.am:10: 'conf/Makefile.common' included from here
Makefile.am:28: warning: check_PROGRAMS multiply defined in condition TRUE ... conf/Makefile.common:110: ... 'check_PROGRAMS' previously defined here
Makefile.am:10: 'conf/Makefile.common' included from here
Makefile.am:29: warning: TESTS multiply defined in condition TRUE ... conf/Makefile.common:128: ... 'TESTS' previously defined here
Makefile.am:10: 'conf/Makefile.common' included from here

I have just taken patch #1.

Daniel

#4 lore raw

Re: [PATCH 2/2] tests: Add check-native and check-nonnative make targets

Quoted 20 lines · On Tue, 8 Feb 2022 17:10:32 +0100 Daniel Kiper <[email protected]> wrote:
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.

This patch makes bootstrap unhappy:
Makefile.am:27: warning: check_SCRIPTS multiply defined in condition TRUE ... conf/Makefile.common:107: ... 'check_SCRIPTS' previously defined here
Makefile.am:10: 'conf/Makefile.common' included from here
Makefile.am:28: warning: check_PROGRAMS multiply defined in condition TRUE ... conf/Makefile.common:110: ... 'check_PROGRAMS' previously defined here
Makefile.am:10: 'conf/Makefile.common' included from here
Makefile.am:29: warning: TESTS multiply defined in condition TRUE ... conf/Makefile.common:128: ... 'TESTS' previously defined here
Makefile.am:10: 'conf/Makefile.common' included from here

Quoted 1 line

I have just taken patch #1.

I didn't notice this as it seems to have no effect on building or testing. I'll send an updated patch removing these warnings.

Glenn

#5 lore raw
In reply to Glenn Washburn
Quoted 11 lines · Glenn Washburn

Tests can be put into two categories, native (tests that run on the build system) and non-native (tests run in QEMU). For any two targets (even of completely different architectures), the native tests will be running the same binary code (because they will be compiled for and run on the build machine), and thus will have the same result. So when building and running tests for multiple targets on a build machine, the native tests on need be run once. This can decrease the runtime of a multi-target test run significantly (like hours). This patch series makes it possible to run only run the non-native tests (skipping the native tests) by partitioning the set of tests into native and non-native based on whether QEMU is used by the test. The first patch is not necessary, but makes things look cleaner.

For both Reviewed-by: Daniel Kiper <[email protected]>...

Daniel