Due to an existing bug #1771 we can't run anything we build so we have
to suppress the normal multiarch build. As we can't have duplicate
build rules we need to copy the bits we need from the normal multiarch
Makefile so we can redefine all the run-% rules.
For signals and vma-pthread they also need slightly different LDFLAGS
to link to the atomic support library.
Signed-off-by: Alex Bennée <alex.bennee(a)linaro.org>
---
tests/tcg/Makefile.target | 9 ++++---
tests/tcg/sparc/Makefile.target | 45 +++++++++++++++++++++++++++++++++
2 files changed, 50 insertions(+), 4 deletions(-)
create mode 100644 tests/tcg/sparc/Makefile.target
diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target
index af68f11664..8bcafaaf7b 100644
--- a/tests/tcg/Makefile.target
+++ b/tests/tcg/Makefile.target
@@ -103,9 +103,10 @@ ifeq ($(filter %-softmmu, $(TARGET)),)
# then the target. If there are common tests shared between
# sub-targets (e.g. ARM & AArch64) then it is up to
# $(TARGET_NAME)/Makefile.target to include the common parent
-# architecture in its VPATH. However some targets are so minimal we
-# can't even build the multiarch tests.
-ifneq ($(filter $(TARGET_NAME),aarch64_be),)
+# architecture in its VPATH. However some targets are so
+# minimal/broken just include directly and skip the common multiarch
+# tests Makefile.
+ifeq ($(filter $(TARGET_NAME),aarch64_be sparc),$(TARGET_NAME))
-include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.target
else
-include $(SRC_PATH)/tests/tcg/multiarch/Makefile.target
@@ -147,7 +148,7 @@ all: $(TESTS) $(EXTRA_TESTS)
RUN_TESTS=$(patsubst %,run-%, $(TESTS))
# If plugins exist also include those in the tests
-ifeq ($(CONFIG_PLUGIN),y)
+ifeq ($(CONFIG_PLUGIN)$(SKIP_PLUGIN_TESTS),y)
PLUGIN_SRC=$(SRC_PATH)/tests/tcg/plugins
PLUGIN_LIB=../plugins
VPATH+=$(PLUGIN_LIB)
diff --git a/tests/tcg/sparc/Makefile.target b/tests/tcg/sparc/Makefile.target
new file mode 100644
index 0000000000..0b5f9e8b2d
--- /dev/null
+++ b/tests/tcg/sparc/Makefile.target
@@ -0,0 +1,45 @@
+# -*- Mode: makefile -*-
+#
+# For Sparc we only have multiarch tests - however as everything is
+# currently broken we have to duplicate the bits needed from the
+# multiarch makefile. This can be removed if we ever get running again
+# (or we deprecate the target).
+#
+
+# Compressed copy of tests/tcg/multiarch/Makefile.target
+MULTIARCH_SRC=$(SRC_PATH)/tests/tcg/multiarch
+VPATH += $(MULTIARCH_SRC)
+MULTIARCH_SRCS = $(notdir $(wildcard $(MULTIARCH_SRC)/*.c))
+ifeq ($(filter %-linux-user, $(TARGET)),$(TARGET))
+VPATH += $(MULTIARCH_SRC)/linux
+MULTIARCH_SRCS += $(notdir $(wildcard $(MULTIARCH_SRC)/linux/*.c))
+endif
+MULTIARCH_TESTS = $(MULTIARCH_SRCS:.c=)
+
+float_%: LDFLAGS+=-lm
+float_%: float_%.c libs/float_helpers.c
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< $(MULTIARCH_SRC)/libs/float_helpers.c -o $@
$(LDFLAGS)
+
+fnmsub: LDFLAGS+=-lm
+testthread: LDFLAGS+=-lpthread
+threadcount: LDFLAGS+=-lpthread
+munmap-pthread: CFLAGS+=-pthread
+munmap-pthread: LDFLAGS+=-pthread
+sigreturn-sigmask: CFLAGS+=-pthread
+sigreturn-sigmask: LDFLAGS+=-pthread
+sha1: CFLAGS+=-Wno-stringop-overread -Wno-unknown-warning-option
+
+TESTS += $(MULTIARCH_TESTS)
+# End of copy of multiarch/Makefile.target
+
+# atomic primitives used by these tests need -latomic
+signals: LDFLAGS+=-lrt -lpthread -latomic
+vma-pthread: CFLAGS+=-pthread
+vma-pthread: LDFLAGS+=-pthread -latomic
+
+# all tests currently broken due to broken CASA
+run-%:
+ $(call skip-test, $*, "CASA is broken (see bug #1771)")
+
+# we can't even think about plugin tests yet
+SKIP_PLUGIN_TESTS=y
--
2.47.2