[CRIU] [RFC PATCHv2 14/32] zdtm: Makefile: separate test launch and cmdline generation phases

Ivan Shapovalov intelfx at intelfx.name
Sat Mar 12 00:42:13 PST 2016


this adds overhead and is more fragile, but is needed for multi-test launcher
(if we want to keep it flexible and avoid hardcoding suffixes/pathes in tests).

Signed-off-by: Ivan Shapovalov <intelfx at intelfx.name>
---
 test/zdtm/Makefile.inc    |  3 +++
 test/zdtm/Makefile.live   | 18 ++++++++++--------
 test/zdtm/static/Makefile | 24 +++++++++++-------------
 3 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/test/zdtm/Makefile.inc b/test/zdtm/Makefile.inc
index 0d8fe23..70828fe 100644
--- a/test/zdtm/Makefile.inc
+++ b/test/zdtm/Makefile.inc
@@ -32,3 +32,6 @@ endif
 RM := rm -f --one-file-system
 
 export E Q RM
+
+# to avoid un-dry-running lines mentioning $(MAKE)
+make = $(MAKE)
diff --git a/test/zdtm/Makefile.live b/test/zdtm/Makefile.live
index 8932c26..e041d4f 100644
--- a/test/zdtm/Makefile.live
+++ b/test/zdtm/Makefile.live
@@ -24,17 +24,19 @@ all:	$(TST)
 install: all
 .PHONY: all install
 
-$(TST_NOFILE:%=%.pid):	%.pid:	%
-	$(<D)/$(<F) --pidfile=$@ --outfile=$<.out
+%.args-global:
+	@echo --pidfile=$(basename $@).pid --outfile=$(basename $@).out
 
-$(TST_FILE:%=%.pid):	%.pid:	%
-	$(<D)/$(<F) --pidfile=$@ --outfile=$<.out --filename=$<.test
+$(TST_NOFILE:%=%.args)::
 
-$(TST_DIR:%=%.pid):	%.pid:	%
-	$(<D)/$(<F) --pidfile=$@ --outfile=$<.out --dirname=$<.test
+$(TST_FILE:%=%.args)::
+	@echo --filename=$(basename $@).test
 
-$(TST_DIR_FILE:%=%.pid):	%.pid:	%
-	$(<D)/$(<F) --pidfile=$@ --outfile=$<.out --dirname=$<.dir.test --filename=$<.test
+$(TST_DIR:%=%.args)::
+	@echo --dirname=$(basename $@).test.dir
+
+%.pid: %
+	$(<D)/$(<F) $(shell $(make) -s $<.args-global $<.args)
 
 %.out: %.pid %
 	-kill -TERM `cat $<`
diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile
index 21fb6a8..a1552c4 100644
--- a/test/zdtm/static/Makefile
+++ b/test/zdtm/static/Makefile
@@ -187,6 +187,8 @@ TST_FILE	=				\
 		netns-nf			\
 		maps_file_prot			\
 		socket_close_data01		\
+		chroot				\
+		chroot-file			\
 
 TST_DIR		=				\
 		cwd00				\
@@ -224,10 +226,8 @@ TST_DIR		=				\
 		mntns_deleted			\
 		binfmt_misc			\
 		unlink_regular00		\
-
-TST_DIR_FILE	=				\
 		chroot				\
-		chroot-file
+		chroot-file			\
 
 TST_OTHER	=				\
 		env00				\
@@ -245,16 +245,14 @@ all: criu-rtc.so
 inotify_system_nodel.c: inotify_system.c
 	ln -sf inotify_system.c inotify_system_nodel.c
 
-cmdlinenv00.pid: cmdlinenv00
-	$(<D)/$(<F) --pidfile=$@ --outfile=$<.out --arg1=arg1 --arg2=arg2 --arg3=arg3
-
-env00.pid:	env00
-	$(<D)/$(<F) --pidfile=$@ --outfile=$<.out --envname=ENV_00_TEST
-umask00.pid:	umask00
-	$(<D)/$(<F) --pidfile=$@ --outfile=$<.out --mask=0345
-
-fifo-rowo-pair.pid: fifo-rowo-pair
-	$(<D)/$(<F) --pidfile=$@ --outfile=$<.out --name_master=$<.master.test --name_slave=$<.slave.test
+cmdlinenv00.args:
+	@echo --arg1=arg1 --arg2=arg2 --arg3=arg3
+env00.args:
+	@echo --envname=ENV_00_TEST
+umask00.args:
+	@echo --mask=0345
+fifo-rowo-pair.args:
+	@echo --name_master=$(basename $@).master.test --name_slave=$(basename $@).slave.test
 
 aio00:			override LDLIBS += -laio
 different_creds:	override LDLIBS += -lcap
-- 
2.7.2



More information about the CRIU mailing list