[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v1 3/5] tools/test: introduce a 'make check' rule



It runs all unit tests (those that do not require xenctrl) in parallel.
The for loop fragment from tools/Rules.mk is not used, because that
serializes make invocations in subdirectories (tested by inserting a
'sleep 5' into the 'run' rules).

There might be dependencies between directories in tools/,
but all tests are independent and can be built and run in parallel.

Signed-off-by: Edwin Török <edwin.torok@xxxxxxxxxx>
---
 Makefile             |  4 ++++
 tools/Makefile       |  4 ++++
 tools/Rules.mk       |  2 +-
 tools/tests/Makefile | 20 +++++++++++++++++++-
 4 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 67b71ac3d4..ca7ec58c99 100644
--- a/Makefile
+++ b/Makefile
@@ -50,6 +50,10 @@ install: $(TARGS_INSTALL)
 .PHONY: build
 build: $(TARGS_BUILD)
 
+.PHONY: check
+check:
+       $(MAKE) -C tools check
+
 .PHONY: build-xen
 build-xen:
        $(MAKE) -C xen build
diff --git a/tools/Makefile b/tools/Makefile
index 6ecf7c0da8..7f6c29965d 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -55,6 +55,10 @@ endif
 .PHONY: build all
 build all: subdirs-all
 
+.PHONY: check
+check:
+       $(MAKE) -C tests check
+
 .PHONY: install
 install:
        $(INSTALL_DIR) -m 700 $(DESTDIR)$(XEN_DUMP_DIR)
diff --git a/tools/Rules.mk b/tools/Rules.mk
index d9b9c740e9..abb1cbd783 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -194,7 +194,7 @@ subdirs-all subdirs-clean subdirs-install subdirs-distclean 
subdirs-uninstall: .
                $(MAKE) subdir-$(patsubst subdirs-%,%,$@)-$$subdir; \
        done
 
-subdir-all-% subdir-clean-% subdir-install-% subdir-uninstall-%: .phony
+subdir-all-% subdir-clean-% subdir-install-% subdir-uninstall-% subdir-run-%: 
.phony
        $(MAKE) -C $* $(patsubst subdir-%-$*,%,$@)
 
 subdir-distclean-%: .phony
diff --git a/tools/tests/Makefile b/tools/tests/Makefile
index 6477a4386d..d73a6d7cfb 100644
--- a/tools/tests/Makefile
+++ b/tools/tests/Makefile
@@ -17,5 +17,23 @@ ifneq ($(clang),y)
 SUBDIRS-$(CONFIG_X86) += x86_emulator
 endif
 
-.PHONY: all clean install distclean uninstall
+.PHONY: all clean install distclean uninstall check
 all clean distclean install uninstall: %: subdirs-%
+
+# Subset of SUBDIRS that do not depend on xenctrl
+# Thus these tests can be run in the CI directly,
+# or on the developer's machine.
+
+SUBDIRS_CHECK-y :=
+SUBDIRS_CHECK-y += domid
+SUBDIRS_CHECK-y += pdx
+SUBDIRS_CHECK-y += rangeset
+SUBDIRS_CHECK-y += vpci
+
+SUBDIRS_CHECK-$(CONFIG_X86) += cpu-policy
+ifneq ($(clang),y)
+SUBDIRS_CHECK-$(CONFIG_X86) += x86_emulator
+endif
+
+# Ensure tests can run in parallel, the for loop in ../Rules.mk would 
serialize them
+check: $(foreach subdir,$(SUBDIRS_CHECK-y),subdir-run-$(subdir))
-- 
2.47.3




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.