Factor out common build rules and helpers in tools/tests
cover Factor out common build rules and helpers in tools/tests
There are a lot of duplicate rules and code in tools/tests.
To simplify writing new tests move common build rules into a tools/tests/Rules.mk, and helper macros/functions into common/{tests,guests}.{c,h}.
This also ensures that CFLAGS are applied consistently across all tests (e.g. one test failed to build now due to an unused variable error).
Guest creation also needs to test for the presence of PV, HVM HAP or HVM shadow support in Xen and create a guest accordingly. This can be shared.
After these changes the per-test Makefile only contains entries specific to the test (its name, dependencies, etc.) and avoids having to copy&paste boilerplate code.
tools/tests/x86_emulator remains unchanged, because the Makefile contains a lot of conditional build logic specific to that test.
An upcoming patch series will introduce new tests using the simplified Makefile and shared helpers.
For convenience this is also available at:
https://gitlab.com/xen-project/people/edwintorok/xen/-/compare/staging...private%2Fedvint%2Fmigration-tests2?from_project_id=2336572
https://gitlab.com/xen-project/people/edwintorok/xen/-/pipelines/2342318716
Edwin Török (7):
tools/tests/*/Makefile: factor out common PHONY rules into Rules.mk tools/tests/vpci/main.c: drop unused variables tools/tests/*/Makefile: factor out build rules tools/tests: factor out common helpers tools/tests/common: ensure error messages have a newline tools/tests/tsx: move guest creation to common area tools/tests: print more debug info
tools/tests/Rules.mk | 60 +++++++++++++ tools/tests/common/guests.c | 89 +++++++++++++++++++ tools/tests/common/guests.h | 11 +++ tools/tests/common/tests.c | 15 ++++ tools/tests/common/tests.h | 18 ++++ tools/tests/cpu-policy/Makefile | 41 ++------- tools/tests/cpu-policy/test-cpu-policy.c | 7 +- tools/tests/domid/Makefile | 37 ++------ tools/tests/domid/test-domid.c | 11 +-- tools/tests/mem-claim/Makefile | 31 +------ tools/tests/mem-claim/test-mem-claim.c | 9 +- tools/tests/paging-mempool/Makefile | 31 +------ .../paging-mempool/test-paging-mempool.c | 9 +- tools/tests/pdx/Makefile | 37 +------- tools/tests/pdx/test-pdx.c | 3 +- tools/tests/rangeset/Makefile | 36 +------- tools/tests/rangeset/test-rangeset.c | 3 +- tools/tests/resource/Makefile | 35 +------- tools/tests/resource/test-resource.c | 9 +- tools/tests/tsx/Makefile | 35 +------- tools/tests/tsx/test-tsx.c | 88 +++--------------- tools/tests/vpci/.gitignore | 1 + tools/tests/vpci/Makefile | 36 ++------ tools/tests/vpci/main.c | 6 +- tools/tests/xenstore/Makefile | 37 +------- tools/tests/xenstore/test-xenstore.c | 4 +- 26 files changed, 261 insertions(+), 438 deletions(-) create mode 100644 tools/tests/Rules.mk create mode 100644 tools/tests/common/guests.c create mode 100644 tools/tests/common/guests.h create mode 100644 tools/tests/common/tests.c create mode 100644 tools/tests/common/tests.h create mode 100644 tools/tests/vpci/.gitignore
Signature · 1 line
2.47.3
PATCH 1/7 tools/tests/*/Makefile: factor out common PHONY rules into Rules.mk
Introduce a new tools/tests/Rules.mk that must be included *last* in a Makefile, after TARGETS is defined.
This reduces the boilerplate that must be copy pasted when new tests are written.
Renamed TESTS to TARGETS in tools/tests/domid/Makefile Extend DEPS_RM, so that most tests don't need custom clean rules, except in tools/tests/domid which needs to remove a directory too.
Make the run rules consistent: do not attempt to run the tests if HOSTCC != CC.
The common rules use the rule forms which allow multiple TARGETS.
tools/tests/x86_emulator/Makefile is unchanged, since this has a lot of conditional rules that are very different from the other tests.
--- tools/tests/Rules.mk | 48 +++++++++++++++++++++++++++++ tools/tests/cpu-policy/Makefile | 26 +--------------- tools/tests/domid/Makefile | 28 ++--------------- tools/tests/mem-claim/Makefile | 23 ++------------ tools/tests/paging-mempool/Makefile | 23 ++------------ tools/tests/pdx/Makefile | 33 ++------------------ tools/tests/rangeset/Makefile | 27 ++-------------- tools/tests/resource/Makefile | 27 ++-------------- tools/tests/tsx/Makefile | 26 ++-------------- tools/tests/vpci/Makefile | 30 +++--------------- tools/tests/xenstore/Makefile | 29 ++--------------- 11 files changed, 72 insertions(+), 248 deletions(-) create mode 100644 tools/tests/Rules.mk
tools/tests/Rules.mk new file +48 -0
@@ -0,0 +1,48 @@ +# Usage: include this last in your Makefile. +# +# For example: +# +# XEN_ROOT = $(CURDIR)/../../.. +# include $(XEN_ROOT)/tools/Rules.mk +# +# TARGETS := ... +# ... +# include $(XEN_ROOT)/tools/tests/Rules.mk + +ifndef XEN_ROOT +$(error XEN_ROOT is not defined) +endif + +.PHONY: all +all: $(TARGETS) +.DEFAULT_GOAL: all + +.PHONY: run +run: $(TARGETS) +ifeq ($(CC),$(HOSTCC)) + set -e; \ + for test in $? ; do \ + ./$$test ; \ + done +else + $(warning HOSTCC != CC, will not run test) +endif + +.PHONY: clean +clean:: + $(RM) -- *.o $(TARGETS) $(DEPS_RM) + +.PHONY: distclean +distclean: clean + $(RM) -- *~ + +.PHONY: install +install: all + $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)/tests + $(if $(TARGETS),$(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(LIBEXEC)/tests) + +.PHONY: uninstall +uninstall: + $(RM) -- $(addprefix $(DESTDIR)$(LIBEXEC)/tests/,$(TARGETS)) + +-include $(DEPS_INCLUDE)
tools/tests/cpu-policy/Makefile +1 -25
@@ -12,30 +12,6 @@ else $(warning Test harness not built, use newer compiler than "$(CC)" (version $(shell $(CC) -dumpversion))) endif -.PHONY: all -all: $(TARGETS) - -.PHONY: run -run: $(TARGETS) - ./$< - -.PHONY: clean -clean: - $(RM) -- *.o $(TARGETS) $(DEPS_RM) - -.PHONY: distclean -distclean: clean - $(RM) -- *~ - -.PHONY: install -install: all - $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)/tests - $(if $(TARGETS),$(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(LIBEXEC)/tests) - -.PHONY: uninstall -uninstall: - $(RM) -- $(addprefix $(DESTDIR)$(LIBEXEC)/tests/,$(TARGETS)) - CFLAGS += -D__XEN_TOOLS__ CFLAGS += $(CFLAGS_xeninclude) CFLAGS += $(APPEND_CFLAGS)
@@ -49,4 +25,4 @@ vpath %.c ../../../xen/lib/x86 test-cpu-policy: test-cpu-policy.o msr.o cpuid.o policy.o $(CC) $^ -o $@ $(LDFLAGS) --include $(DEPS_INCLUDE) +include $(XEN_ROOT)/tools/tests/Rules.mk
tools/tests/domid/Makefile +3 -25
@@ -7,7 +7,7 @@ XEN_ROOT=$(CURDIR)/../../.. include $(XEN_ROOT)/tools/Rules.mk -TESTS := test-domid +TARGETS += test-domid define list-c-headers $(shell sed -n \
@@ -36,30 +36,8 @@ vpath $(1) $(2) $(call emit-harness-deps,$(1),$(call list-c-headers,$(2)$(1))) endef -.PHONY: all -all: $(TESTS) - -.PHONY: run -run: $(TESTS) - set -e; $(foreach t,$(TESTS),./$(t);) - -.PHONY: clean -clean: +clean:: $(RM) -r generated - $(RM) -- *.o $(TESTS) $(DEPS_RM) - -.PHONY: distclean -distclean: clean - $(RM) -- *~ - -.PHONY: install -install: all - $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)/tests - $(INSTALL_PROG) test-domid $(DESTDIR)$(LIBEXEC)/tests - -.PHONY: uninstall -uninstall: - $(RM) -- $(DESTDIR)$(LIBEXEC)/tests/test-domid CFLAGS += -D__XEN_TOOLS__ # find-next-bit.c
@@ -85,4 +63,4 @@ $(eval $(call vpath-with-harness-deps,domid.c,$(XEN_ROOT)/xen/common/)) test-domid: domid.o find-next-bit.o test-domid.o $(CC) $^ -o $@ $(LDFLAGS) --include $(DEPS_INCLUDE) +include $(XEN_ROOT)/tools/tests/Rules.mk
tools/tests/mem-claim/Makefile +2 -21
@@ -2,26 +2,7 @@ XEN_ROOT = $(CURDIR)/../../.. include $(XEN_ROOT)/tools/Rules.mk TARGET := test-mem-claim - -.PHONY: all -all: $(TARGET) - -.PHONY: clean -clean: - $(RM) -- *.o $(TARGET) $(DEPS_RM) - -.PHONY: distclean -distclean: clean - $(RM) -- *~ - -.PHONY: install -install: all - $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)/tests - $(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC)/tests - -.PHONY: uninstall -uninstall: - $(RM) -- $(DESTDIR)$(LIBEXEC)/tests/$(TARGET) +TARGETS := $(TARGET) CFLAGS += $(CFLAGS_xeninclude) CFLAGS += $(CFLAGS_libxenctrl)
@@ -35,4 +16,4 @@ LDFLAGS += $(APPEND_LDFLAGS) $(TARGET): test-mem-claim.o $(CC) -o $@ $< $(LDFLAGS) --include $(DEPS_INCLUDE) +include $(XEN_ROOT)/tools/tests/Rules.mk
tools/tests/paging-mempool/Makefile +2 -21
@@ -2,26 +2,7 @@ XEN_ROOT = $(CURDIR)/../../.. include $(XEN_ROOT)/tools/Rules.mk TARGET := test-paging-mempool - -.PHONY: all -all: $(TARGET) - -.PHONY: clean -clean: - $(RM) -- *.o $(TARGET) $(DEPS_RM) - -.PHONY: distclean -distclean: clean - $(RM) -- *~ - -.PHONY: install -install: all - $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)/tests - $(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC)/tests - -.PHONY: uninstall -uninstall: - $(RM) -- $(DESTDIR)$(LIBEXEC)/tests/$(TARGET) +TARGETS := $(TARGET) CFLAGS += $(CFLAGS_xeninclude) CFLAGS += $(CFLAGS_libxenctrl)
@@ -35,4 +16,4 @@ LDFLAGS += $(APPEND_LDFLAGS) $(TARGET): test-paging-mempool.o $(CC) -o $@ $< $(LDFLAGS) --include $(DEPS_INCLUDE) +include $(XEN_ROOT)/tools/tests/Rules.mk
tools/tests/pdx/Makefile +2 -31
@@ -3,36 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk TARGETS := test-pdx-mask test-pdx-offset -.PHONY: all -all: $(TARGETS) - -.PHONY: run -run: $(TARGETS) -ifeq ($(CC),$(HOSTCC)) - set -e; \ - for test in $? ; do \ - ./$$test ; \ - done -else - $(warning HOSTCC != CC, will not run test) -endif - -.PHONY: clean -clean: - $(RM) -- *.o $(TARGETS) $(DEPS_RM) pdx.h - -.PHONY: distclean -distclean: clean - $(RM) -- *~ - -.PHONY: install -install: all - $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)/tests - $(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(LIBEXEC)/tests - -.PHONY: uninstall -uninstall: - $(RM) -- $(patsubst %,$(DESTDIR)$(LIBEXEC)/tests/%,$(TARGETS)) +DEPS_RM += pdx.h pdx.h: $(XEN_ROOT)/xen/include/xen/pdx.h sed -e '/^#[[:space:]]*include/d' <$< >$@
@@ -47,4 +18,4 @@ test-pdx-offset: CFLAGS += -DCONFIG_PDX_OFFSET_COMPRESSION test-pdx-%: test-pdx.c pdx.h $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$*.o) -o $@ $< $(APPEND_CFLAGS) --include $(DEPS_INCLUDE) +include $(XEN_ROOT)/tools/tests/Rules.mk
tools/tests/rangeset/Makefile +3 -24
@@ -2,30 +2,9 @@ XEN_ROOT=$(CURDIR)/../../.. include $(XEN_ROOT)/tools/Rules.mk TARGET := test-rangeset +TARGETS := $(TARGET) -.PHONY: all -all: $(TARGET) - -.PHONY: run -run: $(TARGET) - ./$< - -.PHONY: clean -clean: - $(RM) -- *.o $(TARGET) $(DEPS_RM) list.h rangeset.h rangeset.c - -.PHONY: distclean -distclean: clean - $(RM) -- *~ - -.PHONY: install -install: all - $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)/tests - $(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC)/tests - -.PHONY: uninstall -uninstall: - $(RM) -- $(addprefix $(DESTDIR)$(LIBEXEC)/tests/,$(TARGET)) +DEPS_RM += list.h rangeset.h rangeset.c list.h: $(XEN_ROOT)/xen/include/xen/list.h rangeset.h: $(XEN_ROOT)/xen/include/xen/rangeset.h
@@ -47,4 +26,4 @@ test-rangeset.o rangeset.o: list.h rangeset.h test-rangeset: rangeset.o test-rangeset.o $(CC) $^ -o $@ $(LDFLAGS) --include $(DEPS_INCLUDE) +include $(XEN_ROOT)/tools/tests/Rules.mk
tools/tests/resource/Makefile +2 -25
@@ -2,30 +2,7 @@ XEN_ROOT = $(CURDIR)/../../.. include $(XEN_ROOT)/tools/Rules.mk TARGET := test-resource - -.PHONY: all -all: $(TARGET) - -.PHONY: run -run: $(TARGET) - ./$(TARGET) - -.PHONY: clean -clean: - $(RM) -- *.o $(TARGET) $(DEPS_RM) - -.PHONY: distclean -distclean: clean - $(RM) -- *~ - -.PHONY: install -install: all - $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)/tests - $(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC)/tests - -.PHONY: uninstall -uninstall: - $(RM) -- $(DESTDIR)$(LIBEXEC)/tests/$(TARGET) +TARGETS := $(TARGET) CFLAGS += $(CFLAGS_xeninclude) CFLAGS += $(CFLAGS_libxenctrl)
@@ -43,4 +20,4 @@ LDFLAGS += $(APPEND_LDFLAGS) $(TARGET): test-resource.o $(CC) -o $@ $< $(LDFLAGS) --include $(DEPS_INCLUDE) +include $(XEN_ROOT)/tools/tests/Rules.mk
tools/tests/tsx/Makefile +2 -24
@@ -2,29 +2,7 @@ XEN_ROOT = $(CURDIR)/../../.. include $(XEN_ROOT)/tools/Rules.mk TARGET := test-tsx - -.PHONY: all -all: $(TARGET) - -.PHONY: clean -clean: - $(RM) -- *.o $(TARGET) $(DEPS_RM) - -.PHONY: distclean -distclean: clean - $(RM) -- *~ - -.PHONY: install -install: all - $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)/tests - $(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC)/tests - -.PHONY: uninstall -uninstall: - $(RM) -- $(DESTDIR)$(LIBEXEC)/tests/$(TARGET) - -.PHONY: uninstall -uninstall: +TARGETS := $(TARGET) CFLAGS += -I$(XEN_ROOT)/tools/libs/ctrl -I$(XEN_ROOT)/tools/libs/guest CFLAGS += $(CFLAGS_xeninclude)
@@ -41,4 +19,4 @@ LDFLAGS += $(APPEND_LDFLAGS) $(TARGET): test-tsx.o $(CC) -o $@ $< $(LDFLAGS) --include $(DEPS_INCLUDE) +include $(XEN_ROOT)/tools/tests/Rules.mk
tools/tests/vpci/Makefile +4 -26
@@ -2,36 +2,12 @@ XEN_ROOT=$(CURDIR)/../../.. include $(XEN_ROOT)/tools/Rules.mk TARGET := test_vpci - -.PHONY: all -all: $(TARGET) - -.PHONY: run -run: $(TARGET) -ifeq ($(CC),$(HOSTCC)) - ./$(TARGET) -else - $(warning HOSTCC != CC, will not run test) -endif +TARGETS := $(TARGET) $(TARGET): vpci.c vpci.h list.h main.c emul.h $(CC) $(CFLAGS_xeninclude) -g -o $@ vpci.c main.c -.PHONY: clean -clean: - rm -rf $(TARGET) *.o *~ vpci.h vpci.c list.h - -.PHONY: distclean -distclean: clean - -.PHONY: install -install: all - $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)/tests - $(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC)/tests - -.PHONY: uninstall -uninstall: - $(RM) -- $(DESTDIR)$(LIBEXEC)/tests/$(TARGET) +DEPS_RM += vpci.h vpci.c list.h vpci.c: $(XEN_ROOT)/xen/drivers/vpci/vpci.c # Remove includes and add the test harness header
@@ -41,3 +17,5 @@ list.h: $(XEN_ROOT)/xen/include/xen/list.h vpci.h: $(XEN_ROOT)/xen/include/xen/vpci.h list.h vpci.h: sed -e '/#include/d' <$< >$@ + +include $(XEN_ROOT)/tools/tests/Rules.mk
tools/tests/xenstore/Makefile +3 -26
@@ -1,31 +1,8 @@ XEN_ROOT=$(CURDIR)/../../.. include $(XEN_ROOT)/tools/Rules.mk -TARGETS-y := test-xenstore -TARGETS := $(TARGETS-y) - -.PHONY: all -all: build - -.PHONY: build -build: $(TARGETS) - -.PHONY: clean -clean: - $(RM) -- *.o $(TARGETS) $(DEPS_RM) - -.PHONY: distclean -distclean: clean - $(RM) -- *~ - -.PHONY: install -install: all - $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)/tests - $(if $(TARGETS),$(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(LIBEXEC)/tests) - -.PHONY: uninstall -uninstall: - $(RM) -- $(addprefix $(DESTDIR)$(LIBEXEC)/tests/,$(TARGETS)) +TARGET := test-xenstore +TARGETS := $(TARGET) CFLAGS += $(CFLAGS_libxenstore) CFLAGS += $(APPEND_CFLAGS)
@@ -41,4 +18,4 @@ endif test-xenstore: test-xenstore.o $(CC) -o $@ $< $(LDFLAGS) --include $(DEPS_INCLUDE) +include $(XEN_ROOT)/tools/tests/Rules.mk
Signature · 1 line
2.47.3
Re: [PATCH 1/7] tools/tests/*/Makefile: factor out common PHONY rules into Rules.mk
Quoted 2 lines · Edwin Török
Introduce a new
tools/tests/Rules.mkthat must be included *last* in aMakefile, after TARGETS is defined.
Requiring inclusion after TARGETS is defined is certainly okay. Requiring it to be included absolutely last is imo going too far. There surely are going to be cases where something wants overriding or adding to.
Quoted 11 lines
tools/tests/Rules.mk new file +8
-0@@ -0,0 +1,48 @@ +# Usage: include this last in your Makefile. +# +# For example: +# +# XEN_ROOT = $(CURDIR)/../../.. +# include $(XEN_ROOT)/tools/Rules.mk +# +# TARGETS := ...
tools/tests/Rules.mk line 18
Quoted 10 lines
tools/tests/Rules.mk new file +10
-0+# ... +# include $(XEN_ROOT)/tools/tests/Rules.mk + +ifndef XEN_ROOT +$(error XEN_ROOT is not defined) +endif + +.PHONY: all +all: $(TARGETS) +.DEFAULT_GOAL: all
Make 3.80, which ./README still says we support, doesn't look to know this.
Jan
Re: [PATCH 1/7] tools/tests/*/Makefile: factor out common PHONY rules into Rules.mk
On 23 Feb 2026, at 16:37, Jan Beulich <[email protected]> wrote:
On 23.02.2026 11:14, Edwin Török wrote:
Introduce a new tools/tests/Rules.mk that must be included *last* in a Makefile, after TARGETS is defined.
Requiring inclusion after TARGETS is defined is certainly okay. Requiring it to be included absolutely last is imo going too far. There surely are going to be cases where something wants overriding or adding to.
I’ll change this so that the Makefile defines XEN_ROOT, CFLAGS, LDFLAGS, TARGETS, and then includes the file.
tools/tests/Rules.mk new file +18 -0
@@ -0,0 +1,48 @@ +# Usage: include this last in your Makefile. +# +# For example: +# +# XEN_ROOT = $(CURDIR)/../../.. +# include $(XEN_ROOT)/tools/Rules.mk +# +# TARGETS := ... +# ... +# include $(XEN_ROOT)/tools/tests/Rules.mk + +ifndef XEN_ROOT +$(error XEN_ROOT is not defined) +endif + +.PHONY: all +all: $(TARGETS) +.DEFAULT_GOAL: all
Make 3.80, which ./README still says we support, doesn't look to know this.
Do you know which (Linux) distribution and version would have Make 3.80 so I can test my changes there?
I tried looking at https://repology.org/project/make/versions, but the only OS that has make 3.80 is AIX, and I don’t have access to that.
Thanks,
—Edwin
Re: [PATCH 1/7] tools/tests/*/Makefile: factor out common PHONY rules into Rules.mk
First, since this looks to be recurring: Please don't send HTML mails.
Quoted 35 lines · Edwin Torok
On 23 Feb 2026, at 16:37, Jan Beulich <[email protected]> wrote:
On 23.02.2026 11:14, Edwin Török wrote:
Introduce a newtools/tests/Rules.mkthat must be included *last* in aMakefile, after TARGETS is defined.Requiring inclusion after TARGETS is defined is certainly okay. Requiring it to be included absolutely last is imo going too far. There surely are going to be cases where something wants overriding or adding to.
I’ll change this so that the
MakefiledefinesXEN_ROOT, CFLAGS, LDFLAGS, TARGETS, and then includes the file.tools/tests/Rules.mk new file +18
-0@@ -0,0 +1,48 @@ +# Usage: include this last in your Makefile. +# +# For example: +# +# XEN_ROOT = $(CURDIR)/../../.. +# include $(XEN_ROOT)/tools/Rules.mk +# +# TARGETS := ... +# ... +# include $(XEN_ROOT)/tools/tests/Rules.mk + +ifndef XEN_ROOT +$(error XEN_ROOT is not defined) +endif + +.PHONY: all +all: $(TARGETS) +.DEFAULT_GOAL: all
Quoted 3 lines
Make 3.80, which ./README still says we support, doesn't look to know this.
Do you know which (Linux) distribution and version would have Make 3.80 so I can test my changes there?
Not without a lot of digging. Perhaps we simply want to bump the minimum version, to "sync up" with what we did for binutils, gcc, and clang?
Jan
Re: [PATCH 1/7] tools/tests/*/Makefile: factor out common PHONY rules into Rules.mk
Quoted 5 lines · Jan Beulich
First, since this looks to be recurring: Please don't send HTML mails.
Thanks, didn’t notice my mail client was doing that, changed the settings now.
Quoted 37 lines · Edwin Torok
Quoted 35 lines · Jan Beulich
On 23.02.2026 11:14, Edwin Török wrote:
Introduce a newtools/tests/Rules.mkthat must be included *last* in aMakefile, after TARGETS is defined.Requiring inclusion after TARGETS is defined is certainly okay. Requiring it to be included absolutely last is imo going too far. There surely are going to be cases where something wants overriding or adding to.
I’ll change this so that the
MakefiledefinesXEN_ROOT, CFLAGS, LDFLAGS, TARGETS, and then includes the file.tools/tests/Rules.mk new file +18
-0@@ -0,0 +1,48 @@ +# Usage: include this last in your Makefile. +# +# For example: +# +# XEN_ROOT = $(CURDIR)/../../.. +# include $(XEN_ROOT)/tools/Rules.mk +# +# TARGETS := ... +# ... +# include $(XEN_ROOT)/tools/tests/Rules.mk + +ifndef XEN_ROOT +$(error XEN_ROOT is not defined) +endif + +.PHONY: all +all: $(TARGETS) +.DEFAULT_GOAL: all
Quoted 6 lines
Quoted 3 lines
Make 3.80, which ./README still says we support, doesn't look to know this.
Do you know which (Linux) distribution and version would have Make 3.80 so I can test my changes there?
Not without a lot of digging. Perhaps we simply want to bump the minimum version, to "sync up" with what we did for binutils, gcc, and clang?
Minimum binutils is 2.25, which excludes CentOS6. CentOS7 has 2.27 and make 3.82.
The only other OS that I see that’d have make 3.81 and binutils >= 2.25 would be Ubuntu 14.04, which is EoL.
So we could update to Make 3.82?
If we exclude CentOS7 (which is EoL), then the next minimum make that I see would be 4.2.1. Would that be too big of a jump?
Best regards,
—Edwin
Re: [PATCH 1/7] tools/tests/*/Makefile: factor out common PHONY rules into Rules.mk
Quoted 52 lines · Edwin Torok
Quoted 5 lines · Jan Beulich
First, since this looks to be recurring: Please don't send HTML mails.
Thanks, didn’t notice my mail client was doing that, changed the settings now.
Quoted 37 lines · Edwin Torok
Quoted 35 lines · Jan Beulich
On 23.02.2026 11:14, Edwin Török wrote:
Introduce a newtools/tests/Rules.mkthat must be included *last* in aMakefile, after TARGETS is defined.Requiring inclusion after TARGETS is defined is certainly okay. Requiring it to be included absolutely last is imo going too far. There surely are going to be cases where something wants overriding or adding to.
I’ll change this so that the
MakefiledefinesXEN_ROOT, CFLAGS, LDFLAGS, TARGETS, and then includes the file.tools/tests/Rules.mk new file +18
-0@@ -0,0 +1,48 @@ +# Usage: include this last in your Makefile. +# +# For example: +# +# XEN_ROOT = $(CURDIR)/../../.. +# include $(XEN_ROOT)/tools/Rules.mk +# +# TARGETS := ... +# ... +# include $(XEN_ROOT)/tools/tests/Rules.mk + +ifndef XEN_ROOT +$(error XEN_ROOT is not defined) +endif + +.PHONY: all +all: $(TARGETS) +.DEFAULT_GOAL: allQuoted 6 lines
Quoted 3 lines
Make 3.80, which ./README still says we support, doesn't look to know this.
Do you know which (Linux) distribution and version would have Make 3.80 so I can test my changes there?
Not without a lot of digging. Perhaps we simply want to bump the minimum version, to "sync up" with what we did for binutils, gcc, and clang?
Quoted 6 lines
Minimum binutils is 2.25, which excludes CentOS6. CentOS7 has 2.27 and make 3.82.
The only other OS that I see that’d have make 3.81 and binutils >= 2.25 would be Ubuntu 14.04, which is EoL.So we could update to Make 3.82?
If we exclude CentOS7 (which is EoL), then the next minimum make that I see would be 4.2.1. Would that be too big of a jump?
I would take gcc and binutils (both dating back to 2015) as reference, which would make it either 4.0 or 4.1 which we may want to pick. (Which doesn't exclude 3.82 as an option, of course.)
Jan
PATCH 2/7 tools/tests/vpci/main.c: drop unused variables
In reply to Edwin TörökThey may become build failures.
--- tools/tests/vpci/main.c | 2 -- 1 file changed, 2 deletions(-)
tools/tests/vpci/main.c +0 -2
@@ -189,8 +189,6 @@ main(int argc, char **argv)uint32_t r24 =0 ;uint8_t r28, r30;struct mask_data r32; -unsigned int i; -int rc;INIT_LIST_HEAD (&vpci.handlers);spin_lock_init (&vpci.lock);
Signature · 1 line
2.47.3
Re: [PATCH 2/7] tools/tests/vpci/main.c: drop unused variables
Quoted 3 lines · Edwin Török
They may become build failures.
Signed-off-by Edwin Török <[email protected]>
Thanks, Roger.
PATCH 3/7 tools/tests/*/Makefile: factor out build rules
In reply to Edwin TörökAlso makes CFLAGS consistent across all tests, e.g. test_vpci would now fail to build with an unused variable error if it hadn't been fixed in a previous commit.
Introduce a symlink test_vpci.c -> main.c, since this is the only test using a different .c file name from the main executable (could also rename the file instead).
--- tools/tests/Rules.mk | 9 +++++++++ tools/tests/cpu-policy/Makefile | 15 ++++----------- tools/tests/domid/Makefile | 11 +++-------- tools/tests/mem-claim/Makefile | 8 -------- tools/tests/paging-mempool/Makefile | 8 -------- tools/tests/pdx/Makefile | 4 ---- tools/tests/rangeset/Makefile | 9 +-------- tools/tests/resource/Makefile | 8 -------- tools/tests/tsx/Makefile | 8 -------- tools/tests/vpci/.gitignore | 1 + tools/tests/vpci/Makefile | 10 +++++++--- tools/tests/xenstore/Makefile | 8 +------- 12 files changed, 26 insertions(+), 73 deletions(-) create mode 100644 tools/tests/vpci/.gitignore
tools/tests/Rules.mk +9 -0
@@ -45,4 +45,13 @@ install: all uninstall: $(RM) -- $(addprefix $(DESTDIR)$(LIBEXEC)/tests/,$(TARGETS)) +CFLAGS += -D__XEN_TOOLS__ +CFLAGS += $(CFLAGS_xeninclude) + +%.o: Makefile + +$(TARGET): $(TARGET).o + $(CC) $^ -o $@ $(LDFLAGS) $(APPEND_LDFLAGS) + -include $(DEPS_INCLUDE) +
tools/tests/cpu-policy/Makefile +4 -11
@@ -3,26 +3,19 @@ include $(XEN_ROOT)/tools/Rules.mk TARGETS := +TARGET := test-cpu-policy + # For brevity, these tests make extensive use of designated initialisers in # anonymous unions, but GCCs older than 4.6 can't cope. Ignore the test in # this case. ifneq ($(gcc)$(call cc-ver,$(CC),lt,0x040600),yy) -TARGETS += test-cpu-policy +TARGETS += $(TARGET) else $(warning Test harness not built, use newer compiler than "$(CC)" (version $(shell $(CC) -dumpversion))) endif -CFLAGS += -D__XEN_TOOLS__ -CFLAGS += $(CFLAGS_xeninclude) -CFLAGS += $(APPEND_CFLAGS) - -LDFLAGS += $(APPEND_LDFLAGS) - vpath %.c ../../../xen/lib/x86 -%.o: Makefile - -test-cpu-policy: test-cpu-policy.o msr.o cpuid.o policy.o - $(CC) $^ -o $@ $(LDFLAGS) +$(TARGET): msr.o cpuid.o policy.o include $(XEN_ROOT)/tools/tests/Rules.mk
tools/tests/domid/Makefile +3 -8
@@ -7,7 +7,8 @@ XEN_ROOT=$(CURDIR)/../../.. include $(XEN_ROOT)/tools/Rules.mk -TARGETS += test-domid +TARGET := test-domid +TARGETS += $(TARGET) define list-c-headers $(shell sed -n \
@@ -39,7 +40,6 @@ endef clean:: $(RM) -r generated -CFLAGS += -D__XEN_TOOLS__ # find-next-bit.c CFLAGS += '-DEXPORT_SYMBOL(x)=' \ -Dfind_first_bit \
@@ -47,12 +47,8 @@ CFLAGS += '-DEXPORT_SYMBOL(x)=' \ -Dfind_next_bit \ -Dfind_next_bit_le \ -Dfind_next_zero_bit_le -CFLAGS += $(APPEND_CFLAGS) -CFLAGS += $(CFLAGS_xeninclude) CFLAGS += -I./generated/ -LDFLAGS += $(APPEND_LDFLAGS) - vpath find-next-bit.c $(XEN_ROOT)/xen/lib/ # Point to the hypervisor code and generate test harness dependencies
@@ -60,7 +56,6 @@ vpath find-next-bit.c $(XEN_ROOT)/xen/lib/ # within a mocked environment. $(eval $(call vpath-with-harness-deps,domid.c,$(XEN_ROOT)/xen/common/)) -test-domid: domid.o find-next-bit.o test-domid.o - $(CC) $^ -o $@ $(LDFLAGS) +$(TARGET): domid.o find-next-bit.o include $(XEN_ROOT)/tools/tests/Rules.mk
tools/tests/mem-claim/Makefile +0 -8
@@ -4,16 +4,8 @@ include $(XEN_ROOT)/tools/Rules.mk TARGET := test-mem-claim TARGETS := $(TARGET) -CFLAGS += $(CFLAGS_xeninclude) CFLAGS += $(CFLAGS_libxenctrl) -CFLAGS += $(APPEND_CFLAGS) LDFLAGS += $(LDLIBS_libxenctrl) -LDFLAGS += $(APPEND_LDFLAGS) - -%.o: Makefile - -$(TARGET): test-mem-claim.o - $(CC) -o $@ $< $(LDFLAGS) include $(XEN_ROOT)/tools/tests/Rules.mk
tools/tests/paging-mempool/Makefile +0 -8
@@ -4,16 +4,8 @@ include $(XEN_ROOT)/tools/Rules.mk TARGET := test-paging-mempool TARGETS := $(TARGET) -CFLAGS += $(CFLAGS_xeninclude) CFLAGS += $(CFLAGS_libxenctrl) -CFLAGS += $(APPEND_CFLAGS) LDFLAGS += $(LDLIBS_libxenctrl) -LDFLAGS += $(APPEND_LDFLAGS) - -%.o: Makefile - -$(TARGET): test-paging-mempool.o - $(CC) -o $@ $< $(LDFLAGS) include $(XEN_ROOT)/tools/tests/Rules.mk
tools/tests/pdx/Makefile +0 -4
@@ -8,10 +8,6 @@ DEPS_RM += pdx.h pdx.h: $(XEN_ROOT)/xen/include/xen/pdx.h sed -e '/^#[[:space:]]*include/d' <$< >$@ -CFLAGS += -D__XEN_TOOLS__ -CFLAGS += $(APPEND_CFLAGS) -CFLAGS += $(CFLAGS_xeninclude) - test-pdx-mask: CFLAGS += -DCONFIG_PDX_MASK_COMPRESSION test-pdx-offset: CFLAGS += -DCONFIG_PDX_OFFSET_COMPRESSION
tools/tests/rangeset/Makefile +1 -8
@@ -15,15 +15,8 @@ rangeset.c: $(XEN_ROOT)/xen/common/rangeset.c # Remove includes and add the test harness header sed -e '/#include/d' -e '1s/^/#include "harness.h"/' <$< >$@ -CFLAGS += -D__XEN_TOOLS__ -CFLAGS += $(APPEND_CFLAGS) -CFLAGS += $(CFLAGS_xeninclude) - -LDFLAGS += $(APPEND_LDFLAGS) - test-rangeset.o rangeset.o: list.h rangeset.h -test-rangeset: rangeset.o test-rangeset.o - $(CC) $^ -o $@ $(LDFLAGS) +$(TARGET): rangeset.o include $(XEN_ROOT)/tools/tests/Rules.mk
tools/tests/resource/Makefile +0 -8
@@ -4,20 +4,12 @@ include $(XEN_ROOT)/tools/Rules.mk TARGET := test-resource TARGETS := $(TARGET) -CFLAGS += $(CFLAGS_xeninclude) CFLAGS += $(CFLAGS_libxenctrl) CFLAGS += $(CFLAGS_libxenforeginmemory) CFLAGS += $(CFLAGS_libxengnttab) -CFLAGS += $(APPEND_CFLAGS) LDFLAGS += $(LDLIBS_libxenctrl) LDFLAGS += $(LDLIBS_libxenforeignmemory) LDFLAGS += $(LDLIBS_libxengnttab) -LDFLAGS += $(APPEND_LDFLAGS) - -%.o: Makefile - -$(TARGET): test-resource.o - $(CC) -o $@ $< $(LDFLAGS) include $(XEN_ROOT)/tools/tests/Rules.mk
tools/tests/tsx/Makefile +0 -8
@@ -5,18 +5,10 @@ TARGET := test-tsx TARGETS := $(TARGET) CFLAGS += -I$(XEN_ROOT)/tools/libs/ctrl -I$(XEN_ROOT)/tools/libs/guest -CFLAGS += $(CFLAGS_xeninclude) CFLAGS += $(CFLAGS_libxenctrl) CFLAGS += $(CFLAGS_libxenguest) -CFLAGS += $(APPEND_CFLAGS) LDFLAGS += $(LDLIBS_libxenctrl) LDFLAGS += $(LDLIBS_libxenguest) -LDFLAGS += $(APPEND_LDFLAGS) - -%.o: Makefile - -$(TARGET): test-tsx.o - $(CC) -o $@ $< $(LDFLAGS) include $(XEN_ROOT)/tools/tests/Rules.mk
tools/tests/vpci/.gitignore new file +1 -0
@@ -0,0 +1 @@ +test_vpci.c
tools/tests/vpci/Makefile +7 -3
@@ -4,10 +4,14 @@ include $(XEN_ROOT)/tools/Rules.mk TARGET := test_vpci TARGETS := $(TARGET) -$(TARGET): vpci.c vpci.h list.h main.c emul.h - $(CC) $(CFLAGS_xeninclude) -g -o $@ vpci.c main.c +$(TARGET).c: main.c + ln -sf $< $@ -DEPS_RM += vpci.h vpci.c list.h +vpci.o: vpci.h +$(TARGET).o: vpci.h emul.h list.h +$(TARGET): vpci.o + +DEPS_RM += vpci.h vpci.c list.h $(TARGET).c vpci.c: $(XEN_ROOT)/xen/drivers/vpci/vpci.c # Remove includes and add the test harness header
tools/tests/xenstore/Makefile +1 -7
@@ -5,17 +5,11 @@ TARGET := test-xenstore TARGETS := $(TARGET) CFLAGS += $(CFLAGS_libxenstore) -CFLAGS += $(APPEND_CFLAGS) LDFLAGS += $(LDLIBS_libxenstore) -LDFLAGS += $(APPEND_LDFLAGS) + ifeq ($(CONFIG_Linux),y) LDFLAGS += -Wl,--as-needed -lc -lrt endif -%.o: Makefile - -test-xenstore: test-xenstore.o - $(CC) -o $@ $< $(LDFLAGS) - include $(XEN_ROOT)/tools/tests/Rules.mk
Signature · 1 line
2.47.3
Re: [PATCH 3/7] tools/tests/*/Makefile: factor out build rules
Quoted 3 lines · Edwin Török
Also makes CFLAGS consistent across all tests, e.g.
test_vpciwould now fail to build with an unused variable error if it hadn't been fixed in a previous commit.
I can't quite derive why that would happen.
tools/tests/Rules.mk install: all · line 54
Quoted 13 lines
tools/tests/Rules.mk +7
-0@@ -45,4 +45,13 @@ install: all uninstall: $(RM) -- $(addprefix $(DESTDIR)$(LIBEXEC)/tests/,$(TARGETS)) +CFLAGS += -D__XEN_TOOLS__ +CFLAGS += $(CFLAGS_xeninclude) + +%.o: Makefile + +$(TARGET): $(TARGET).o + $(CC) $^ -o $@ $(LDFLAGS) $(APPEND_LDFLAGS)
In the earlier patch you require TARGETS to be surfaced. Why would we limit things to a single target here then? Imo we want to settle on every subdir having a single target, or the abstraction allowing for multiple.
tools/tests/Rules.mk install: all · line 57
Quoted 2 lines
tools/tests/Rules.mk +1
-0-include $(DEPS_INCLUDE) +
Nit: Stray change?
Quoted 13 lines
tools/tests/cpu-policy/Makefile +2
-1@@ -3,26 +3,19 @@ include $(XEN_ROOT)/tools/Rules.mk TARGETS := +TARGET := test-cpu-policy + # For brevity, these tests make extensive use of designated initialisers in # anonymous unions, but GCCs older than 4.6 can't cope. Ignore the test in # this case. ifneq ($(gcc)$(call cc-ver,$(CC),lt,0x040600),yy) -TARGETS += test-cpu-policy
tools/tests/cpu-policy/Makefile include $(XEN_ROOT)/tools/Rules.mk · line 19
Quoted 10 lines
tools/tests/cpu-policy/Makefile +1
-5+TARGETS += $(TARGET) else $(warning Test harness not built, use newer compiler than "$(CC)" (version $(shell $(CC) -dumpversion))) endif -CFLAGS += -D__XEN_TOOLS__ -CFLAGS += $(CFLAGS_xeninclude) -CFLAGS += $(APPEND_CFLAGS) - -LDFLAGS += $(APPEND_LDFLAGS)
You use $(APPEND_LDFLAGS) in the new rule (without adding to LDFLAGS), but where did $(APPEND_CFLAGS) go?
Quoted 9 lines
tools/tests/vpci/.gitignore new file +1
-0@@ -0,0 +1 @@ +test_vpci.ctools/tests/vpci/Makefile +0
-0
tools/tests/vpci/Makefile include $(XEN_ROOT)/tools/Rules.mk · line 8
Quoted 7 lines
tools/tests/vpci/Makefile +2
-2@@ -4,10 +4,14 @@ include $(XEN_ROOT)/tools/Rules.mk TARGET := test_vpci TARGETS := $(TARGET) -$(TARGET): vpci.c vpci.h list.h main.c emul.h - $(CC) $(CFLAGS_xeninclude) -g -o $@ vpci.c main.c +$(TARGET).c: main.c + ln -sf $< $@
Can we perhaps try to avoid further symlinking, unless absolutely necessary? Here it looks to be easy to rename main.c into test_vpci.c (yet better would be test-vcpi.c).
Jan
PATCH 4/7 tools/tests: factor out common helpers
In reply to Edwin TörökShare fail/verify macros, and the handling or nr_failures. The tests will no longer have a main function, but instead have a test_main. This ensures that nr_failures is handled consistently.
This'll make it easier to write new tests that are consistent with the existing ones, without having to copy/paste.
--- tools/tests/Rules.mk | 3 +++ tools/tests/common/tests.c | 15 +++++++++++++++ tools/tests/common/tests.h | 18 ++++++++++++++++++ tools/tests/cpu-policy/test-cpu-policy.c | 7 +------ tools/tests/domid/test-domid.c | 11 ++--------- tools/tests/mem-claim/test-mem-claim.c | 9 ++------- .../tests/paging-mempool/test-paging-mempool.c | 9 ++------- tools/tests/pdx/test-pdx.c | 3 ++- tools/tests/rangeset/test-rangeset.c | 3 ++- tools/tests/resource/test-resource.c | 9 ++------- tools/tests/tsx/test-tsx.c | 10 ++-------- tools/tests/vpci/main.c | 4 ++-- tools/tests/xenstore/test-xenstore.c | 4 +++- 13 files changed, 56 insertions(+), 49 deletions(-) create mode 100644 tools/tests/common/tests.c create mode 100644 tools/tests/common/tests.h
tools/tests/Rules.mk +3 -0
@@ -47,11 +47,14 @@ uninstall: CFLAGS += -D__XEN_TOOLS__ CFLAGS += $(CFLAGS_xeninclude) +CFLAGS += -I../common/ %.o: Makefile $(TARGET): $(TARGET).o $(CC) $^ -o $@ $(LDFLAGS) $(APPEND_LDFLAGS) +$(TARGETS): $(XEN_ROOT)/tools/tests/common/tests.o + -include $(DEPS_INCLUDE)
tools/tests/common/tests.c new file +15 -0
@@ -0,0 +1,15 @@ +#include "tests.h" + +unsigned int nr_failures; + +int main (int argc,char *argv[argc+1 ]) +{ +int rc =test_main (argc, argv); + +if ( nr_failures ) +printf ("Done: %u failures\n" , nr_failures); +else +printf ("Done: all ok\n" ); + +return rc ? rc : !!nr_failures; +}
tools/tests/common/tests.h new file +18 -0
@@ -0,0 +1,18 @@ +#include <stdio.h> +#include <sysexits.h> + +extern unsigned int nr_failures; + +#define fail (fmt, ...) \ +({ \ + nr_failures++; \ + (void)printf(fmt, ##__VA_ARGS__); \ +}) + +#define verify(exp, fmt, args...) \ +while (!(exp)) { \ + printf(fmt, ## args); \ + exit(EX_SOFTWARE); \ +} + +extern int test_main (int argc,char *argv[argc+1 ]);
tools/tests/cpu-policy/test-cpu-policy.c +1 -6
@@ -650,7 +650,7 @@ static void test_is_compatible_failure(void) } } -int main (int argc,char **argv) +int test_main (int argc,char **argv) {printf ("CPU Policy unit tests\n" );
@@ -667,10 +667,5 @@ int main(int argc, char **argv)test_is_compatible_success ();test_is_compatible_failure (); -if ( nr_failures ) -printf ("Done: %u failures\n" , nr_failures); -else -printf ("Done: all ok\n" ); -return !!nr_failures; }
tools/tests/domid/test-domid.c +2 -9
@@ -5,20 +5,13 @@* Copyright 2025 Ford Motor Company */ -#include <sysexits.h> - +#include "tests.h" #include "harness.h" -#define verify(exp, fmt, args...) \ -while (!(exp)) { \ - printf(fmt, ## args); \ - exit(EX_SOFTWARE); \ -} -/* * Fail on the first error, since tests are dependent on each other. */ -int main (int argc,char **argv) +int test_main (int argc,char *argv[argc+1 ]) {domid_t expected, allocated;
tools/tests/mem-claim/test-mem-claim.c +2 -7
@@ -11,12 +11,7 @@#include <xengnttab.h> #include <xen-tools/common-macros.h> -static unsigned int nr_failures; -#define fail (fmt, ...) \ -({ \ - nr_failures++; \ - (void)printf(fmt, ##__VA_ARGS__); \ -}) +#include "tests.h" #define MB_PAGES (x) (MB(x) / XC_PAGE_SIZE)
@@ -158,7 +153,7 @@ static void run_tests(void) physinfo.outstanding_pages); } -int main (int argc,char **argv) +int test_main (int argc,char *argv[argc+1 ]) {int rc;
tools/tests/paging-mempool/test-paging-mempool.c +2 -7
@@ -10,12 +10,7 @@#include <xengnttab.h> #include <xen-tools/common-macros.h> -static unsigned int nr_failures; -#define fail (fmt, ...) \ -({ \ - nr_failures++; \ - (void)printf(fmt, ##__VA_ARGS__); \ -}) +#include "tests.h" static xc_interface *xch;static uint32_t domid;
@@ -136,7 +131,7 @@ static void run_tests(void) 64 << 20, size_bytes); } -int main (int argc,char **argv) +int test_main (int argc,char *argv[argc+1 ]) {int rc;
tools/tests/pdx/test-pdx.c +2 -1
@@ -5,6 +5,7 @@* Copyright (C) 2025 Cloud Software Group */ +#include "tests.h" #include "harness.h" #include "../../xen/common/pdx.c"
@@ -29,7 +30,7 @@ static void print_ranges(const struct range *r) } } -int main (int argc,char **argv) +int main (int argc,char *argv[argc+1 ]) { static const struct { struct range ranges[MAX_RANGES];
tools/tests/rangeset/test-rangeset.c +2 -1
@@ -5,6 +5,7 @@* Copyright (C) 2025 Cloud Software Group */ +#include "tests.h" #include "harness.h" struct range {
@@ -140,7 +141,7 @@ static void print_both(struct rangeset *r, const struct range *expected,printf ("[%ld, %ld]\n" , expected[i].start, expected[i].end); } -int main (int argc,char **argv) +int test_main (int argc,char *argv[argc+1 ]) {struct rangeset *r =rangeset_new (NULL ,NULL ,0 );unsigned int i;
tools/tests/resource/test-resource.c +2 -7
@@ -9,12 +9,7 @@#include <xengnttab.h> #include <xen-tools/common-macros.h> -static unsigned int nr_failures; -#define fail (fmt, ...) \ -({ \ - nr_failures++; \ - (void)printf(fmt, ##__VA_ARGS__); \ -}) +#include "tests.h" static xc_interface *xch;static xenforeignmemory_handle *fh;
@@ -255,7 +250,7 @@ static void test_domain_configurations(void) } } -int main (int argc,char **argv) +int test_main (int argc,char *argv[argc+1 ]) {int rc;
tools/tests/tsx/test-tsx.c +2 -8
@@ -30,6 +30,7 @@#include <xenguest.h> #include <xen-tools/common-macros.h> +#include "tests.h" #include "xg_private.h" enum {
@@ -44,13 +45,6 @@ enum {#define MSR_TSX_CTRL 0x00000122#define MSR_MCU_OPT_CTRL 0x00000123 -static unsigned int nr_failures; -#define fail (fmt, ...) \ -({ \ - nr_failures++; \ - (void)printf(fmt, ##__VA_ARGS__); \ -}) -static xc_interface *xch;/*
@@ -540,7 +534,7 @@ static void test_tsx(void)test_guests (); } -int main (int argc,char **argv) +int test_main (int argc,char *argv[argc+1 ]) {printf ("TSX tests\n" );
tools/tests/vpci/main.c +2 -2
@@ -16,6 +16,7 @@* License along with this program; If not, see <http://www.gnu.org/licenses/>. */ +#include "tests.h" #include "emul.h" /* Single vcpu (current), and single domain with a single PCI device. */
@@ -175,8 +176,7 @@ void multiwrite4_check(unsigned int reg)multiread4_check (reg, val); } -int -main (int argc,char **argv) +int test_main (int argc,char *argv[argc+1 ]) {/* Index storage by offset. */ uint32_t r0 =0xdeadbeef ;
tools/tests/xenstore/test-xenstore.c +3 -1
@@ -33,6 +33,8 @@#include <xen-tools/common-macros.h> +#include "tests.h" +#define TEST_PATH "xenstore-test"#define WRITE_BUFFERS_N 10#define WRITE_BUFFERS_SIZE 4000
@@ -445,7 +447,7 @@ static void cleanup(void) } } -int main (int argc,char *argv[]) +int test_main (int argc,char *argv[argc+1 ]) {int opt, t, iters =1 , ret =0 , randtime =0 ;char *test =NULL ;
Signature · 1 line
2.47.3
Re: [PATCH 4/7] tools/tests: factor out common helpers
Quoted 23 lines · Edwin Török
tools/tests/Rules.mk +3
-0@@ -47,11 +47,14 @@ uninstall: CFLAGS += -D__XEN_TOOLS__ CFLAGS += $(CFLAGS_xeninclude) +CFLAGS += -I../common/ %.o: Makefile $(TARGET): $(TARGET).o $(CC) $^ -o $@ $(LDFLAGS) $(APPEND_LDFLAGS) +$(TARGETS): $(XEN_ROOT)/tools/tests/common/tests.o + -include $(DEPS_INCLUDE)tools/tests/common/tests.c new file +0
-0
tools/tests/common/tests.c line 5
Quoted 5 lines
tools/tests/common/tests.c new file +5
-0@@ -0,0 +1,15 @@ +#include "tests.h" + +unsigned int nr_failures; + +int main (int argc,char *argv[argc+1 ])
Nit (style): Blanks around + please.
tools/tests/common/tests.c line 14
Quoted 9 lines
tools/tests/common/tests.c new file +9
-0+{ +int rc =test_main (argc, argv); + +if ( nr_failures ) +printf ("Done: %u failures\n" , nr_failures); +else +printf ("Done: all ok\n" ); + +return rc ? rc : !!nr_failures;
Nit: No need for the middle operand; we use that extension extensively.
Quoted 9 lines
tools/tests/common/tests.h new file +6
-0@@ -0,0 +1,18 @@ +#include <stdio.h> +#include <sysexits.h> + +extern unsigned int nr_failures; + +#define fail (fmt, ...) \
tools/tests/common/tests.h line 16
Quoted 10 lines
tools/tests/common/tests.h new file +10
-0+({ \ + nr_failures++; \ + (void)printf(fmt, ##__VA_ARGS__); \ +}) + +#define verify(exp, fmt, args...) \ +while (!(exp)) { \ + printf(fmt, ## args); \ + exit(EX_SOFTWARE); \ +}
For both macros, please be consistent in how you want to deal with the variable number of arguments.
For the latter macro, like the former it wants to be coded such that a semicolon and the use site is necessary (and doesn't end up as a stray one).
tools/tests/cpu-policy/test-cpu-policy.c static void test_is_compatible_failure(void) · line 653
Quoted 8 lines
tools/tests/cpu-policy/test-cpu-policy.c +1
-1@@ -650,7 +650,7 @@ static void test_is_compatible_failure(void) } } -int main (int argc,char **argv) +int test_main (int argc,char **argv)
Elsewhere you switch to argv[argc + 1] - why not here?
Quoted 11 lines
tools/tests/pdx/test-pdx.c +1
-0@@ -5,6 +5,7 @@* Copyright (C) 2025 Cloud Software Group */ +#include "tests.h" #include "harness.h" #include "../../xen/common/pdx.c"
tools/tests/pdx/test-pdx.c static void print_ranges(const struct range *r) · line 36
Quoted 8 lines
tools/tests/pdx/test-pdx.c +1
-1@@ -29,7 +30,7 @@ static void print_ranges(const struct range *r) } } -int main (int argc,char **argv) +int main (int argc,char *argv[argc+1 ]) { static const struct { struct range ranges[MAX_RANGES];
No renaming to test_main() here?
Jan
PATCH 5/7 tools/tests/common: ensure error messages have a newline
In reply to Edwin TörökOtherwise messages from the next test will end up on the same line as an error message from a previous test.
(calling fail is not fatal).
--- tools/tests/common/tests.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/tests/common/tests.h +2 -2
@@ -6,12 +6,12 @@ extern unsigned int nr_failures;#define fail (fmt, ...) \ ({ \ nr_failures++; \ - (void)printf(fmt, ##__VA_ARGS__); \ + (void)printf(fmt"\n", ##__VA_ARGS__); \ }) #define verify(exp, fmt, args...) \ while (!(exp)) { \ - printf(fmt, ## args); \ + printf(fmt"\n", ## args); \ exit(EX_SOFTWARE); \ }
Signature · 1 line
2.47.3
Re: [PATCH 5/7] tools/tests/common: ensure error messages have a newline
Quoted 3 lines · Edwin Török
Otherwise messages from the next test will end up on the same line as an error message from a previous test.
(callingfailis not fatal).
Will they? Glancing quickly over the uses of fail(), I see most if not all of them using a newline. Same for verify(). Imo either all use sites have newlines, or all use sites lose them in favor of adding them centrally ...
Quoted 6 lines
tools/tests/common/tests.h +0
-0@@ -6,12 +6,12 @@ extern unsigned int nr_failures;#define fail (fmt, ...) \ ({ \ nr_failures++; \
tools/tests/common/tests.h extern unsigned int nr_failures; · line 16
Quoted 10 lines
tools/tests/common/tests.h +2
-2- (void)printf(fmt, ##__VA_ARGS__); \ + (void)printf(fmt"\n", ##__VA_ARGS__); \ }) #define verify(exp, fmt, args...) \ while (!(exp)) { \ - printf(fmt, ## args); \ + printf(fmt"\n", ## args); \ exit(EX_SOFTWARE); \ }
... here.
As a style nit - please have a blank between fmt and the string literal.
Jan
PATCH 6/7 tools/tests/tsx: move guest creation to common area
In reply to Edwin TörökSo that other tests can reuse the creation of HVM/PV tests.
--- tools/tests/common/guests.c | 87 +++++++++++++++++++++++++++++++++++++ tools/tests/common/guests.h | 11 +++++ tools/tests/tsx/Makefile | 2 + tools/tests/tsx/test-tsx.c | 78 ++++----------------------------- 4 files changed, 108 insertions(+), 70 deletions(-) create mode 100644 tools/tests/common/guests.c create mode 100644 tools/tests/common/guests.h
tools/tests/common/guests.c new file +87 -0
@@ -0,0 +1,87 @@ +#define _GNU_SOURCE +#include "guests.h" +#include "tests.h" + +#include <err.h> +#include <errno.h> +#include <string.h> + +xc_interface *xch; +xc_physinfo_t physinfo; +bool xen_has_pv = true, xen_has_hvm = true; + +void test_guest_init (void ) +{ +int rc; + xch =xc_interface_open (NULL ,NULL ,0 ); + +if ( !xch ) +err (1 ,"xc_interface_open" ); + + rc =xc_physinfo (xch, &physinfo); +if ( rc ) +err (1 ,"Failed to obtain physinfo" ); + + xen_has_hvm = physinfo.capabilities & XEN_SYSCTL_PHYSCAP_hvm; + xen_has_pv = physinfo.capabilities & XEN_SYSCTL_PHYSCAP_pv; +} + +void test_guest (struct xen_domctl_createdomain *c) +{ +uint32_t domid =0 ; +int rc; + +if (!xch) +return fail ("test_guest_init() not called" ); + + rc =xc_domain_create (xch, &domid, c); +if ( rc ) +return fail (" Domain create failure: %d - %s\n" , + errno,strerror (errno)); + +printf (" Created d%u\n" , domid); + +test_guest_domid (domid); + + rc =xc_domain_destroy (xch, domid); +if ( rc ) +fail (" Failed to destroy domain: %d - %s\n" , + errno,strerror (errno)); +} + +void test_guests (void ) +{ +if ( xen_has_pv ) + { +struct xen_domctl_createdomain c = { + .max_vcpus =1 , + .max_grant_frames =1 , + .grant_opts =XEN_DOMCTL_GRANT_version (1 ), + }; + +printf ("Testing PV guest\n" ); +test_guest (&c); + } + +if ( xen_has_hvm ) + { +struct xen_domctl_createdomain c = { + .flags = XEN_DOMCTL_CDF_hvm, + .max_vcpus =1 , + .max_grant_frames =1 , + .grant_opts =XEN_DOMCTL_GRANT_version (1 ), + .arch = { + .emulation_flags =XEN_X86_EMU_LAPIC , + }, + }; + +if ( physinfo.capabilities & XEN_SYSCTL_PHYSCAP_hap ) + c.flags |= XEN_DOMCTL_CDF_hap; +else if ( !(physinfo.capabilities & XEN_SYSCTL_PHYSCAP_shadow) ) +return fail (" HVM available, but neither HAP nor Shadow\n" ); + +printf ("Testing HVM guest\n" ); +test_guest (&c); + } +} +
tools/tests/common/guests.h new file +11 -0
@@ -0,0 +1,11 @@ +#include <xenctrl.h> +#include <xen/domctl.h> + +extern void test_guest_domid (domid_t domid); +extern xc_interface *xch; +extern xc_physinfo_t physinfo; +extern bool xen_has_pv, xen_has_hvm; + +void test_guest_init (void ); +void test_guest (struct xen_domctl_createdomain *c); +void test_guests (void );
tools/tests/tsx/Makefile +2 -0
@@ -11,4 +11,6 @@ CFLAGS += $(CFLAGS_libxenguest) LDFLAGS += $(LDLIBS_libxenctrl) LDFLAGS += $(LDLIBS_libxenguest) +$(TARGET): ../common/guests.o + include $(XEN_ROOT)/tools/tests/Rules.mk
tools/tests/tsx/test-tsx.c +8 -70
149 lines not on this page · raw message
Signature · 1 line
2.47.3
Re: [PATCH 6/7] tools/tests/tsx: move guest creation to common area
tools/tests/common/guests.c
Quoted 2 lines · Edwin Török
tools/tests/common/guests.c new file +0
-0
Everything in the file uses singular, si I'd suggest to use singular also for the file name.
tools/tests/common/guests.c line 11
Quoted 12 lines
tools/tests/common/guests.c new file +11
-0@@ -0,0 +1,87 @@ +#define _GNU_SOURCE +#include "guests.h" +#include "tests.h" + +#include <err.h> +#include <errno.h> +#include <string.h> + +xc_interface *xch; +xc_physinfo_t physinfo; +bool xen_has_pv = true, xen_has_hvm = true;
static for at least some of these?
Quoted 7 lines
tools/tests/common/guests.c new file +7
-0+void test_guest_init (void ) +{ +int rc; + xch =xc_interface_open (NULL ,NULL ,0 ); + +if ( !xch ) +err (1 ,"xc_interface_open" );
tools/tests/common/guests.c line 29
Quoted 10 lines
tools/tests/common/guests.c new file +10
-0+ + rc =xc_physinfo (xch, &physinfo); +if ( rc ) +err (1 ,"Failed to obtain physinfo" ); + + xen_has_hvm = physinfo.capabilities & XEN_SYSCTL_PHYSCAP_hvm; + xen_has_pv = physinfo.capabilities & XEN_SYSCTL_PHYSCAP_pv; +} + +void test_guest (struct xen_domctl_createdomain *c)
static?
tools/tests/common/guests.c line 34
Quoted 5 lines
tools/tests/common/guests.c new file +5
-0+{ +uint32_t domid =0 ; +int rc; + +if (!xch)
Everything else uses Xen style, so this wants to, too.
tools/tests/common/guests.c line 44
Quoted 10 lines
tools/tests/common/guests.c new file +10
-0+return fail ("test_guest_init() not called" ); + + rc =xc_domain_create (xch, &domid, c); +if ( rc ) +return fail (" Domain create failure: %d - %s\n" , + errno,strerror (errno)); + +printf (" Created d%u\n" , domid); + +test_guest_domid (domid);
This might better be passed as a function pointer, so harnesses can have multiple functions dealing with different aspects of the testing.
Quoted 7 lines
tools/tests/common/guests.c new file +7
-0+ rc =xc_domain_destroy (xch, domid); +if ( rc ) +fail (" Failed to destroy domain: %d - %s\n" , + errno,strerror (errno)); +} + +void test_guests (void )
tools/tests/common/guests.c line 62
Quoted 10 lines
tools/tests/common/guests.c new file +10
-0+{ +if ( xen_has_pv ) + { +struct xen_domctl_createdomain c = { + .max_vcpus =1 , + .max_grant_frames =1 , + .grant_opts =XEN_DOMCTL_GRANT_version (1 ), + }; + +printf ("Testing PV guest\n" );
To easily distinguish things in the output of a harness creating multiple guests, some disambuating string may want passing in.
Quoted 4 lines
tools/tests/common/guests.c new file +4
-0+test_guest (&c); + } + +if ( xen_has_hvm )
tools/tests/common/guests.c line 76
Quoted 10 lines
tools/tests/common/guests.c new file +10
-0+ { +struct xen_domctl_createdomain c = { + .flags = XEN_DOMCTL_CDF_hvm, + .max_vcpus =1 , + .max_grant_frames =1 , + .grant_opts =XEN_DOMCTL_GRANT_version (1 ), + .arch = { + .emulation_flags =XEN_X86_EMU_LAPIC , + }, + };
For starters this may work, but longer term we may need ways to specify certain propertied of the to be created guest(s).
tools/tests/common/guests.h line 4
Quoted 7 lines
tools/tests/common/guests.h new file +4
-0@@ -0,0 +1,11 @@ +#include <xenctrl.h> +#include <xen/domctl.h> + +extern void test_guest_domid (domid_t domid);
Nit: If this was to stay, no need for "extern", just like ...
tools/tests/common/guests.h line 11
Quoted 7 lines
tools/tests/common/guests.h new file +7
-0+extern xc_interface *xch; +extern xc_physinfo_t physinfo; +extern bool xen_has_pv, xen_has_hvm; + +void test_guest_init (void ); +void test_guest (struct xen_domctl_createdomain *c); +void test_guests (void );
... you have none here.
tools/tests/tsx/Makefile CFLAGS += $(CFLAGS_libxenguest) · line 14
Quoted 7 lines
tools/tests/tsx/Makefile +1
-0@@ -11,4 +11,6 @@ CFLAGS += $(CFLAGS_libxenguest) LDFLAGS += $(LDLIBS_libxenctrl) LDFLAGS += $(LDLIBS_libxenguest) +$(TARGET): ../common/guests.o
Does this work properly with parallel builds, once more than one test would use it?
tools/tests/tsx/test-tsx.c line 34
Quoted 7 lines
tools/tests/tsx/test-tsx.c +1
-0@@ -31,6 +31,7 @@#include <xen-tools/common-macros.h> #include "tests.h" +#include "guests.h"
Isn't this ../common/guests.h ? Plus perhaps common stuff could go straight in the parent directory anyway?
Jan
PATCH 7/7 tools/tests: print more debug info
In reply to Edwin TörökEnable xentoollog at XTL_DEBUG level.
--- tools/tests/common/guests.c | 4 +++- tools/tests/tsx/Makefile | 1 + 2 files changed, 4 insertions(+), 1 deletion(-)
tools/tests/common/guests.c +3 -1
@@ -9,11 +9,13 @@xc_interface *xch;xc_physinfo_t physinfo;bool xen_has_pv = true, xen_has_hvm = true; +xentoollog_logger *logger;void test_guest_init (void ) {int rc; - xch =xc_interface_open (NULL ,NULL ,0 ); + logger = (xentoollog_logger *)xtl_createlogger_stdiostream (stderr,XTL_DEBUG ,0 ); + xch =xc_interface_open (logger,NULL ,0 );if ( !xch )err (1 ,"xc_interface_open" );
tools/tests/tsx/Makefile +1 -0
@@ -10,6 +10,7 @@ CFLAGS += $(CFLAGS_libxenguest) LDFLAGS += $(LDLIBS_libxenctrl) LDFLAGS += $(LDLIBS_libxenguest) +LDFLAGS += $(LDLIBS_libxentoollog) $(TARGET): ../common/guests.o
Signature · 1 line
2.47.3
Quoted 24 lines · Edwin Török
There are a lot of duplicate rules and code in
tools/tests.
To simplify writing new tests move common build rules into atools/tests/Rules.mk, and helper macros/functions intocommon/{tests,guests}.{c,h}.This also ensures that CFLAGS are applied consistently across all tests (e.g. one test failed to build now due to an unused variable error).
Guest creation also needs to test for the presence of PV, HVM HAP or HVM shadow support in Xen and create a guest accordingly. This can be shared.
After these changes the per-test
Makefileonly contains entries specific to the test (its name, dependencies, etc.) and avoids having to copy&paste boilerplate code.
tools/tests/x86_emulatorremains unchanged, because theMakefilecontains a lot of conditional build logic specific to that test.An upcoming patch series will introduce new tests using the simplified
Makefileand shared helpers.For convenience this is also available at:
https://gitlab.com/xen-project/people/edwintorok/xen/-/compare/staging...private%2Fedvint%2Fmigration-tests2?from_project_id=2336572
https://gitlab.com/xen-project/people/edwintorok/xen/-/pipelines/2342318716
Quoted 8 lines
Edwin Török (7):
tools/tests/*/Makefile: factor out common PHONY rules into Rules.mktools/tests/vpci/main.c: drop unused variablestools/tests/*/Makefile: factor out build rulestools/tests: factor out common helperstools/tests/common: ensure error messages have a newlinetools/tests/tsx: move guest creation to common areatools/tests: print more debug info
Just fyi that there is also
https://lists.xen.org/archives/html/xen-devel/2026-02/msg00751.html.
Can the two of you maybe work together to have a single resulting approach?
Jan
Quoted 34 lines
tools/tests/Rules.mk | 60 +++++++++++++ tools/tests/common/guests.c | 89 +++++++++++++++++++ tools/tests/common/guests.h | 11 +++ tools/tests/common/tests.c | 15 ++++ tools/tests/common/tests.h | 18 ++++ tools/tests/cpu-policy/Makefile | 41 ++------- tools/tests/cpu-policy/test-cpu-policy.c | 7 +- tools/tests/domid/Makefile | 37 ++------ tools/tests/domid/test-domid.c | 11 +-- tools/tests/mem-claim/Makefile | 31 +------ tools/tests/mem-claim/test-mem-claim.c | 9 +- tools/tests/paging-mempool/Makefile | 31 +------ .../paging-mempool/test-paging-mempool.c | 9 +- tools/tests/pdx/Makefile | 37 +------- tools/tests/pdx/test-pdx.c | 3 +- tools/tests/rangeset/Makefile | 36 +------- tools/tests/rangeset/test-rangeset.c | 3 +- tools/tests/resource/Makefile | 35 +------- tools/tests/resource/test-resource.c | 9 +- tools/tests/tsx/Makefile | 35 +------- tools/tests/tsx/test-tsx.c | 88 +++--------------- tools/tests/vpci/.gitignore | 1 + tools/tests/vpci/Makefile | 36 ++------ tools/tests/vpci/main.c | 6 +- tools/tests/xenstore/Makefile | 37 +------- tools/tests/xenstore/test-xenstore.c | 4 +- 26 files changed, 261 insertions(+), 438 deletions(-) create mode 100644 tools/tests/Rules.mk create mode 100644 tools/tests/common/guests.c create mode 100644 tools/tests/common/guests.h create mode 100644 tools/tests/common/tests.c create mode 100644 tools/tests/common/tests.h create mode 100644 tools/tests/vpci/.gitignore
Quoted 37 lines · Jan Beulich
Quoted 24 lines · Edwin Török
There are a lot of duplicate rules and code in
tools/tests.
To simplify writing new tests move common build rules into atools/tests/Rules.mk, and helper macros/functions intocommon/{tests,guests}.{c,h}.This also ensures that CFLAGS are applied consistently across all tests (e.g. one test failed to build now due to an unused variable error).
Guest creation also needs to test for the presence of PV, HVM HAP or HVM shadow support in Xen and create a guest accordingly. This can be shared.
After these changes the per-test
Makefileonly contains entries specific to the test (its name, dependencies, etc.) and avoids having to copy&paste boilerplate code.
tools/tests/x86_emulatorremains unchanged, because theMakefilecontains a lot of conditional build logic specific to that test.An upcoming patch series will introduce new tests using the simplified
Makefileand shared helpers.For convenience this is also available at:
https://gitlab.com/xen-project/people/edwintorok/xen/-/compare/staging...private%2Fedvint%2Fmigration-tests2?from_project_id=2336572
https://gitlab.com/xen-project/people/edwintorok/xen/-/pipelines/2342318716Quoted 8 lines
Edwin Török (7):
tools/tests/*/Makefile: factor out common PHONY rules into Rules.mktools/tests/vpci/main.c: drop unused variablestools/tests/*/Makefile: factor out build rulestools/tests: factor out common helperstools/tests/common: ensure error messages have a newlinetools/tests/tsx: move guest creation to common areatools/tests: print more debug info
Quoted 5 lines
Just fyi that there is also
https://lists.xen.org/archives/html/xen-devel/2026-02/msg00751.html.
Can the two of you maybe work together to have a single resulting approach?Jan
There is definitely a lot in common between the two series, and I’m talking with Denis. The Makefile cleanups that both of us have done can probably go in first as part of a shared series, I’ll try to setup a combined branch to see how that’d look like.
Best regards,
—Edwin
Quoted 18 lines · Edwin Torok
Quoted 15 lines · Jan Beulich
Quoted 5 lines · Edwin Török
There are a lot of duplicate rules and code in
tools/tests.
To simplify writing new tests move common build rules into atools/tests/Rules.mk, and helper macros/functions intocommon/{tests,guests}.{c,h}.….
Just fyi that there is also
https://lists.xen.org/archives/html/xen-devel/2026-02/msg00751.html.
Can the two of you maybe work together to have a single resulting approach?
Quoted 6 lines
Quoted 1 line
Jan
There is definitely a lot in common between the two series, and I’m talking with Denis. The
Makefilecleanups that both of us have done can probably go in first as part of a shared series, I’ll try to setup a combined branch to see how that’d look like.
I have a combined branch here:
https://gitlab.com/xen-project/people/edwintorok/xen/-/compare/staging...private%2Fedvint%2Fmigration-tests5?from_project_id=2336572
TODO:
* rebase the vPCI Makefile patch on top of this
* there is review feedback for the previous series on the list
Today is my last actual working day at Citrix, and likely next week onward this email address will stop working too.
I intended to finish my pending patch series, unfortunately I ran out of time (I managed to get the ~70+ XAPI+Xen branches down to ~18, but cycling through each series took more time than available). I hope that someone else (e.g. from XenServer) will be able to pick up where I left off and complete these.
I intended to send out the rest of the branches I have as patches, but git send-email or the internal SMTP server stopped working.
Here are some git repositories instead:
* this series: https://gitlab.com/xen-project/people/edwintorok/xen/-/compare/staging...private%2Fedvint%2Fmigration-tests5?from_project_id=2336572
* the migration foreign copy optimizations as a Proof of Concept (~2.5x faster localhost migrations). Don’t use these as is, should be done properly by introducing a separate foreign copy operation, instead of piggy-backing on top of grant-copy as I’ve done here (piggy-backing was useful for measuring the performance optimisation potential, since a lot of the glue code between hypervisor and user space was already there): https://gitlab.com/xen-project/people/edwintorok/xen/-/compare/staging...private%2Fedvint%2Ftests2?from_project_id=2336572
* combined XenServer patch queue + PMU stacktrace (flame graph) + migration foreign copy optimizations https://gitlab.com/xen-project/people/edwintorok/xen/-/compare/staging...guilt%2Fpatches?from_project_id=2336572
* foreign copy Proof of Concept for the kernel (this is a kernel tree in a Xen git repo): https://gitlab.com/xen-project/people/edwintorok/xen/-/commit/ea13155dce8f2f1cfd1a2c54a3f8158be8beed62
I’m not leaving the Xen ecosystem entirely, in my new role I’ll be working on the Unikraft and MirageOS subprojects, instead of the XAPI subproject of Xen (it’ll likely mean a lot less interaction with the hypervisor itself)
Thank you all for all your patience and advice when reviewing patches!
Best regards,
—Edwin