2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-27 12:28:14 +00:00

231 Commits

Author SHA1 Message Date
Andrew Vagin
f59b45fba2 zdtm: check lazy-pages
Cc: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-09-16 09:16:32 +03:00
Mike Rapoport
b34efd5591 test/zdtm.py: allow setting test timeout in the test description
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-08-15 15:24:11 +03:00
Mike Rapoport
5d6392358d test/zdtm.py: ignore UNIX sockets during report creation
When files are added to the report shutil.copytree is unhappy with
lazy-pages.socket. Tell shutil.copytree that it should ignore *.socket.

Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-08-15 15:24:10 +03:00
Andrei Vagin
624aa178dc zdtm: don't call Popen() without wait()
We have to collect all zombies

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 20:01:28 +03:00
Andrei Vagin
c0857d2517 zdtm: check /proc/sys/kernel/taint and fail if it is non-zero
We don't want to run tests, if a kernel has a problem. And we want
to know when the taint flag is changed.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Acked-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:46 +03:00
Pavel Begunkov
70c0b47d44 zdtm: skip 'tcp-close' tests if restore is skipped
'tcp-close' is a option that replaces connected tcp-sockets with
'closed' ones during restoring, therefore it have no sense without
restore stage. Thus let's skip related tests if the 'norst' flag was
specified.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-07-18 09:34:46 +03:00
Andrei Vagin
a7281b11fd test: restore ns_last_pid before executing restore in a second time
It is required for cases when we inject a fault in criu restore.
In this case we execute "criu restore" and check that it fails,
then we execute "criu restore" without a fault and check that it passes.

If the first "criu restore" restores only a part of processes,
the second criu can get PID of one of restored processes.

https://github.com/xemul/criu/issues/282
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-05-10 04:20:37 +03:00
Andrei Vagin
88e5db749c zdtm: print 5 lines before an error
It's very hard to understand an error without a context

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-04-02 18:12:11 +03:00
Adrian Reber
905c4084cf zdtm: print test case summary also if all test cases pass
If using the '--keep-going' option, zdtm prints out an overview how many
tests were run, failed and skipped. This would also be useful to know if
it did not fail. This patch changes the output like this:

 ################## ALL TEST(S) PASSED (TOTAL 297/SKIPPED 36) ###################

or in the case of a failure it is unchanged:

 ################### 2 TEST(S) FAILED (TOTAL 297/SKIPPED 34) ####################
  * zdtm/static/sched_policy00(ns)
  * zdtm/static/cgroup02(h)
 ##################################### FAIL #####################################

Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-04-02 18:09:34 +03:00
Adrian Reber
3edd0576f4 zdtm: fix decode_flav()
decode_flav() was doing 'if i in flavors:' where 'i' was an integer but
the keys from the flavors dict are strings 'h', 'ns' and 'uns'.

Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-04-02 18:09:34 +03:00
Andrey Ryabinin
e23c1d4ed9 zdtm.py: run tests with ASAN_OPTIONS
To run CRIU with ASan we have to use some non-default options:

 - detect_leaks=0 - We have to many leaks for know. Let's disable until fixed.
 - disable_coredump=0 - without this ASan library changes RLIMIT_CORE which
                         break rlmimits00 tests.
 - log_path=asan.log - For some reason default output to stderr sometimes
                        doesn't work in CRIU. So error log will be stored
                        in asan.log.<pid> file instead.

travis-ci: success for series starting with [1/6] compel/infect: fix out-of-bounds parasite memcpy()
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-03-15 09:36:04 +03:00
Andrei Vagin
0d979b2934 zdtm.py: use --status-fd instead --daemon
It works faster and allows to check exit codes.

travis-ci: success for series starting with [1/2] page-server: don't return a server pid from page-server
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-03-02 00:19:02 +03:00
Cyrill Gorcunov
b56c5f8a82 zdtm: Extend vim settings in zdtm.py
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-02 00:19:02 +03:00
Andrei Vagin
68bfb80a51 test: check exit codes for criu page-server
travis-ci: success for crtools: close a signal descriptor after passing a preparation stage (rev6)
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-03 18:04:17 +03:00
Cyrill Gorcunov
fe68441bf4 zdtm.py: Fix eval error if empty desc file provided
If desc is empty we should not try to eval it,
otherwise it would lead to exceptio. So test
for its size as well.

travis-ci: success for zdtm.py: Fix eval error if empty desc file provided
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-01 18:41:30 +03:00
Andrei Vagin
1a89b88c08 zdtm: check sequence numbers for tcp sockets
They have to be the same on each iteration.

travis-ci: success for series starting with [01/21] build: install libnet-dev
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:49 +03:00
Andrei Vagin
b84d2b786c zdtm.py: pass a test PID into zdtm hooks
travis-ci: success for series starting with [01/21] build: install libnet-dev
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-12-21 12:37:29 +03:00
Andrei Vagin
ff728932e3 zdtm.py: add a test name into a progress line
Now it is impossible to find when a test has been started,
but sometimes we want to knwo which tests were running in a specified moment.

travis-ci: success for zdtm.py: add a test name into a progress line
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-12-21 11:23:02 +03:00
Andrei Vagin
ccc4456474 zdtm: move a tap header to a first line
org.tap4j.parser.ParserException: Error parsing TAP Stream: Invalid position of TAP Header.
It must be the first element (apart of Comments) in the TAP Stream.

Reported-by: Mr Jenkins
travis-ci: success for zdtm: move a tap header to a first line
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-12-19 20:58:40 +03:00
Dmitry Safonov
6077c3d7f0 zdtm.py: print full pie errors in grep Error omitting line breaks
Before:
=[log]=> dump/zdtm/transition/shmem/142/1/dump.log
------------------------ grep Error ------------------------
pie: 1: Error (/home/travis/build/0x7f454c46/criu/criu/arch/x86/includ>
pie: 1: Error (/home/travis/build/0x7f454c46/criu/criu/arch/x86/includ>
pie: 5: Error (/home/travis/build/0x7f454c46/criu/criu/arch/x86/includ>
pie: 5: Error (/home/travis/build/0x7f454c46/criu/criu/arch/x86/includ>
pie: 6: Error (/home/travis/build/0x7f454c46/criu/criu/arch/x86/includ>
pie: 6: Error (/home/travis/build/0x7f454c46/criu/criu/arch/x86/includ>
------------------------ ERROR OVER ------------------------

After:
=[log]=> dump/zdtm/transition/shmem/62/1/dump.log
------------------------ grep Error ------------------------
pie: 1: Error (/home/travis/build/0x7f454c46/criu/criu/arch/x86/includ>
pie: 1: e/asm/parasite.h:45): Failed to dump TLS descriptor #13: -4
pie: 1: Error (/home/travis/build/0x7f454c46/criu/criu/arch/x86/includ>
pie: 1: e/asm/parasite.h:45): Failed to dump TLS descriptor #14: -4
pie: 5: Error (/home/travis/build/0x7f454c46/criu/criu/arch/x86/includ>
pie: 5: e/asm/parasite.h:45): Failed to dump TLS descriptor #13: -4
pie: 5: Error (/home/travis/build/0x7f454c46/criu/criu/arch/x86/includ>
pie: 5: e/asm/parasite.h:45): Failed to dump TLS descriptor #14: -4
pie: 6: Error (/home/travis/build/0x7f454c46/criu/criu/arch/x86/includ>
pie: 6: e/asm/parasite.h:45): Failed to dump TLS descriptor #13: -4
pie: 6: Error (/home/travis/build/0x7f454c46/criu/criu/arch/x86/includ>
pie: 6: e/asm/parasite.h:45): Failed to dump TLS descriptor #14: -4
------------------------ ERROR OVER ------------------------

Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-12-09 22:42:27 +03:00
Mike Rapoport
3ead6f0c6e zdtm: allow --keep-going anytime when running multiple tests
Currently it's possible to continue testing despite failures only when
running zdtm.py with --all option. Let's make --keep-going option also
valid when more than one test is requested with --tests or --from.

Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-12-05 23:35:15 +03:00
Adrian Reber
94dfd0ca91 zdtm: print a summary of failed tests if using --keep-going
When using the option --keep-going to get a quick overview of the test
results there is now a summary which tests have failed like:

 ############# 7 TEST(S) FAILED (TOTAL 268/SKIPPED 83) ##############
  * zdtm/static/sched_policy00(unknown)
  * zdtm/static/pthread00(unknown)
  * zdtm/static/pthread01(unknown)
  * zdtm/static/maps01(unknown)
  * zdtm/static/maps00(unknown)
  * zdtm/transition/maps008(unknown)
  * zdtm/transition/shmem(unknown)
 ############################### FAIL ###############################

Signed-off-by: Adrian Reber <areber@redhat.com>
Acked-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-12-05 11:49:19 +03:00
Andrei Vagin
9117dd66ad zdtm: fix flake8 warnings
flake8 --config=scripts/flake8.cfg test/zdtm.py
test/zdtm.py:66:1: E305 expected 2 blank lines after class or function definition, found 1
test/zdtm.py:127:1: E305 expected 2 blank lines after class or function definition, found 1
test/zdtm.py:971:1: E305 expected 2 blank lines after class or function definition, found 1
test/zdtm.py:1618:1: E305 expected 2 blank lines after class or function definition, found 1
Makefile:377: recipe for target 'lint' failed

travis-ci: success for zdtm: fix flake8 warnings
Signed-off-by: Andrei Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-11-17 11:33:09 +03:00
Pavel Emelyanov
cde33dcb06 empty-ns: Don't C/R iptables too (v2)
When C/R-ing a net namespace with --empty-ns net option we should also
skip netfilter rules too (as per https://github.com/docker/docker/issues/27597).

However, there's one thing to be handled -- local TCP blocking rules are
expected to be there on restore by restore_iptables() which is no longer
the case, so put them back manually.

Test included, checked on zdtm/static/socket-tcpbuf-local :)

v2: Full scripts for empty netns setup.

https://github.com/xemul/criu/issues/246
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-11-17 11:05:37 +03:00
Pavel Emelyanov
19ae737cb9 zdtm: Handle --external option in RPC
Travis sets up the GCOV variable to collect coverage and
provides an external mount for this. Thus handling this
option in RPC mode is essential.

travis-ci: success for tests: Add RPC testing to CI (rev2)
Acked-by: Andrey Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-11-12 11:06:00 +03:00
Pavel Emelyanov
65b7d746e3 zdtm: Handle dump/restore error in RPC mode
travis-ci: success for tests: Add RPC testing to CI (rev2)
Acked-by: Andrey Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-11-12 11:06:00 +03:00
Pavel Emelyanov
2e6375416b zdtm: Fix --ext-mount-map to --external
Now the --ext-mount-map is deprecated option, so fix it to
become the --external one.

travis-ci: success for tests: Add RPC testing to CI (rev2)
Acked-by: Andrey Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-11-12 11:06:00 +03:00
Tycho Andersen
d5fc5dbb41 zdtm.py: run --clean hook on test failure
It seems to me most of the clean hooks (used by cgroup*, macvlan* cr_veth*
and mnt_tracefs* were all designed to be run to clean up after the test, no
matter whether it failed or succeeded. Let's always run them, so Andrei
doesn't hate me :D

travis-ci: success for zdtm.py: run --clean hook on test failure
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
CC: Andrei Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-11-12 11:06:00 +03:00
Pavel Emelyanov
9d417188e2 zdtm: Test --external veth option (v5)
Inspired by Tycho's macvlan test, here's the same thing for
--external veth option. In master we still have the --veth-pair
one, but the plan is to move this all under the --external opt.

v2:
* Travis doesn't have /usr/bin/sed
* Added .checkskip hook for older environments

v3:
* Delete bridge hanging around after previous flavor
* Wait for host veth end to die after dump

v4:
* Get the pid of task to move veth into from .pid.inprogress file

v5:
* Wait for host veth end to die after test stop too :\

Travised-by: https://travis-ci.org/xemul/criu/builds/170726663
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-11-03 18:15:03 +03:00
Tycho Andersen
124fd587b6 test: add a --post-start hook
This hook runs after the test is started, in parallel with the actual test.
This can be used in case the test and the host need to coordinate somehow
in order to set something up (e.g. for a macvlan interface).

travis-ci: success for series starting with [v10,01/11] net: pass the struct nlattrs to dump() functions
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-10-24 16:00:16 +03:00
Andrei Vagin
2dc2d8c56f zdtm: add a program to umount a test root
This program doesn't parse /etc/fstab or /etc/mtab,
it just calls the umount2 syscall.

It is another attempt to fix the error:
subprocess.CalledProcessError: Command '['mount', '--make-private', '/tmp/criu-root-C7MZS9']' returned non-zero exit status 1
OSError: [Errno 16] Device or resource busy: '/tmp/criu-root-C7MZS9'

Signed-off-by: Andrei Vagin <avagin@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-09-26 15:42:40 +03:00
Andrew Vagin
3b366c3141 zdtm: check "criu dedup"
Add a new option to zdtm.py to run "criu dedup" after "criu dump"
or "criu pre-dump".

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-09-26 15:42:40 +03:00
Pavel Emelyanov
2076a16031 zdtmpy: Fix flake8 warnings
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-09-06 19:31:24 +03:00
Andrei Vagin
7df7d9bb67 zdtm.py: call clean_tests_root() from one process only
An atexit hook is executed for forked processes too,
clean_tests_root() has to be called only once.

v2: fix flak8 warnings
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-09-06 19:31:24 +03:00
Andrei Vagin
1b8a5bf98d zdtm.py: print a process tree if a timeout is expired
It gives us more information why a test hasn't completed in time.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-09-06 19:31:21 +03:00
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
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
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
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
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
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
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
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 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
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
Andrew Vagin
66299a0065 zdtm: use flake8 to verify zdtm.py
and fix various warnings. For example, we mix tab and space indentations.

v2: add flake8.cfg

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:09:35 +03:00