[CRIU] [PATCH 2/2] zdtm: clean a test root before executing tests in userns

Andrey Vagin avagin at openvz.org
Wed Feb 18 13:13:17 PST 2015


A tests is executed from different users in cases with and without
userns, so it can't to open files which were created before.

Here is an example for ns/user/static/inotify_irmap:
13355 mkdir("/etc", 0600)               = -1 EEXIST (File exists)
13355 unlink("/etc/zdtm-test")          = -1 EACCES (Permission denied)
13355 creat("/etc/zdtm-test", 0600)     = -1 EACCES (Permission denied)

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 test/Makefile | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/test/Makefile b/test/Makefile
index 2bfc3c3..cfff0d5 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -25,6 +25,7 @@ zdtm-tst-list: zdtm.sh
 zdtm: zdtm-tst-list .FORCE 
 	$(MAKE) -f Makefile.zdtm zdtm_nons
 	$(MAKE) -f Makefile.zdtm zdtm_ns
+	$(MAKE) clean_root
 	$(MAKE) -f Makefile.zdtm zdtm_ns_user
 
 zdtm-pre-dump: zdtm-tst-list
@@ -44,13 +45,18 @@ fault-injection: .FORCE
 
 override CFLAGS += -D_GNU_SOURCE
 
-clean:
-	$(RM) zdtm_ct zdtm-tst-list
+clean_root:
 	$(Q) $(RM) -r ./lib/
 	$(Q) $(RM) -r ./lib64/
-	$(Q) $(RM) -r ./dump/
 	$(Q) $(RM) -r ./tmp
+	$(Q) $(RM) -r ./etc
+	$(Q) $(RM) -r ./dev
+	$(Q) $(RM) -r ./bin
+
+clean: clean_root
+	$(RM) zdtm_ct zdtm-tst-list
 	$(Q) $(RM) *.log
+	$(Q) $(RM) -r ./dump/
 	$(Q) $(MAKE) -C zdtm cleandep clean cleanout
 	$(Q) $(MAKE) -C libcriu clean
 	$(Q) $(MAKE) -C rpc clean
-- 
1.9.3



More information about the CRIU mailing list