[CRIU] [PATCH 3/3] test: zdtm -- Add proc-self test

Andrew Vagin avagin at parallels.com
Tue Apr 30 05:29:12 EDT 2013


On Tue, Apr 30, 2013 at 01:03:51AM +0400, Cyrill Gorcunov wrote:
> On Tue, Apr 30, 2013 at 12:48:47AM +0400, Andrew Vagin wrote:
> > This test case should be added in the test list for regular execution.
> > Look at zdtm.sh
> > 
> > Do you try to execute zdtm.sh ns/static/proc-self?
> 
> Sure, it works well. Andrew, I want to make some improved version.
> so this series is rfc for now, not to merge.

make -j 8 -C test/ zdtm_ns

./proc-self --pidfile=proc-self.pid --outfile=proc-self.out
make[1]: Leaving directory `/tmp/crtools-root.UWIsxo/zdtm/live/static'
  PID TTY          TIME CMD
13177 ?        00:00:00 proc-self
Dump 13177
WARNING: process proc-self is left running for your debugging needs
Test: zdtm/live/static/proc-self
====================== ERROR ======================
Dump log   : /root/crtools/test/dump/proc-self/13177/1/dump.log
(00.051785) Error (files-reg.c:329): Can't create link remap for
net:[4026532175]. Use link-remap option.
(00.051812) Error (cr-dump.c:1454): Dump files (pid: 13192) failed with
-1
(00.053304) Error (cr-dump.c:1649): Dumping FAILED.

This test case checks that an inode number is not changed, but here is a
race condition.


diff --git a/test/zdtm.sh b/test/zdtm.sh
index f7d908c..0b8bde6 100755
--- a/test/zdtm.sh
+++ b/test/zdtm.sh
@@ -87,6 +87,7 @@ static/file_locks00
 static/file_locks01
 static/sigpending
 static/sk-netlink
+static/proc-self
 "
 # Duplicate list with ns/ prefix
 TEST_LIST=$TEST_LIST$(echo $TEST_LIST | tr ' ' '\n' | sed 's#^#ns/#')

> 
> > > +
> > > +int read_fd_link(int lfd, char *buf, size_t size)
> > > +{
> > > +	ssize_t ret;
> > > +	char t[32];
> > > +
> > > +	snprintf(t, sizeof(t), "/proc/self/fd/%d", lfd);
> > > +	ret = readlink(t, buf, size);
> > 
> > size -1, the last one is used for a null byte.
> 
> yup, thanks!
> 
> 	Cyrill


More information about the CRIU mailing list