[CRIU] [PATCH] zdtm: autodetect the target machine v2

Alexander Kartashov alekskartashov at parallels.com
Thu Jan 24 01:12:35 EST 2013


Andrew Vagin pointed out that the static testsuite compilation
may run as standalone so the variable ARCH won't be available.

This patch introduces the facility test/zdtm/Makefile.inc
designated to detect the target machine automatically
if the variable ARCH isn't defined. This makefile is supposed
to be included into all test subsuite Makefiles.

Andrew Vagin also pointed out that machine-dependent tests
may be added into non-static subsuites as well so the macro
adding machine-specific headers into CPPFLAGS goes to
the file test/zdtm/Makefile.inc.

Signed-off-by: Alexander Kartashov <alekskartashov at parallels.com>

---
Differences between v0 and v2:

* Set ARCH to x86 while compiling for i386 as proposed by
  Andrew Vagin.

---
 test/zdtm/Makefile.inc             |   20 ++++++++++++++++++++
 test/zdtm/lib/Makefile             |    2 ++
 test/zdtm/live/static/Makefile     |    4 +++-
 test/zdtm/live/streaming/Makefile  |    2 ++
 test/zdtm/live/transition/Makefile |    2 ++
 5 files changed, 29 insertions(+), 1 deletion(-)
 create mode 100644 test/zdtm/Makefile.inc

diff --git a/test/zdtm/Makefile.inc b/test/zdtm/Makefile.inc
new file mode 100644
index 0000000..1884050
--- /dev/null
+++ b/test/zdtm/Makefile.inc
@@ -0,0 +1,20 @@
+ARCH ?= $(shell uname -m | sed		\
+		-e s/i.86/i386/		\
+		-e s/sun4u/sparc64/	\
+		-e s/arm.*/arm/		\
+		-e s/sa110/arm/		\
+		-e s/s390x/s390/	\
+		-e s/parisc64/parisc/	\
+		-e s/ppc.*/powerpc/	\
+		-e s/mips.*/mips/	\
+		-e s/sh[234].*/sh/)
+
+ifeq ($(ARCH),i386)
+	ARCH := x86
+endif
+
+ifeq ($(ARCH),x86_64)
+	ARCH := x86
+endif
+
+CPPFLAGS += -iquote $(LIBDIR)/arch/$(ARCH)/include
diff --git a/test/zdtm/lib/Makefile b/test/zdtm/lib/Makefile
index 52dba16..350deb3 100644
--- a/test/zdtm/lib/Makefile
+++ b/test/zdtm/lib/Makefile
@@ -1,3 +1,5 @@
+include ../Makefile.inc
+
 CFLAGS	= -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
 
 LIB	= libzdtmtst.a
diff --git a/test/zdtm/live/static/Makefile b/test/zdtm/live/static/Makefile
index 194930b..7a8bcad 100644
--- a/test/zdtm/live/static/Makefile
+++ b/test/zdtm/live/static/Makefile
@@ -1,6 +1,8 @@
+include ../../Makefile.inc
+
 LIBDIR	= ../../lib
 LIB	= $(LIBDIR)/libzdtmtst.a
-override CPPFLAGS += -I$(LIBDIR) -iquote $(LIBDIR)/arch/$(ARCH)/include
+override CPPFLAGS += -I$(LIBDIR)
 CFLAGS	= -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
 
 TST_NOFILE	=				\
diff --git a/test/zdtm/live/streaming/Makefile b/test/zdtm/live/streaming/Makefile
index ad110ad..dfc4919 100644
--- a/test/zdtm/live/streaming/Makefile
+++ b/test/zdtm/live/streaming/Makefile
@@ -1,3 +1,5 @@
+include ../../Makefile.inc
+
 LIBDIR	= ../../lib
 LIB	= $(LIBDIR)/libzdtmtst.a
 override CPPFLAGS += -I$(LIBDIR)
diff --git a/test/zdtm/live/transition/Makefile b/test/zdtm/live/transition/Makefile
index 9b6f740..99db336 100644
--- a/test/zdtm/live/transition/Makefile
+++ b/test/zdtm/live/transition/Makefile
@@ -1,3 +1,5 @@
+include ../../Makefile.inc
+
 LIBDIR	= ../../lib
 LIB	= $(LIBDIR)/libzdtmtst.a
 override CPPFLAGS += -I$(LIBDIR)
-- 
1.7.10.4



More information about the CRIU mailing list