2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-28 21:07:43 +00:00

52 Commits

Author SHA1 Message Date
Pavel Emelyanov
127152268a jenkins: Make criu-snap test use zdtm.py
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-12 18:11:38 +04:00
Andrew Vagin
a3bfe43ef9 zdtm.py: print shorter separators for less significant blocks
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-10 16:52:35 +03:00
Andrew Vagin
2fb61d3f9d zdtm.py: grep errors even if criu exists with 0
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-10 16:52:28 +03:00
Tycho Andersen
7f86ceb470 zdtm.py: don't fail tests if pids collide
It seems with the new zdtm.py that pids collide a lot more (perhaps because
everything is in its own pid namespace? not sure). In any case, this is
annoying as it prevents a second run of the tests from actually getting to
the test part.

So, let's try to move the old directory out of the way.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-05 15:40:51 +03:00
Tycho Andersen
a985500cd8 zdtm.py: fix typo
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-05 15:40:28 +03:00
Tycho Andersen
0a2d3a9b6a use a modeline for zdtm.py to set noet
Most python uses spaces, so that's probably what people have their editors
configured to do. Since this file uses tabs, let's be explicit about it.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-05 15:40:21 +03:00
Tycho Andersen
615e79952d zdtm.py: unmount tests_root before rm-ing it
This avoids problems like:

$ sudo ./zdtm.py run -a
Skipping test zdtm/live/static/mem-touch (manual run only)
./sock_opts00 --pidfile=sock_opts00.pid --outfile=sock_opts00.out
./sock_opts00 --pidfile=sock_opts00.pid --outfile=sock_opts00.out

==================== Run zdtm/live/static/sock_opts00 in h =====================
Start test
Test is SUID
Run CRIU: [dump -o dump.log -D dump/zdtm/live/static/sock_opts00/74/1 -v4 -t 74 --pidfile /home/ubuntu/criu/test/zdtm/live/static/sock_opts00.pid]
Run CRIU: [restore -o restore.log -D dump/zdtm/live/static/sock_opts00/74/1 -v4 --pidfile /home/ubuntu/criu/test/zdtm/live/static/sock_opts00.pid --restore-detached]
Wait for zdtm/live/static/sock_opts00 to die for 0.100000
Remvoing dump/zdtm/live/static/sock_opts00/74
==================== Test zdtm/live/static/sock_opts00 PASS ====================

==================== Run zdtm/live/static/sock_opts00 in ns ====================
Construct root for zdtm/live/static/sock_opts00
Start test
Test is SUID
Traceback (most recent call last):
  File "zdtm.py", line 850, in <module>
    do_run_test(tinfo[0], tinfo[1], tinfo[2], tinfo[3])
  File "zdtm.py", line 641, in do_run_test
    cr(cr_api, t, opts)
  File "zdtm.py", line 562, in cr
    cr_api.set_test(test)
  File "zdtm.py", line 469, in set_test
    os.makedirs(self.__dump_path)
  File "/usr/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 17] File exists: 'dump/zdtm/live/static/sock_opts00/153'
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "zdtm.py", line 46, in clean_tests_root
    os.rmdir(tests_root)
OSError: [Errno 16] Device or resource busy: '/tmp/criu-root-MmGEQD'
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "zdtm.py", line 46, in clean_tests_root
    os.rmdir(tests_root)
OSError: [Errno 16] Device or resource busy: '/tmp/criu-root-MmGEQD'

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-05 15:40:15 +03:00
Tycho Andersen
24e7ad41c4 zdtm.py: use /usr/bin/env for interpreter
On debian/ubuntu systems, we don't have a /bin/env by default; on rhel
systems (my limited testing seems to indcate that) /usr/bin/env is a
symlink to /bin/env, so let's just use that so it works everywhere.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-05 15:35:38 +03:00
Pavel Emelyanov
94729e1d47 zdtm.py: Put criu opts into file, not on the screep
It's very inconvenient to read the zdtm.py output with long
lines of options.

Reported-by: Andrey Vagin <avagin@odin.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-05 15:34:22 +03:00
Pavel Emelyanov
c300544a77 zdtm.py: Progress bar showing launching tests
Asked-by: Andrey Vagin <avagin@odin.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-05 15:34:00 +03:00
Pavel Emelyanov
a4a1d9f070 zdtm.py: Flush stdout before running make
Otherwise make's output appears in logs before zdtm.py's one

Reported-by: Andrey Vagin <avagin@odin.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-05 15:33:35 +03:00
Andrew Vagin
db87346fa7 zdtm.py: print an error message at the end if something failed
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-05 15:31:47 +03:00
Pavel Emelyanov
60e76ca477 zdtm.py: Ability to delay between iterations and pre-dumps
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-05 15:20:06 +03:00
Pavel Emelyanov
dc55d23805 zdtm.py: Printf maps before diffing them
First -- set cannot be made out of lists (and maps lists contain lists of pairs)
Second -- it is much better to read map diffs in hex, rather than ints (as they
would be if repr-ed by default)

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-03 10:40:19 +03:00
Pavel Emelyanov
287c07129f zdtm.py: Fix cmp_lists routine
The zip() trims longest list thus we can lose objects the appeared at tail

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-03 10:38:48 +03:00
Pavel Emelyanov
d35f4a1543 zdtm.py: Print more info when maps compare fails
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-02 22:19:02 +04:00
Andrew Vagin
37d90574d7 zdtm.py: chdir to dir the py script is in
It allows to execute zdtm.py not only from the test directory.

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-30 14:56:39 +03:00
Pavel Emelyanov
400dbd6ab6 zdtm.py: Call zdtm_mount_cgroups in advance
This script prepares the cgroups hierarchies that are used by
tests to avoid creation of those in parallel with tests, that
do not expect them to appear.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-30 15:55:41 +04:00
Pavel Emelyanov
f01ae34ece zdtm.py: Make zdtm/ and zdtm_ct before run
The zdtm.py depends on this stuff.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-30 14:51:27 +03:00
Pavel Emelyanov
433839cfcb zdtm.py: Add file perms to test in uns
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-28 18:04:52 +03:00
Pavel Emelyanov
bb0efb3180 zdtm.py: Print failure report with # sep-s
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-28 17:55:30 +03:00
Pavel Emelyanov
0534d74dcc zdtm.py: Generate report with failed tests
Includes C/R images dir and the zdtm.py logs for one test only.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@odin.com>
2015-10-28 17:46:43 +03:00
Pavel Emelyanov
077b9c959c zdtm.py: Fix argumeps to uns flavor init
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-28 17:05:05 +03:00
Pavel Emelyanov
35237d2a79 zdtm.py: Move more stuff into ns root
Things added are:

1. /usr directories (links to respective / ones)
2. /sbin dir
3. per-test dependencies that are listed in .desc file as 'deps': [<list>]

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Andrew Vagin <avagin@odin.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-28 16:52:38 +03:00
Pavel Emelyanov
dc6edd79e6 zdtm.py: Add dirs write perms for low-prio tests and flavors
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-28 12:36:40 +04:00
Pavel Emelyanov
225537ea5a zdtm.py: Wait for tasks to die more
On loaded jenkins nodes sometimes it takes much more than 4 seconds.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-28 10:42:27 +03:00
Pavel Emelyanov
d45c5481c0 zdtm.py: Fix iterations
Currently --iter N results in sequential images for every new iteration.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-27 22:55:16 +03:00
Pavel Emelyanov
f49e54f2b0 zdtm.py: Make print_sep shorter and print aligned lines
Current implementation of print_sep has off-by-one-like issue -- it
can print one character more :) Fix this and make the code shorter.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-27 22:53:28 +03:00
Pavel Emelyanov
35603e51cc zdtm: Handle crfail tests (expected dump failure)
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-20 17:10:22 +04:00
Pavel Emelyanov
896837cea8 zdtm: Do not compare maps and fds for non-static tests
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-20 15:52:59 +04:00
Pavel Emelyanov
43d78feb3e zdtm: Fix exit code propagation from failed tests
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-20 15:40:10 +04:00
Pavel Emelyanov
951a1e04f2 zdtm.py: Pass keep_img and fault option to sub-tasks
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-20 13:18:45 +03:00
Pavel Emelyanov
8ce58ec963 zdtm.py: Ability to run tests with faults injected
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-19 12:45:40 +03:00
Pavel Emelyanov
c405304fcc zdtm.py: Add inhfd tests for --inherit-fd option
This option cannot be tested using classic zdtm tests as it implies
some data created before restore and passed through criu restore down
to the restored process (descriptor in our case).

So add inhfd_test class that creates such.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-19 12:42:01 +03:00
Pavel Emelyanov
5193fa4a96 zdtm.py: Split per-test options into C and R ones
One for checkpoint another for restore.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-19 12:42:00 +03:00
Pavel Emelyanov
450fadb561 zdtm.py: Control whether or not to keep images after test
Tree ways are possible -- always, never and only for tests that failed. The
latter one is the default.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-19 12:35:57 +03:00
Pavel Emelyanov
0fdbffa10e zdtm.py: Run tests matching given regexp
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-19 12:35:38 +03:00
Andrew Vagin
4c1ffde861 zdtm.py: print separators between tests
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-14 15:58:08 +03:00
Andrew Vagin
ed8a13b70f zdtm: show error messages in a error case
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-14 15:57:31 +03:00
Pavel Emelyanov
1a6de2c643 zdtm.py: Support crlib flag for tests
This flag means that there's lib/ directory where a plugin is.
Currently rtc test is such. The wait_pid_die timeout is risen
since this test dies for more than 6 seconds :)

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-12 13:06:27 +03:00
Pavel Emelyanov
388df2a103 zdtm.py: Support tests' hooks
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-12 13:06:20 +03:00
Pavel Emelyanov
edc19f139c zdtm.py: Print out file if it exists
Sometimes tests fail before generating .out file, so print its
contents only if it exists.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-12 13:06:10 +03:00
Pavel Emelyanov
bdb549c961 zdtm.py: Allow specifying the test suit description file
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-12 13:05:43 +03:00
Pavel Emelyanov
6d5635e360 zdtm.py: Lower zdtm keyword usage
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-12 13:05:33 +03:00
Pavel Emelyanov
f698be0a12 zdtm.py: Print tests info when listing them
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-12 13:05:28 +03:00
Pavel Emelyanov
9db8bd8cf4 zdtm.py: Rework tests list generation
Hand-made list of tests is not great. As Christopher suggested we can find
all executables in a directory and treat them as tests. This idea is good,
but requires a little bit more trickery.

First, some executables in directory are not tests, e.g. these are per-test
scripts, which should be skipped. Next, not all tests in zdtm can be right
now run in continuous manner (they fail), but we want to run them manually.
To fix that such tests are marked with 'noauto' flag in the description.

So we have the test test descriptor file, which states in which file to
look for tests (executable) and which of them to exclude. Maybe more, can
be added on demand.

And, finally, the per-test description goes in a ${test}.desc file in native
python eval/repr-able format. If the file is absent a default description
is used.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-12 13:05:02 +03:00
Pavel Emelyanov
526b7826d1 zdtm.py: Test the --restore-sibling option
The main difficulty here is that restored test becomes zdtm.py's kid
and after killing one we should wait() the test's zombie. W/o the
--restore-sibling test gets restored under existing init and gets
wait()-ed automagically.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-12 13:04:17 +03:00
Pavel Emelyanov
206acdf225 zdtm.py: Print criu action in logs
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-12 13:04:06 +03:00
Pavel Emelyanov
31944f33d6 zdtm.py: Print "test FAIL" early
In case t.kill() raises an exception (sometimes it can) it becomes unclear
what's going on.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-12 13:03:59 +03:00
Pavel Emelyanov
7cbb5e5a37 zdtm.py: Save existing environment for zdtm-in-ct
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-12 13:03:53 +03:00