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

140 Commits

Author SHA1 Message Date
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
Pavel Emelyanov
2f5b99045e zdtm: Helper for ns compare
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-01 14:52:21 +03:00
Andrew Vagin
0edee56729 zdtm: up the loopback device in a new network namespace
In this case we can run more tests

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-01 14:52:21 +03:00
Dengguangxing
dcabc7a5e7 add join-ns result check to zdtm
Signed-off-by: Deng Guangxing <dengguangxing@huawei.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-01 14:52:21 +03:00
Dengguangxing
2708e5b870 join-ns: Fix join-ns zdtm test
join-ns zdtm test will skip ns and uns flavors, and
some socket related test, too. Because join-ns test will
try to join an existing network namespace.

Signed-off-by: Deng Guangxing <dengguangxing@huawei.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-01 14:52:21 +03:00
Dengguangxing
d6bdc90ac9 join-ns: add join-ns zdtm test
Signed-off-by: Deng Guangxing <dengguangxing@huawei.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-01 14:44:46 +03:00
Andrew Vagin
5e86697cb6 zdtm: don't skip mounts with the same root and source
Now we don't detect extra mounts, if they have peers with the same root
and target paths.

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-05-31 15:02:37 +03:00
Andrew Vagin
8a2cefcc04 zdtm: save output of all tests in the /output file of a report
Jenkins sends this files as a message body if something failed.

Cc: Sergey Bronnikov <sergeyb@openvz.org>
Fixes: 474f2dfc5dd4 ("zdtm.py: add option --keep-going")
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-05-31 15:02:37 +03:00
Andrew Vagin
f55265f0f5 zdtm: handle unknown flavors
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-05-31 12:48:59 +03:00
Andrew Vagin
4998d1ce53 zdtm: show errors for a second attempt of the same action
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-05-27 13:37:11 +03:00
Andrew Vagin
d44276c143 zdtm: check mounts of external devices
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-05-27 13:31:14 +03:00
Pavel Emelyanov
330b0d1656 test: Check action scripts to work as we expect
We expect:

- all 9 scripts are called
- there's always images dir variable
- for 7 of those scripts there's root-pid variable

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
2016-05-06 14:39:25 +03:00
Andrei Vagin
49877012e3 zdtm: check the mem_dirty_track if --pre or --snap is set
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-21 16:21:24 +03:00
Pavel Emelyanov
5c17b30236 zdtm: Nicer flavs removal
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-04 17:10:14 +03:00
Sergey Bronnikov
12e85f1572 zdtm.py: updated logic for --keep-going option
- option --keep-going is not mandatory if we run a single testcase
- show warning when we use --keep-going with a custom set of testcases
- ignore --keep-going when we run a custom set of testcase (exit on 1st fail)

Signed-off-by: Sergey Bronnikov <sergeyb@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:39:22 +03:00
Pavel Emelyanov
bd70812023 zdtm: Add ability to run tests from list
Sometimes when running tests manually it's tempting to
prepare the list of tests to run in advance and then
run only those. E.g. -- when testing a new feature
that affects only _some_ tests. This option allows it.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:39:22 +03:00
Andrew Vagin
46e48dc168 zdtm: close __file_report before executing tests
------------------------ grep Error ------------------------
(00.011453) Error (files-reg.c:1136): Can't lookup mount=85 for fd=3 path=/var/lib/jenkins/workspace/CRIU-inhfd/test/report/criu-testreport.tap
(00.011478) Error (cr-dump.c:1304): Dump files (pid: 4) failed with -1
(00.011903) Error (cr-dump.c:1606): Dumping FAILED.
------------------------ ERROR OVER ------------------------

Cc: Sergey Bronnikov <sergeyb@openvz.org>
Fixes: c4e13bc92816 ("zdtm.py: add support of test reports in TAP format")
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:39:21 +03:00
Sergey Bronnikov
3cb39f95bb zdtm.py: add YAML block with details to a TAP report
It was requested by Andrey.

This patch adds details about failed testcase to a TAP report:

TAP version 13
1..1
not ok 1 - zdtm/static/deleted_unix_sock # flavor h

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:39:21 +03:00
Sergey Bronnikov
1e0bc96ae8 zdtm.py: fix overall return code for --keep-going option
Signed-off-by: Sergey Bronnikov <sergeyb@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:39:21 +03:00
Andrew Vagin
c5880ba2cf zdtm: add post-predump hook
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:36:13 +03:00
Andrei Vagin
c5c5434506 fault: add ability to fault open_by_handel in check_open_handle
From code coverage report, we found that inotify_irmap doesn't test irmap
cache, because we is always able to resolve path from /proc/PID/fd/X.

Current view:	top level - criu - irmap.c (source / functions)			Hit	Total	Coverage
Test:	criu.info		Lines:	40	223	17.9 %
Date:	2016-03-16		Functions:	4	13	30.8 %

This series introduces a new fault to emulate a situation
when a file can't be opened by handle and we have to find
it in the irmap cache/

It's required to test irmap cache. I don't know how to force it
without this patch. Each time when a file can be opened by handle,
its path can be resolved via /proc/PID/fd/X.

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:36:13 +03:00
Sergey Bronnikov
84359f7a10 zdtm.py: change format of test description in TAP report
changed per request from Andrey Vagin

Signed-off-by: Sergey Bronnikov <sergeyb@openvz.org>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:36:13 +03:00
Sergey Bronnikov
cabafae2e5 zdtm.py: add support of test reports in TAP format
Usually we run CRIU tests automatically using Jenkins CI and it reports status
as PASS/FAIL for overall testsuite on used environment. You should dig into log
files to figure out how many tests were failed and skipped. This patch brings
support of cute reports in TAP (Test Anything Protocol) format.

The sample of report:

TAP version 13
1..242
ok 1 - conntracks # SKIP manual run only
ok 2 - busyloop00
ok 3 - sleeping00
ok 4 - pid00
ok 5 - caps00
ok 6 - wait00

NOTE: report will be generated only when options --keep-going and --report
are specified.

Signed-off-by: Sergey Bronnikov <sergeyb@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:36:13 +03:00
Sergey Bronnikov
474f2dfc5d zdtm.py: add option --keep-going
Introduce an option --keep-going to make ability to run all planned tests and
ignore failed tests. Also with this option zdtm.py will keep image files and
output log for each failed test:

[vagrant at fedora test]$ find sergeyb-xxx -maxdepth 3
sergeyb-xxx
sergeyb-xxx/zdtm_static_bridge_ns
sergeyb-xxx/zdtm_static_bridge_ns/images
sergeyb-xxx/zdtm_static_bridge_ns/images/1
sergeyb-xxx/zdtm_static_bridge_ns/output
sergeyb-xxx/zdtm_static_bridge_ns/images.0
sergeyb-xxx/zdtm_static_bridge_ns/images.0/1
sergeyb-xxx/zdtm_static_bridge_ns/output.0
sergeyb-xxx/zdtm_static_deleted_unix_sock_h
sergeyb-xxx/zdtm_static_deleted_unix_sock_h/output
sergeyb-xxx/zdtm_static_deleted_unix_sock_h/output.0
sergeyb-xxx/zdtm_static_deleted_unix_sock_h/output.1

Signed-off-by: Sergey Bronnikov <sergeyb@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:36:13 +03:00
Pavel Emelyanov
b1b9eb7b32 zdtm: Wait for transition test to run for some time after, start
These tests do some work while being C/R-ed, so it make sense to
let them do some progress before doing so.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
2016-03-21 10:15:31 +03:00
Ivan Shapovalov
a1b94a3d3e zdtm: zdtm.py: write "meta" checkskip/hook scripts for group tests
Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-16 16:16:08 +03:00
Ivan Shapovalov
8fa1d7114a zdtm: zdtm.py: allow deliberately generating test groups of size 1
Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-16 16:16:08 +03:00
Ivan Shapovalov
0fd53e07a5 zdtm: zdtm.py: reset $PATH to canonical in ns tests
This is to deal with distros like Arch which take /usr merge to the
extreme and set their $PATH to something like /usr/local/bin:/usr/bin
(no /usr/sbin, no /{s,}bin), which breaks our rather inflexible nsroot
population logic.

Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-16 16:16:08 +03:00
Andrei Vagin
615465498f gcov: mount criu sources into a test mount tree
CRIU processes save *.gcda and *.gcno files near source files,
so when we restore tests into another mount namespace,
we need to have access to sources from this namespace.

Cc: Sergey Bronnikov <sergeyb@openvz.org>
Reported-by: Sergey Bronnikov <sergeyb@openvz.org>
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-16 16:16:07 +03:00
Tycho Andersen
fc2c3c94b8 tests: add --dry-run to zdtm.py
v2: print test name + flavor info for each test too.
v3: pass dry_run via CR_CT_TEST_INFO

Output looks like this now:

=== Run 1/242 ----------------
Skipping zdtm/transition/thread-bomb (manual run only)
Skipping zdtm/transition/file_aio (manual run only)

======================= Run zdtm/transition/maps007 in h =======================

====================== Run zdtm/transition/maps007 in ns =======================

====================== Run zdtm/transition/maps007 in uns ======================
=== Run 4/242 ----------------
Skipping zdtm/transition/epoll (manual run only)

==================== Run zdtm/transition/pipe_shared00 in h ====================

=================== Run zdtm/transition/pipe_shared00 in ns ====================

=================== Run zdtm/transition/pipe_shared00 in uns ===================
=== Run 6/242 ----------------

======================== Run zdtm/transition/fork in h =========================

======================== Run zdtm/transition/fork in ns ========================

======================= Run zdtm/transition/fork in uns ========================
=== Run 7/242 ----------------
Skipping zdtm/transition/ptrace (manual run only)
Skipping zdtm/transition/socket_loop00 (manual run only)

======================== Run zdtm/transition/ipc in ns =========================
=== Run 10/242 ----------------
Skipping zdtm/transition/netlink00 (manual run only)

===================== Run zdtm/transition/socket-tcp6 in h =====================
=== Run 12/242 ----------------
...

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-09 13:00:38 +03:00
Pavel Emelyanov
8abf6d2d1b zdtm: Get dir of init.pid file
For the caller there should be only one pidfile -- the one
that should be fired with TERM signal on stop. All the other
stuff is test's internal business.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-09 12:49:52 +03:00
Andrew Vagin
0023e2e573 zdtm: check that a command completes successfully after a fault (v5)
I suggest to inject a fault and than try to execute the same command
again without a fault to check that it will complete successfully.

v2: skip a parasite blob when we are checking vma-s
v3: remove a loop for two iterations
v4: clean up
v5: call fault hooks from one place
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-03 14:02:57 +03:00
Andrey Vagin
79e93ca79c zdtm: use a separate file for flock
In Ubuntu flock opens a file with O_RDWR and then it can't be executed
flock: ./zdtm_mount_cgroups: Text file busy

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-24 23:47:01 +03:00
Pavel Emelyanov
166a8e8e93 zdtm: Increate dump timeout
Tests are often run in VMs and 5 seconds on loaded environments might
be not enough to catch transition zdtm tests.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-20 17:56:02 +03:00
Pavel Emelyanov
2e13f1f029 test: Get rid of live directory
Move static and transition into zdtm top. We can't move all the micro
tests themselves, as we need to distinguish static from non static (zdtm.py
makes additional checks on static ones).

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-20 13:40:52 +03:00
Cyrill Gorcunov
f96718b3e3 test: zdtm.py -- Fix criu reference
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-15 19:22:44 +03:00
Dmitry Safonov
6effc59e2d zdtm.py: specify python version
Otherwise it may suck on some distros (Arch i.e):
make zdtm
make[2]: Entering directory '/home/japdoll/tools/criu/test'
./zdtm.py run -a --parallel 2
  File "./zdtm.py", line 33
    print "        ..."
                      ^
SyntaxError: Missing parentheses in call to 'print'
Makefile:25: recipe for target 'zdtm' failed
make[2]: *** [zdtm] Error 1
make[2]: Leaving directory '/home/japdoll/tools/criu/test'
Makefile:9: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/japdoll/tools/criu/test'
Makefile:258: recipe for target 'test' failed
make: *** [test] Error 2

Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-12 16:54:05 +03:00
Tycho Andersen
36aedc3b11 zdtm.py: fix checkskip logic
Fix checkskip logic, also emit a clearer reason when checkskip fails as to
why the test was skipped.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-08 21:26:41 +03:00
Laurent Dufour
6b13731d02 zdtm.py: Add optional dependency support
Depending on the distribution, binaries or shared libraries a test is
dependent of may not be stored at the same place.

This patch introduces the ability to define option in the dependency
list, by separating the optional target names by a '|' character.

For instance the dependency of test may be described this way:
{'flavor': 'ns', 'deps': [ '/bin/foo|/usr/bin/foo' ], 'flags': 'suid'}

Note, there shouldn't be any spaces around the '|'.

If none of the optional dependency is satisfied, an error is raised.

Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-01-18 21:10:31 +03:00
Pavel Emelyanov
0e891b3b0d zdtm.py: Force per-test logs if report is requested
Otherwise non-parallel jenkins jobs miss the error logs in e-mails

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-30 17:06:27 +03:00
Andrew Vagin
df0be41e05 zdtm: add a new test to check inherited tty-s
v2: set a control terminal
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-29 14:48:36 +03:00
Andrew Vagin
9dc7155b73 zdtm.py: unfreeze test processes before killing them
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-28 13:11:28 +03:00