2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 05:18:00 +00:00

1777 Commits

Author SHA1 Message Date
Pavel Emelyanov
5e99d708ca zdtm: test for packet socket mappings
It turned out we didn't have one, though recent 3.19-merge-window
kernel would crash on that test.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
2014-12-22 13:51:36 +03:00
Ruslan Kuprieiev
16a668e5d3 zdtm:tty:vt: add simple test
Inspired by static/console test.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-22 13:48:39 +03:00
Andrey Vagin
dfeccaddf7 zdtm: add a test to check non-root shared bind-mounts
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-22 13:46:42 +03:00
Ruslan Kuprieiev
7dbd38dbc9 zdtm: set additional groups along with uids and gids
Currently zdtm doesn't set additional groups when running
tests. It sets uids and gids to some non-root values, but
additional groups remain untouched, which allows tests
to inherit groups list, which leads to different
behaviour depending on a way you run tests.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-19 19:11:53 +03:00
Cyrill Gorcunov
1349619f83 test: posix_timers -- Don't fail on big @total_sleep_time if migrated, v2
In case if we're migrating to another node where @total_sleep_time
has a big value we might fail here because we don't support tracking
of @total_sleep_time at all, neither we can somehow restore it without
kernel patching (and it's hardly if ever be allowed in vanilla kernel).

Thus simply remember @total_sleep_time value before and after c/r stage
removing it from the computations.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-19 18:52:08 +03:00
Saied Kazemi
54081aff7b tests: Pipe.c Test Program
Hi Saied,

This patch adds your test in the criu test system.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-10 18:52:23 +03:00
Andrey Vagin
e12fd8f98e zdtm/cwd00: avoid resolving an abs path
We may not have permissions for this.

Reported-by: Ruslan Kuprieiev <kupruser@gmail.com>
Cc: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-10 12:57:49 +03:00
Ruslan Kuprieiev
8f71344ce2 zdtm: add ip.dump and ip.rst to gitignore
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-10 12:55:27 +03:00
Oleg Nesterov
0affd5bc19 criu/testing: caps00: don't hang if PR_CAPBSET_DROP fails
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-10 12:42:17 +03:00
Ruslan Kuprieiev
5ecb7b7ccd zdtm: don't forget to remove ip.dump and ip.rst when performing cleanup
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-08 15:45:46 +03:00
Vladimir Davydov
888cae434d zdtm/pty02: never close master before reading slave
We may close the master before reading the slave if the child runs first
when the parent wakes it up using task_waiter_complete. In this case the
subsequent read from the slave will return 0 resulting in a false
positive test failure:

13:23:42.194: 30914: ERR: pty02.c:89: read(slave) failed (errno = 11 (Resource temporarily unavailable))

Fix this by waking the child, which closes the master, only after the
read has been completed.

Also note errno = EAGAIN in the failure report above, which looks really
confusing. Let's print the actual number of bytes read/written along
with the errno while reporting a read/write failure to make the error
reporting clearer in this test.

Signed-off-by: Vladimir Davydov <vdavydov@parallels.com>
Cc: Cyrill Gorcunov <gorcunov@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Acked-by: Cyrill Gorcunov <gorcunov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-08 15:39:58 +03:00
Andrey Vagin
d64a49fdc6 zdtm/maps007: don't use signed values in calculations
maps007 segfaults on i386, because "size" is calculated bigger than allowed.

This occurs when the result of lrand48() * PAGE_SIZE is negative.
In this case the % operation returns a negative value too, what is unexpected.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-08 15:37:18 +03:00
Andrew Vagin
50977c40a4 test: return the iteration number to the end of the test path
When we generate a path to the previous images, we take a directory name
and the previous iteration number.

Reported-by: Mr Jenkins
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-01 14:59:22 +03:00
Andrew Vagin
80ed2f3955 test: clean up pages immediately after restore
We see big load-avarage for the CRIU-iter job, because the host is
writing images for the maps04 test. If we will remove images after retore,
they will live in a page cache. Curretly we collect images for three
iterations and their size is too big to live in a cache.

[root@jenkins workspace]# time bash test/zdtm.sh  -i 3 ns/static/maps04
real	2m23.765s
user	0m0.719s
sys	0m4.006s
[root@jenkins workspace]# time bash test/zdtm.sh -C -i 3 ns/static/maps04
real	1m34.884s
user	0m0.200s
sys	0m4.191s

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-01 13:48:06 +03:00
Andrew Vagin
ef351aba03 test: use an origin test name to generate uniq name for test files
Currently ns/test and test may have the same test directory,
especially if zdtm.sh is executed with --ct.

Reported-by: Mr Jenkins
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-12-01 13:44:38 +03:00
Andrey Vagin
c7fafff448 jenkins: reduce number of jobs for executing tests
32 is too many for our test server

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-11-29 19:33:15 +03:00
vkonyashkin
6678fbb334 zdtm/inotify_system_nodel.c: need to print mask of events for UNKNOWN event
Need to print a mask of events for UNKNOWN event in inotify_system_nodel.c
and inotify_system.c tests. The current error message in this case is too vague:
inotify_system_nodel.c:266: got unexpected event UNKNOWN

Signed-off-by: vkonyashkin <vkonyashkin@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-11-19 13:18:50 +04:00
Andrey Vagin
61b8c9dac3 zdtm: execute mntns_shared_bind* only if mnt_id is in fdinfo
Reported-by: Mr Jenkins
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-11-13 15:53:18 +04:00
Andrey Vagin
f07e25c62b zdtm: add a test to check non-root shared bind-mounts
Here is an example from a fedora container:
65 64 252:0 /vz/private/1 / rw,relatime shared:29 - ext4 /dev/mapper/centos_pcs-root rw,data=ordered
77 65 252:0 /vz/private/1/var/tmp/systemd-httpd.service-XLnJPNc/tmp /var/tmp rw,relatime shared:41 - ext4 /dev/mapper/centos_pcs-root rw,data=ordered

We can see non-root shared mount, which is mounted to the root
mount from the same shared group. The test emulates this situation.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-11-12 12:55:17 +04:00
Andrew Vagin
022094db40 zdtm: typo fix
expr ns/user/static/env00 ns/user
expr: syntax error

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-11-11 20:21:08 +04:00
Pavel Emelyanov
8f937e0461 zdtm: Don't test userns tests if no required APIs found
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-11-11 20:17:57 +04:00
Andrey Vagin
5f7933e3a0 zdtm/fork: create 10 process concurrently
Currently this test creates one process and wait it. So most part of the
time this test has only one process without children.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-11-11 20:14:04 +04:00
Andrey Vagin
b37ce2f118 zdtm: add transition/fork2 in the test list
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-11-11 20:13:55 +04:00
Andrey Vagin
77bdb1828c zdtm: compare file descriptors only for static tests
For other tests set of file descriptors can be changed

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-11-11 20:13:49 +04:00
Andrey Vagin
6bc8b637e5 test: increase permissions for the "test" directory (v2)
Restoring mount namespaces requires to create temporary directories
in a test root.

When tests execute in a new userns, they have non-zero gid and uid,
so we need to grant permissions for them.

v2: add +rx as well

Reported-by: Mr Jenkins
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-11-07 23:50:47 +04:00
Andrey Vagin
f290444655 zdtm: add tests which can be executed in a new user namespace (v2)
Sockets tests are excluded, because SO_RCVBUFFORCE and SO_SNDBUFFORCE
are protected by CAP_NET_ADMIN

tty*, pty* are excluded, because TIOCSLCKTRMIOS protected by
CAP_SYS_ADMIN

*ghost, *notify, *unlink* are excluded, because linkat(AT_EMPTY_PATH)
are protected by CAP_DAC_READ_SEARCH

v2: use a blacklist
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-11-07 17:20:48 +04:00
Andrey Vagin
b109e9ef11 zdtm: add ability to execute tests in another user namespace
v2: don't forget to initialize groups
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-11-07 17:20:21 +04:00
Andrey Vagin
0014a12d96 zdtm: prepare a file tree for userns
Here are two issues:
1. All mounts in a new user namespace are locked, so
we need to create a new root mount. We need to bind-mount root to
itself.
2. /proc and /sys must be mounted before umounting /proc and /sys
which were inhereted. It's a security policy.

"""
Author: Eric W. Biederman <ebiederm@xmission.com>
Date:   Sun Mar 24 14:28:27 2013 -0700

    userns: Restrict when proc and sysfs can be mounted

    Only allow unprivileged mounts of proc and sysfs if they are already
    mounted when the user namespace is created.
"""

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-11-07 17:19:45 +04:00
Andrey Vagin
ed5a1ba122 zdtm: create devices before forking a test process
Devices can not be created in a new user namespace.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-11-07 17:19:36 +04:00
Andrey Vagin
41b972ccbc jenkins: check page-server (v2)
page-server are not tested now. I suggest to add it in the pre-dump job.

v2: execute all tests with and without page server
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-11-06 15:25:07 +04:00
Andrey Vagin
2491da9219 page-xfer: write pidfile from a process which starts a service
When a process, which starts a service, exits, we know that we can
connect to the page server and we expect to find pidfile.

If we create pidfile from a page server process, we have a race window.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-11-05 15:42:50 +04:00
Andrey Vagin
1ca3317edc zdtm: improve checking file descriptors and memory regions (v2)
Now we check them for all test processes

v2: Busybox doesn't have truncate
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Reviewed-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-10-30 15:14:00 +04:00
Cyrill Gorcunov
9da5531c81 test: Add console trivial test
We simply check that major/minor didn't changed after restore.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-10-27 21:35:42 +04:00
Andrey Vagin
deeea1d221 zdtm/socket-tcpbuf: heartbeat should not read all data
Currently we fill as much as posible data in a socket and then use
half of these data to make a flow in the connection.

These data is send and recv buffers. When a connection is dumped and
restored, it needs time to go back to the normal work. In this time we
can reliably fill only send buffers. So at the result the sockets may
contain less data than required for heartbeating and the test will
block.

The test with this patch will monitor actuall size of data in a test
socket.

Cc: Konstantin Neumoin <kneumoin@parallels.com>
Reported-by: Konstantin Neumoin <kneumoin@parallels.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-10-27 21:31:09 +04:00
Andrey Vagin
02d9bd1093 zdtm: check that process w/o file descriptors can be dumped and restored
In addition it checks that criu closes all its descriptors

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-10-27 21:29:21 +04:00
Cyrill Gorcunov
d7865bee7a test: shm -- Make sure SysV memory restored properly
In criu we carry SysV memory via @VMA_AREA_SYSVIPC
attribute but to the test must have a live reference
to real memory area to check that shmem address was
restored correctly. Add it.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-10-27 21:26:45 +04:00
Andrey Vagin
406b6b4237 zdtm: always show errors
Users don't like errors even if criu returns zero.
So I suggest to start looking at them.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-10-23 20:15:11 +04:00
Andrey Vagin
f32fa08d0f zdtm/Makefile: show output for each test
In this case we have another chance to not skip errors.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-10-23 20:13:50 +04:00
Konstantin Neumoin
3ecd7f2d14 zdtm:Makefile increase wait timeout
This timeout is too small for tcp test cases.
This timeout should be bigger than TCP_RTO_MAX 120 seconds

Signed-off-by: Konstantin Neumoin <kneumoin@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-10-23 20:03:21 +04:00
Andrey Vagin
6084e1d08b zdtm/static/xids00: print more information about errors (v2)
v2: typo fix
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-10-23 20:02:29 +04:00
Andrey Vagin
1a3fc94c57 zdtm/maps01: extend maps01
It's bad idea to have only one target object.
In addition I add a shared region to the second process,
which is not mapped in the first.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-10-23 19:57:14 +04:00
Konstantin Neumoin
c4a06a2a26 zdtm/stopped: fix stopped test
The main problem with the
test that it's never 'fail'.
Test can only 'pass' or hangs.

Signed-off-by: Konstantin Neumoin <kneumoin@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-10-09 19:17:59 +04:00
Andrey Vagin
9391034f12 zdtm.sh: don't change owner of a test directory
After changing an owner the current user will not be able to remove or
change the directory. It isn't convenient.

Reported-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-10-07 15:45:35 +04:00
Andrey Vagin
82d509cb48 zdtm: don't execute pipe00 a few times simultaneously
zdtm-pre-dump, zdtm-snapshot, zdtm-iter, zdtm execute pipe00, so
these targets should be executed one by one.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-10-07 15:45:11 +04:00
Nicolas Dichtel
25e1997fde test/zdtm: fix compilation of maps02.c when MADV_DONTDUMP is unknown
Error was:
maps02.c: In function ‘main’:
maps02.c:57:74: error: ‘MADV_DONTDUMP’ undeclared (first use in this function)
maps02.c:57:74: note: each undeclared identifier is reported only once for each function it appears in
make: *** [maps02] Error 1
ERROR: fail to start /home/root/criu/test/zdtm/live/static/maps02

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-10-03 18:57:32 +04:00
Andrey Vagin
f582f16db0 test: expand the default test set
* check page server
* check snapshots
* check a few iterations of dump/restore

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-10-02 14:58:37 +04:00
Andrey Vagin
6694403214 zdtm/tempfs: set mode for O_CREAT
man 2 open:
"""
mode specifies the permissions to use in case a new file is cre‐
ated.  This argument must be supplied when O_CREAT or O_TMPFILE
is specified in flags;
"""

Cc: Konstantin Neumoin <kneumoin@parallels.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-09-30 21:55:01 +04:00
Andrey Vagin
c7390d2d3f zdtm/cwd01: don't forget to set '\0' after readlink()
Reported-by: Konstantin Neumoin <kneumoin@parallels.com>
Cc: Konstantin Neumoin <kneumoin@parallels.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-09-30 21:54:34 +04:00
Ruslan Kuprieiev
3b2ab35bc8 test: rpc: test page-server
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-09-22 16:30:48 +04:00
Andrey Vagin
eda6b3d002 zdtm: don't call mount_cgroups a few times concurrently
Here is a race now:
./zdtm.sh --ct -d -C -x static/cgroup02 ns/static/pipe02 &> ns_static_pipe02.log || \
{ flock Makefile cat ns_static_pipe02.log; exit 1; }
./zdtm.sh --ct -d -C -x static/cgroup02 ns/static/busyloop00 &> ns_static_busyloop00.log || \
{ flock Makefile cat ns_static_busyloop00.log; exit 1; }
make[3]: `zdtm_ct' is up to date.
mkdir: cannot create directory ‘zdtm.GgIjUS/holder’: File exists

Reported-by: Mr Jenkins
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-09-22 12:15:45 +04:00