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

1473 Commits

Author SHA1 Message Date
Pavel Emelyanov
38e4a01dfd zdtm.py: Add minimal support for CRIU RPC testing
As RPC server the swrk mode is used which, in turn, is easily used
by nice lib/py/criu.py thingie from Ruslan.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-09-06 19:31:21 +03:00
Pavel Emelyanov
983f54f615 zdtm.py: Substract criu_cli from criu
Now we have a single place that is really about calling criu
as CLI tool inside this class, so pull one out as a preparation
to having RPC support.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-09-06 19:31:21 +03:00
Pavel Emelyanov
57699ee08a zdtm.py: s/criu_cli/criu/
In the criu_cli class there's the whole bunch of useful code which
not CLI-specific, so drop the _cli suffix.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-09-06 19:31:21 +03:00
Andrei Vagin
d43fff4d74 zdtm: remove *.opts files
This files are used by zdtm.sh. zdtm.py uses *.desc files.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-09-06 19:31:21 +03:00
Eugene Batalov
40a7f3854f test: fix race in transition/maps008 that lead to fail of test
Running test/zdtm.py run -t zdtm/transition/maps008 --snap --pre 30
in a loop I got test failure with "Mem differs"
error each ~20 minutes. The cause of the bug is in lack of
synchronization between processes that still do datagen stage of
test and processes that already do datacheck stage of test.
As a result we can get "Mem differs" error if:
1. Process P1 being on datacheck stage fetches a byte with
   offset X from ashmem vma VMA1 into CPU register.
2. Process P2 still being on datagen stage changes byte with offset X
   in the same ashmem vma VMA1.
3. Process P1 fetches byte with offset X from another ashmem vma VMA2
   mapped to the same physical memory as VMA1.
4. Process P1 compares two fetched bytes and finds out that they
   have different values.
5. Process P1 reports "Mem differs" error.

Race is fixed by waiting for all processes to exit datagen stage
before proceeding to datacheck stage.

Signed-off-by: Eugene Batalov <eabatalov89@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-09-06 19:31:20 +03:00
Andrei Vagin
42058dc7ce test: don't do MS_REC|MS_PRIVATE for host mounts
Here is a race when someone umounted something and this operation
isn't propagated into our namespace.

CRIU                                | Another process
-----------------------------------------------------------------
pivot_root(".", put_root)           |
mount(put_root, MS_REC|MS_PRIVATE)  |
                                    | umount /xxx/yyy
                                    | umount /xxx -> EBUSY
umount(put_root)

We do this to not affect mounts in put_root, but we can mask
these mounts as slave and this will work for us and for external
users.

Reported-by: Mr Travis
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-09-06 19:31:20 +03:00
Andrei Vagin
4fd8f39669 travis: catch core dump files in error cases
It is very hard to investigate travis fails, when something is segfaulted.

Let's add our own core file handler which will provide all required
information for us. Now test/abrt.sh shows a process tree,
process mappings, registers and backtraces.

v2: change a variable name
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Thanked-by: Dmitry Safonov <0x7f454c46@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-09-06 19:31:20 +03:00
Eugene Batalov
dd7cfba0ae test: new jenkins script for testing of --leave-stopped option
There is no similar jenkins script that tests similar options now.
So make a new script.

Signed-off-by: Eugene Batalov <eabatalov89@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-09-06 19:31:20 +03:00
Eugene Batalov
a43d29b7ef zdtm: implement testing of --leave-stopped criu option
Test does its checking both after dump and after restore.
Checking is done in the following way:
1. Check that every ps tree process is stopped or dead
2a. SIGKILL every ps tree process if checking after dump
2b. SIGCONT every ps tree process if checking after restore

Signed-off-by: Eugene Batalov <eabatalov89@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-09-06 19:31:20 +03:00
Andrei Vagin
985fbaac0e zdtm.py: don't forget to wait a child process
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-09-06 19:31:20 +03:00
Andrei Vagin
ada6312984 zdtm: don't trigger BUG if futex returns EINTR
It can hapen in tty tests, where we get SIGHUP.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-09-06 19:31:19 +03:00
Andrei Vagin
18c0fbc27c zdtm.py: check testname.out.inprogress in error cases
If a test crashes, its logs may be in testname.out.inprogress.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-09-06 19:31:19 +03:00
Andrei Vagin
9f0c8075b6 zdtm.py: used tabs for indentation
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-09-06 19:31:19 +03:00
Pavel Tikhomirov
54febc11f4 zdtm/ipc_namespace: add msg_next_id, sem_next_id, shm_next_id
as these sysctls can not be set to -1(default) leave them uninitialized
sometimes

https://jira.sw.ru/browse/PSBM-48397
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-09-06 19:31:19 +03:00
Eugene Batalov
40f56d5dc3 test: add test for anon shmem dedup
Main test features:
- Non trivial ps tree with non trivial anon shmem regions
  (no such test exists now).
- Each ps tree process continuously writes parts of anon shmem
  vmas and validates these writes after restore
  (required for dedup testing).
- Checking simultaneous changing of anon shmem contents in different
  processes.

Signed-off-by: Eugene Batalov <eabatalov89@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-09-06 19:31:19 +03:00
Andrei Vagin
379215e1f1 zdtm: check a case when a root of sub-mntns is read-only
It's what we have when ReadOnlyDirectories=/ is set for systemd services.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-09-06 19:00:21 +03:00
Dmitry Safonov
df81b884d4 test: add printf-attribute to test_msg
...and fix misprints that weren't caught before.

I guess, I never fixed that much (possible) bugs by one commit, heh.

Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-09-06 18:58:12 +03:00
Egor Gorbunov
5d4cf6269f files-reg: find appropriate dir to create link remap
Currently during criu dump we create link remap in the same dir
where original file was opened. But that dir may not exist during
link remap creation. At the same time it's okay to create link
remap in any dir on the same mount point.
In this patch we do this. We check existance of every dir bottom
up through the original file path. We use the first existing dir.

Similar approach is used on criu restore during ghost file creation.

Signed-off-by: Egor Gorbunov <egor-mailbox@ya.ru>
Signed-off-by: Eugene Batalov <eabatalov89@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-11 16:18:44 +03:00
Andrew Vagin
fad23922d8 zdtm: check permissions for map_files
Cc: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Test-for: b67d37d96fa0 ("proc_parse: fix vma file open mode recognition")
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-11 16:18:44 +03:00
Mike Rapoport
e71b877e79 test/zdtm_ct: fix comments spacing
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-11 16:18:43 +03:00
Andrew Vagin
fafdfb4754 faul-inject: Check a case when parasite can't initialize a command socket
Give a fake address for a server socket.

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-11 16:18:43 +03:00
Stanislav Kinsburskiy
3e840917c9 zdtm.py: check for link remap files presence on test end
These files have to be removed after successful restore.

v2:
Check link remap files only for tests with "--link-remap" option in
descriptor.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-08 15:21:30 +03:00
Tycho Andersen
dfe5f4e586 tests: add a test for the case when there is a helper with a zombie child
v2: drop /bin/ps from test deps
v3: wait for the zombie to make sure it exits

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-01 16:51:34 +03:00
Tycho Andersen
d5bee200a1 tests: only wait for the pid we spawned
In the next patch, we'll introduce an option to allow for leaving zombie
processes in the pid ns for the test so that we can test the behavior of
zombies. Let's not reap everything after restore, since we'll reap the
restored zombies as well.

v2: restore the old behavior when in reap mode

CC: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-01 16:51:34 +03:00
Tycho Andersen
b3c42b28a9 tests: add a ZDTM_NOREAP variable
We'll use this variable in the next test to make sure the test suite
doesn't accidentally reap the zombie we want to leave around for the actual
test.

This is kind of ugly and there might be a better way to pass information to
the test's init, I'm open for suggestions :)

CC: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-01 16:51:34 +03:00
Andrew Vagin
67960bbdb3 zdtm.py: check permissions for memory mappings
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-01 16:51:34 +03:00
Andrew Vagin
93e922238d criu: check that ghost files are cleaned up in error cases
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-01 16:51:33 +03:00
Andrew Vagin
628b125866 zdtm.py: check restore when criu dump runs over a non-root user
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-01 16:51:33 +03:00
Pavel Tikhomirov
9803bd2c2d zdtm/ipc_namespace: add msg_default msgsize_default
and move fs.mqueue.xxx from get_shared_memory_info to get_messages_info

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-01 16:51:33 +03:00
Andrew Vagin
d4f01fa532 test/other: check criu exec
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-01 16:51:33 +03:00
Tycho Andersen
96caa4da4a tests: rename deleted_standalone_unix to del_standalone_un
The directory that the tests run in on jenkins is:

/var/lib/jenkins/workspace/CRIU/CRIU-restore-sibling/criu-dev/test/zdtm/static

which makes the whole path too long. This commit makes the whole path:

/var/lib/jenkins/workspace/CRIU/CRIU-restore-sibling/criu-dev/test/zdtm/static/del_standalone_un.test/sock

which is 105 chars, less than 108 of sun_path.

Closes #191

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-01 16:51:32 +03:00
Dmitry Safonov
fe45e3626a make/test: generate .gitignore for tests
It's quite boring to add your test to .gitignore and one may forget
to do that boilerplate -- put this labour on computer.
For that I make real targets for tests instead of implicit and
add test's binary name to .gitignore on make stage.
Also added *.pidns to .gitignore -- do not wanna do this as separate
trivial patch.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-01 16:51:05 +03:00
Dmitry Safonov
3cbde46dba make/test: drop dependencies dead code
static/transition tests are built with implicit rules.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-01 16:51:05 +03:00
Tycho Andersen
0a68b6297c tests: add a (failing) test for standalone unix sockets
v2: open two sockets, one "on top" of the other
v3: also drop unnecessary unlink(), we can just rely on rename()

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-01 16:51:05 +03:00
Kirill Tkhai
f6df5d0789 zdtm: Make file_locks04 test based on /proc/{pid}/fdinfo/{fd}
/proc/locks is racy with adding/removing locks,
so we may lose lock on check.

Use fdinfo's list of locks instead.

v2: Feature 'fdinfo_lock'

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-01 16:51:05 +03:00
Andrew Vagin
9205fc3dec travis: add more tests to maximise code coverage
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-01 16:51:05 +03:00
Andrew Vagin
87270c8147 others/mnt-ext-dev: Force mke2fs to create a filesystem
It's required because we specify a file instead of a block device.

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-01 16:51:05 +03:00
Pavel Emelyanov
90098fe841 test: Fix flake8 error about ; at the end of line
Runaway from 66299a00

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-09 23:47:14 +03:00
Tycho Andersen
7d09451721 tests: expand the list of cgroup devices written
Hopefully this would/will trigger more of these types of bugs; I took this
list straight from Adrian's report.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
CC: Adrian Reber <adrian@lisas.de>
Tested-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-09 22:04:26 +03:00
Tycho Andersen
123551cc76 tests: test that multi-line cgroup devices are restored correctly
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-07 13:53:32 +03:00
Eugene Batalov
aaf87286de zdtm: add --link-remap opt to unlink_regular00 test desc
--link-remap opt is obligatory for unlink_regular00 test.
Without it CRIU dump will fail because it won't be able to
create link remaps.

Signed-off-by: Eugene Batalov <eabatalov89@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-07 13:53:32 +03:00
Sebastian Pipping
78ab4a548f Add missing "proto2" syntax marker
.. to address protobuf 3.x proto-c warnings

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-07 12:38:39 +03:00
Tycho Andersen
8db33d9033 tests: don't duplicate mnt_enablefs entry
this avoids:

===================== Run zdtm/static/socket-tcpbuf6 in h ======================
Makefile:295: target 'mnt_enablefs.pid' given more than once in the same rule
Start test
Makefile:295: target 'mnt_enablefs.pid' given more than once in the same rule
./socket-tcpbuf6 --pidfile=socket-tcpbuf6.pid --outfile=socket-tcpbuf6.out
Run criu dump
Run criu restore
Wait for zdtm/static/socket-tcpbuf6 to die for 0.100000
Wait for zdtm/static/socket-tcpbuf6 to die for 0.200000
Removing dump/zdtm/static/socket-tcpbuf6/27
===================== Test zdtm/static/socket-tcpbuf6 PASS =====================

in every test.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-07 12:38:39 +03:00
Andrew Vagin
f25ad84ad1 zdtm: check enabled file systems
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-07 12:38:39 +03:00
Stanislav Kinsburskiy
4cdabe9531 zdtm.py: create "dev/autofs" root contruction
Required for test/zdtm/static/autofs test.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
54a333a0b9 zdtm: add autofs test
1) Support autofs kernel-user exchange protocol
2) Test mounts: direct, indirect, offset (?) (migrated and operational).
3) Test cases, when write end of the pipe is closed, and when it's not.
4) Test catatonic mounts.
5) Test nested mounts are migrated (tmpfs suits it good)

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:14 +03:00
Andrew Vagin
1d0fcfa8f7 zdtm: don't run cgroup04 concurrently with other cgroup tests
It uses --manage-cgroup full and can dump and restore cgroup of other tests.

Reported-by: Mr Jenkins
Cc: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:15:28 +03:00
Pavel Tikhomirov
d7f9e824d3 zdtm/net/sysctl: add all to test and fix order
1. First save/check all,default,lo together and only after - set them,
as setting some sysctls can affect the others
2. Set "accept_redirects" after "forwarding" both for ipv4 and ipv6
3. Change order to "all", "default", "lo"

*One can not set ipv6.conf.all.stable_secret, so don't even try, see:
commit 622c81d57b39 ("ipv6: generation of stable privacy addresses for
link-local and autoconf")

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:12:26 +03:00
Tycho Andersen
e3b686f864 tests: remove commented out code
An oddity (bug?) means that we don't preserve empty cgroups in in the criu
cgset, since we don't dump it. So we do need to move things into tasks.

(This probably got commented out due to a bug in the Ubuntu kernel that I
ran across [1] which should be fixed shortly :)

[1]: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1588056

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:12:26 +03:00
Tycho Andersen
c8d79fcbbb tests: cgroup04 needs "full" cgroup mode
Because we're doing this on the same host, the cgroups will already exist.
We need to write the properties in full mode to exercise these cases.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:12:26 +03:00