This test set up two posix timers with different clocks: REALTIME and
MONOTONIC.
Both send signals.
Signals are disabled before suspend. This makes overrun counters increasing.
After restore tests enables signals, and make sure, that:
1) signal handler for both timers was called with proper arguments
2) time displacement for both timers is not greater than specified (10% by
default).
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Acked-by: Vladimir Davydov <VDavydov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
A test allocates and filles one page, creates a new child, then
compares pfn-s for both processes.
v2: set a position on each iteration
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Test pty03 is not yet ready for ns, will be addressed later.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
In case if we enter the new rootfs don't forget to
mount devpts, otherwise ttys can't be connected.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
We don't need to umount each points one by one,
if we are goning to do pivot_root().
"""
pivot_root moves the root file system of the current process to the
directory put_old and makes new_root the new root file system.
"""
So I suggest to do pivot_root() and then detach the old root, all
other mount points will be unmounted automatically.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
It's need add format to fprintf to avoid following error in Ubuntu 12.04:
msg.c:59:2: error: format not a string literal and no format arguments [-Werror=format-security]
Signed-off-by: Victor Konyashkin <vkonyashkin@parallels.com>
Acked-by: Andrey Vagin <avagin@openvz.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
If a socket queue doesn't have a free space, a error should be returned,
because nobody reads this socket.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
By default crtools shouldn't modify the environment, except for
killing the dumped tasks. The link remap does so and should sit
under explicit cmdline option.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
network-script.sh is used for locking and unlocking network in CT.
Here is an example of an LXC config:
lxc.console=none
lxc.utsname = test-lxc
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.network.name = eth0
lxc.mount = /root/test-lxc/etc/fstab
lxc.rootfs = /root/test-lxc-root/
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Until I figure out how to make them work in ns.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Testcase: fork child, chdir into /proc/$pid and kill child.
test for http://bugzilla.openvz.org/show_bug.cgi?id=2315
Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Acked-by: Andrey Wagin <avagin@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Redirect standard descriptors of a test init process in to the log file.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
It was lost for tests which executed in a new namespaces.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
The test creates two processes.
A first process creates a tcp server, a second one connects to it.
The first process is dumped and restored.
Then the test checks that the TCP connection is alive.
v2: fix compilation :)
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Non-opened control terminal
* Set a control terminal
* Close a file descriptor on it
* Dump/restore
* Open the control terminal (/dev/tty)
* Check, that it connected to the master end
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
The test is tricky -- it opens master in task 1
and dup it in task 2, then close in task 1 and
do C/R.
Thus we need to setup SID of master terminal
somehow in children, which usually fails in
currnt tty restore implementation.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Before we checked only one connection.
With this patch the test reproduces a bug:
Error (sk-unix.c:395): BUG at sk-unix.c:395
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
`< $FILE` isn't posix compatible and doesn't work in dash
Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Acked-by: Andrey Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
fix obvious bashisms to make script more portable
Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Acked-by: Andrey Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Linux has it since v3.2
cc -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -I../../lib packet_sock.c ../../lib/libzdtmtst.a -o packet_sock
packet_sock.c:70:8: error: redefinition of ‘struct tpacket_req3’
In file included from packet_sock.c:23:0:
/usr/include/linux/if_packet.h:245:8: note: originally defined here
Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
On some systems PAGE_SIZE is declared as sysconf(_SC_PAGESIZE) in <sys/user.h>
this is non-constant expression, so it cannot be used in type declarations.
cc -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -c -o ns.o ns.c
ns.c:124:7: error: variably modified ‘stack’ at file scope
Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
cc -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -c -o msg.o msg.c
msg.c: In function ‘test_msg’:
msg.c:40:6: error: variable ‘len’ set but not used [-Werror=unused-but-set-variable]
Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
A few test check restoring of file descriptors to a one file struct.
Here is better to check, that a few file struct can be linked to one unlinked file.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
The problem is to get a virtual pid for zombies.
This code gets two list of children from current and target pidns.
Then it removes alive task from the second list and dumps remaining zombies.
A procfs from a target pidns is needed for dumping zombies,
crtools gets it from parasite code.
v2: Fix comment and get proc fd from a root task
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
pthread00 hangs if dprintf is used, and works well if fprintf is used.
One more mention of this bug is here:
http://sourceware.org/bugzilla/show_bug.cgi?id=12847
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
I added this options and I found, that it was a bad idea.
Currently crtools prints PID for each message, so
--log-pid can help if an error in the restorer code.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This tests passed already, so add them in the regular list.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
So try to check on extra descriptors a few times
v2: move save_fds in a loop
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
It will be used for checking tcp connections, external unix sockets, etc
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
* Delete internal buffer, all data are written immediately in a log file
* Add timestamp and pid in a message
* All processes write log messages in one file
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Now we can at least look into images manually to check how
rings are dumped. Later we should write an auto test.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
The implementation is rather straightforward. One thing to note
is that non-single membership of each type is not supported. It
can be done, but I'm unaware of any software doing so.
Note: the pb show routine should be tuned to support showing bytes.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>