]> xenbits.xensource.com Git - people/liuw/xen.git/commitdiff
x86emul: fix test harness and fuzzer build dependencies
authorJan Beulich <jbeulich@suse.com>
Tue, 10 Sep 2019 14:35:09 +0000 (16:35 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 10 Sep 2019 14:35:09 +0000 (16:35 +0200)
Commit fd35f32b4b ("tools/x86emul: Use struct cpuid_policy in the
userspace test harnesses") didn't account for the dependencies of
cpuid-autogen.h to potentially change between incremental builds. In
particular the harness has a "run" goal which is supposed to be usable
independently of the rest of the tools sub-tree building, and both the
harness and the fuzzer code are also supposed to be buildable
independently. Therefore a re-build of the generated header needs to be
triggered first, which is achieved by introducing a new top-level target
pattern (for just the "run" part for now).

Further cpuid.o did not have any dependencies added for it.

Finally, while at it, add a "run" target to the cpu-policy test harness.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Makefile
tools/fuzz/x86_instruction_emulator/Makefile
tools/tests/cpu-policy/Makefile
tools/tests/x86_emulator/Makefile

index ef1ea44ef1a9f80c8654bdf4ae6cbcbaae378a68..512d6b73c8989921f91a7b3e1382feeaa2edc83a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -80,6 +80,9 @@ build-docs:
 test:
        $(MAKE) -C tools/python test
 
+run-tests-%: build-tools-public-headers tools/tests/%/
+       $(MAKE) -C tools/tests/$* run
+
 # For most targets here,
 #   make COMPONENT-TARGET
 # is implemented, more or less, by
index a55bc789855d5646c0c28d2cdb115e6fbfc63b6f..1a6dbf94e107a2b4b8b5b29d41b9741276b6cdb4 100644 (file)
@@ -26,13 +26,15 @@ GCOV_FLAGS := --coverage
        $(CC) -c $(CFLAGS) $(GCOV_FLAGS) $< -o $@
 
 x86.h := $(addprefix $(XEN_ROOT)/tools/include/xen/asm/,\
-                     x86-vendors.h x86-defns.h msr-index.h)
+                     x86-vendors.h x86-defns.h msr-index.h) \
+         $(addprefix $(XEN_ROOT)/tools/include/xen/lib/x86/, \
+                     cpuid.h cpuid-autogen.h)
 x86_emulate.h := x86-emulate.h x86_emulate/x86_emulate.h $(x86.h)
 
 # x86-emulate.c will be implicit for both
 x86-emulate.o x86-emulate-cov.o: x86_emulate/x86_emulate.c $(x86_emulate.h)
 
-fuzz-emul.o fuzz-emulate-cov.o wrappers.o: $(x86_emulate.h)
+fuzz-emul.o fuzz-emulate-cov.o cpuid.o wrappers.o: $(x86_emulate.h)
 
 x86-insn-fuzzer.a: fuzz-emul.o x86-emulate.o cpuid.o
        $(AR) rc $@ $^
index 07dd58f5c22dbbd971ad5d16908cc53d501a5b99..fb548c9b9ac56643b8ec4db29ba0a4f6fc44a333 100644 (file)
@@ -17,6 +17,10 @@ endif
 .PHONY: all
 all: $(TARGET-y)
 
+.PHONY: run
+run: $(TARGET-y)
+       ./$(TARGET-y)
+
 .PHONY: clean
 clean:
        $(RM) -f -- *.o .*.d .*.d2 test-cpu-policy
index b9312e004491bff0b740db2452ec094cce3ee242..a79f13f3833e77d822fb8178da4a7f4d10714730 100644 (file)
@@ -280,10 +280,12 @@ $(call cc-option-add,HOSTCFLAGS-x86_64,HOSTCC,-no-pie)
 HOSTCFLAGS += $(CFLAGS_xeninclude) -I. $(HOSTCFLAGS-$(XEN_COMPILE_ARCH))
 
 x86.h := $(addprefix $(XEN_ROOT)/tools/include/xen/asm/,\
-                     x86-vendors.h x86-defns.h msr-index.h)
+                     x86-vendors.h x86-defns.h msr-index.h) \
+         $(addprefix $(XEN_ROOT)/tools/include/xen/lib/x86/, \
+                     cpuid.h cpuid-autogen.h)
 x86_emulate.h := x86-emulate.h x86_emulate/x86_emulate.h $(x86.h)
 
-x86-emulate.o test_x86_emulator.o evex-disp8.o wrappers.o: %.o: %.c $(x86_emulate.h)
+x86-emulate.o cpuid.o test_x86_emulator.o evex-disp8.o wrappers.o: %.o: %.c $(x86_emulate.h)
        $(HOSTCC) $(HOSTCFLAGS) -c -g -o $@ $<
 
 x86-emulate.o: x86_emulate/x86_emulate.c