2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 09:58:09 +00:00

311 Commits

Author SHA1 Message Date
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
Pavel Emelyanov
afc11b6a6c zdtm.py: When no logs, do not add them to report
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-24 14:47:24 +03:00
Pavel Emelyanov
517c0988e1 zdtm.py: Mark nouser tests as such
Some tests require criu to be root, e.g. tcp tests of unlink-mmaps ones,
so mark those in desc files as such.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Looks-good-to-me: Andrew Vagin <avagin@virtuozzo.com>
2015-12-24 14:42:44 +03:00
Pavel Emelyanov
dde2adbc9d zdtm.py: Check how user-mode works
There are several restrictions:

1. Onlu dump is checked (--norst) for now
2. Only host flavor as tests has to start themselves in non-root mode
3. Only non-suid tests
4. TCP doesn't work too, should be manually excluded :\

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Looks-good-to-me: Andrew Vagin <avagin@virtuozzo.com>
2015-12-24 14:42:37 +03:00
Andrew Vagin
7c11b0b914 zdtm.py: don't worry if a test class doesn't have ns() and static()
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-24 13:25:06 +03:00
Pavel Emelyanov
505896e664 zdtm.py: Test how freeze cgroup works (v2)
V2: Fix the test/Makefile

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by:  Andrew Vagin <avagin@virtuozzo.com>
2015-12-23 15:43:37 +03:00
Andrew Vagin
b814c75295 zdtm.py: fix comparing files, maps and mounts
Now we save files, maps and mounts for each test process
and we need to compare them separately for each process.

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-18 19:27:54 +03:00
Andrew Vagin
57f16168ed zdtm.py: tests should not inherite file descriptors from zdtm.py
Cc: Dmitry Safonov <dsafonov@odin.com>
Reported-by: Dmitry Safonov <dsafonov@odin.com>
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Tested-by: Dmitry Safonov <dsafonov@odin.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-18 16:54:07 +03:00
Andrew Vagin
dcd750a64f zdtm.py: bind-mount a test root as slave
In this case it has an external master_id and we want to test that
criu can handle it correctly.

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-16 18:13:55 +03:00
Andrew Vagin
4986d1b51e zdtm.py: compare a set of mounts before and after c/r
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-16 18:13:03 +03:00
Andrew Vagin
276eb6e823 zdtm.py: don't mix tab and spaces
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-16 18:12:07 +03:00
Andrew Vagin
3eac44ae85 zdtm.py: collect fds and maps for all test processes
It works for tests which are executed in a separate pidns

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-16 18:11:44 +03:00
Pavel Emelyanov
4427a71560 zdtm.py: Add action for cleaning nsroot
When running test in ns/uns flavor zdtm.py builds a temp root in test/ directory.
The new action allows to remove all this stuff automatically.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-15 15:01:16 +03:00
Pavel Emelyanov
bfcea5623d zdtm.py: Add write perms for all bins in test
This is to make groups test start in uns flavors

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-11 17:39:05 +03:00
Pavel Emelyanov
9ed3f6f2c7 zdtm.py: Fix deps for group start
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-11 16:51:01 +03:00
Pavel Emelyanov
2d1083303d zdtm.py: Add step-by-step execution
When debugging it's useful to stop zdtm.py at certain points and
check what's going on out there. For this the --sbs (step-by-step)
option is introduced. It will make zdtm.py stop and wait for user
keypress before dump, before restore and after restore.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
2015-12-10 15:01:31 +03:00
Pavel Emelyanov
bfb98244fe zdtm.py: Print out and strace file names
Generated files are often analyzed after test, so it's handy to have
their full names on the screen at once.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
2015-12-10 15:01:30 +03:00
Pavel Emelyanov
dc3b525cd7 zdtm.py: Print test output on screen when possible
Right now zdtm spawns test into a pseudo-container and redirects its
output in a temp file. This is done not to mix outputs of tests, running
in parallel, with each other.

But if we run tests one by one or there's only one test in the list
we can safely print the output right on the screen.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
2015-12-10 15:01:29 +03:00
Andrey Vagin
b94119b023 zdtm.py: catch KeyError instead of ValueError for sets
In [3]: a
Out[3]: {1, 2, 3}

In [4]: a.remove(5)
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-4-af76ca25878a> in <module>()
----> 1 a.remove(5)

KeyError: 5

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-10 15:00:45 +03:00
Andrey Vagin
94d91458c9 zdtm.py: don't worry if uns isn't in run_flavs
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-09 17:03:07 +03:00
Pavel Emelyanov
7ba43a5521 zdtm.py: Fix zdtm_test._env data type
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-08 15:19:25 +03:00
Andrew Vagin
0c9db23f50 zdtm.py: skip the uns flavor if userns isn't suppported
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-08 15:09:05 +03:00
Pavel Emelyanov
7a5cef1ea2 zdtm.py: Run tests in best flavor
If someone wants to run all tests in any, but the most
difficult for criu, flavor, the 'best' one is introduced.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Ruslan Kuprieiev <rkuprieiev@cloudlinux.com>
2015-12-08 15:05:57 +03:00
Pavel Emelyanov
0ba3b88b4a zdtm.py: Count skipped tests
Currently launcher doesn't know that some tests are skipped
and draws incorrect progress bar :)

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Ruslan Kuprieiev <rkuprieiev@cloudlinux.com>
2015-12-08 15:05:50 +03:00
Pavel Emelyanov
0b0f40ecf8 zdtm.py: The groups_test class for running groups
So here's the new test class that handles the test from
groups set. The class is inherited from zdtm_test one as
what it does is -- starts the pseudo-init in ns/uns flavors
and asks one to spawn() the sub-tests from the list.

All groups tests can only be run inside ns flavor, so if
the host flavor is asked, just the pseudo-init is spawned.
This is because using ns flavor is the easiest way to spawn
all the sub tests under this init (however, h flavor can be
supported by marking the pseudo-init as sub-reaper).

On stop this pseudo-init is signalled to stop, it in turn
stops all the sub-tests and then exits. When the pid
namespace destruction is complete, the sub-tests .out-s are
checked.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-08 14:54:52 +03:00
Pavel Emelyanov
41296aaf88 zdtm.py: Generator of groups of tests
Introduce yet another tests set called 'groups'. Each test
in this set is a list of existing zdtm tests that can be
started side-by-side in an ns flavor.

To 'create' such a test the zdtm.py group action is used,
which lists tests and semi-randomly groups them together.
The grouping possibility is checked by comparing the .desc
files of those -- desc-s should coincide. One exception is
test dependencies, these are just merged together.

After running the group action there appears groups/ dir
with tests each containing just the list of zdtm tests
that are in a group. The respective .desc file is also
generated and this one matches the .desc for tests inside.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-08 14:54:41 +03:00
Pavel Emelyanov
23898bf166 zdtm.py: Prepare zdtm_test and flavors for mass test start
This is -- add ability to pull more than one binary into
mntns root and ability to start zdtm test with more stuff
in the environment than generated in start method itself.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-08 14:53:47 +03:00
Pavel Emelyanov
1c75d23cef zdtm.py: Remove no longer needed yaml module
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-04 19:02:25 +03:00
Pavel Emelyanov
12db8a47c3 zdtm.py: Get 'sat' option with .get method
When using non-run command the 'sat' option is not in opts dict,
so it should be checked with softer method.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-03 18:46:25 +03:00
Pavel Emelyanov
3c0eec4814 zdtm.py: Create /dev/net in ns root
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-03 15:50:45 +03:00