test chroot and chdir restoration
PATCH 1/1 test chroot and chdir restoration
One testcase ensures that cwd is restore and chroot is not wrongly set. The second ensure that a container with a child task which is chrooted, when restored, is restored with the child task chrooted.
The third testcase tries to restore a container which was itself chrooted. This fails, as it is up to userspace to make sure that the container is restarted in the right place. One way to do this is with the
restart -r chroot_dir < ckpt
option.
(The third testcase does not by default run)
Signed-off-by Serge Hallyn <serue-r/[email protected]>
--- Makefile | 2 +- runall.sh | 6 ++ taskfs/Makefile | 16 +++++ taskfs/README | 1 + taskfs/chrootsleep.c | 55 ++++++++++++++++ taskfs/cwdsleep.c | 43 +++++++++++++ taskfs/runtest.sh | 170 ++++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 292 insertions(+), 1 deletions(-) create mode 100644 taskfs/Makefile create mode 100644 taskfs/README create mode 100644 taskfs/chrootsleep.c create mode 100644 taskfs/cwdsleep.c create mode 100755 taskfs/runtest.sh
Makefile +1 -1
@@ -1,5 +1,5 @@ SUBDIRS = libcrtest counterloop fileio simple userns ipc sleep \ - process-tree futex epoll + process-tree futex epoll taskfs targets = ns_exec mysu
runall.sh +6 -0
@@ -97,5 +97,11 @@ bash runtests.sh update_totals $? popd +echo Running cwd/chroot tests +pushd taskfs +bash runtest.sh +update_totals $? +popd + echo $passed out of $total test groups passed. exit 0
taskfs/Makefile new file +16 -0
@@ -0,0 +1,16 @@ +targets = cwdsleep chrootsleep + +all: $(targets) + +SLIBS = ../libcrtest/libcrtest.a +LIBCMD = -I../libcrtest -L../libcrtest $(SLIBS) + +cwdsleep: cwdsleep.c $(SLIBS) + gcc -static -o cwdsleep cwdsleep.c $(LIBCMD) + +chrootsleep: chrootsleep.c $(SLIBS) + gcc -static -o chrootsleep chrootsleep.c $(LIBCMD) + +clean: + rm -f $(targets) + rm -rf cr_taskfs*
taskfs/README new file +1 -0
@@ -0,0 +1 @@ +test cwd and chroot
taskfs/chrootsleep.c new file +55 -0
55 lines not on this page · raw message
taskfs/cwdsleep.c new file +43 -0
43 lines not on this page · raw message
taskfs/runtest.sh new file +170 -0
170 lines not on this page · raw message
Signature · 1 line
1.6.4.4