tests/cpu-policy: Skip building on older versions of GCC
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 24 May 2019 13:14:17 +0000 (14:14 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 24 May 2019 16:50:57 +0000 (17:50 +0100)
GCC 4.4 (as included in CentOS 6) is too old to handle designated initialisers
in anonymous unions.  As this is just a developer tool, skip the test in this
case, rather than sacraficing the legibility/expresibility of the test cases.

This fixes the Gitlab CI tests.

While adding this logic to cpu-polcy, adjust the equivelent logic from
x86_emulator on which this was based.  Printing:

  Test harness not built, use newer compiler than "gcc"

isn't helpful for anyone unexpectedly encountering the error.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
tools/tests/cpu-policy/Makefile
tools/tests/x86_emulator/Makefile

index eeed7f3da788c47a0825b74d78fee652c298f706..07dd58f5c22dbbd971ad5d16908cc53d501a5b99 100644 (file)
@@ -1,8 +1,21 @@
 XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
+TARGET-y := 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 ($(clang),y)
+TARGET-$(call cc-ver,$(CC),lt,0x040600) :=
+endif
+
+ifeq ($(TARGET-y),)
+$(warning Test harness not built, use newer compiler than "$(CC)" (version $(shell $(CC) -dumpversion)))
+endif
+
 .PHONY: all
-all: test-cpu-policy
+all: $(TARGET-y)
 
 .PHONY: clean
 clean:
index 4f4c0f603449e330241e868f64939fb4267e51a5..175cebc0953e2ce309b690e1aa02e9cd18af446f 100644 (file)
@@ -97,7 +97,7 @@ $(foreach flavor,$(SIMD) $(FMA),$(eval $(call simd-check-cc,$(flavor))))
 TARGET-$(shell echo 'asm("{evex} vzeroall");' | $(CC) -x c -c -o /dev/null - || echo y) :=
 
 ifeq ($(TARGET-y),)
-$(warning Test harness not built, use newer compiler than "$(CC)")
+$(warning Test harness not built, use newer compiler than "$(CC)" (version $(shell $(CC) -dumpversion)) and an "{evex}" capable assembler)
 endif
 
 all: $(TARGET-y)