zdtm.sh copies all required libraries in a new root
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
A test will be executed in new set of namespaces if the environment
variable ZDTM_NEWNS is set. A pid of the root task will be written in
$ZDTM_PIDFILE and a root fyle system will be changed on $ZDTM_ROOT.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
When dumping a tmpfs mount we need to take its contents with us.
So, use tar for it and put it into the image dir.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Binfmt is global fs. We could check for its inhabitants intersect on
source and destination, but for the 1st time it's enough just to check
this one being empty.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
"init" in LXC opens /dev/null and then mounts devtmpfs in /dev,
so crtools can not resolve the path to the origin /dev/null.
crtools with the option --evasive-devices will check the origin
device and a new device are the same and if it's true, crtools will
dump a new path.
v2: add a description for the option
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
When a child exited, SIGCHLD is sent to parent,
if SIGCHLD has handler without SA_RESTART, the current
syscall will be interrupted.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
It's not in zdtm.sh yet, since kernel patch is not yet
committed. When kernel is updated, the zdtm.sh will be too.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
A part of code has been copied from mountpoints.c
This code umounts all points except /proc and /
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
We need to check that opened files can be restored in mntns
[xemul: s/slabinfo/meminfo as in 9dc050fd]
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Otherwise a parent hangs if a child died, because
it reads from a status pipe.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Before this patch we use pidof to get a pid of a test process.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
The patch allows define CLONE_NEWIPC for redhat-el5.
Signed-off-by: Victor Konyashkin <vkonyashkin@parallels.com>
Acked-by: Andrey Wagin <avagin@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
The patch allows define CLONE_NEWPID for redhat-el5 to avoid error:
test_init.c:114: error: 'CLONE_NEWPID' undeclared (first use in this function)
Signed-off-by: Victor Konyashkin <vkonyashkin@parallels.com>
Acked-by: Andrey Wagin <avagin@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
The -Wno-unused-result option looks to have been introduced in GCC 4.5.0.
So it's need turn off FORTIFY_SOURCE (compiler warn about unused results
in fortification mode) instead of use -Wno-unused-result to avoid error
in versions prior to 4.5.0.
Signed-off-by: Victor Konyashkin <vkonyashkin@parallels.com>
Acked-by: Andrey Wagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Kernel can't suspend container by design if calls clock_gettime()
in a loop, so we need to sleep between clock_gettime().
Signed-off-by: Victor Konyashkin <vkonyashkin@parallels.com>
Acked-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
debugfs isn't virtualized and never will be
jira #PCLIN-31059
Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Acked-by: Andrey Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This makes tests that finish some time run smoother -- no tons of Waiting... messages
on the screen
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Address Andrew's comments
- use TEST_VALUE macro instead of open coded value
- use WIFx macros for child status testing
- kill child/parent on error
Note that it was not clear from an initiall patch
change log -- the difference between fifo_wronly
test case and this one is that we use fork() call
here which allow us to make sure that fifo restoration
code logic will be tested more widely.
Basically the flowchart of the test case:
parent child
------ -----
open RW fifo (slave)
open RO fifo (master)
open WO fifo (master)
dup parent slave to slave1
... waiting c/r to happen ...
... waking up from c/r ...
send bytes to master
send bytes to slave1
finish
... initiating c/r ...
... waking up from c/r ...
read bytes from master
read bytes from slave
PASS :D
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
A process tree is described in the array. New cases are easy for adding.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
We can't reuse it from crtools, because zdtm is used separately.
v2 syscall() returns an error code in errno.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
I need a special test case where fake
fifo will be created by us to restore
the former.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
It may occur that the loop spins faster than clock ticks.
Signed-off-by: Evgeny Antyshev <eantyshev@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
expr prints a substing length. This patch redirects output of expr to /dev/null
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
It requered 1m19s for executing all tests.
Now it requires 38s.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Sometime we need sync points in testee program flow,
for this reason task_waiter_ introduced.
The call semantics is the following
Parent Child
------ -----
task_waiter_init
task_waiter_wait4
task_waiter_complete
task_waiter_wait4
task_waiter_complete
...
Thus initially task_waiter_init should be called
to initialize all internals guts needed.
Then one become waitee and calls for task_waiter_wait4,
where lockid should be provided as an argument. Since
it should be unique values the best option might be
gettid().
The same applies to a waiter side -- it should call
for task_waiter_complete and provide a lockid.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrey Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Test with sysfs and proc as no other fs-s are currently supported.
Will be fixed later.
Note, that the original /proc mount is kept as the dumping code requires
it for reading pagemap file with RSS info. Worth fixing it some day?
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
* check, that pseudoterminals are restored
* check, that a control terminal is restred
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
to require dumping pid namespace. Dump and restore will be failed if
a tress doesn't contain a process init.
pid namespace will be created implicitly if a process init in the tree.
v2: fix comments from Pavel
v3: Restore of pidns should be approved by user
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>