2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-26 03:47:35 +00:00

231 Commits

Author SHA1 Message Date
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
Pavel Emelyanov
6460badfdf zdtm: Construct all root dirs and files in launcher
Instead of doing some dirs/files/links in launcher and some in
libzdtm, make everything in the launcher. The library is then
just to set up the namespaces.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-03 14:55:13 +03:00
Tycho Andersen
bfb24cec8b zdtm.py: don't umount in clean_tests_root
If we get EBUSY here, it means that we didn't umount in the test (i.e. we
didn't call fini() on some path). We should just do that instead.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-03 14:54:40 +03:00
Pavel Emelyanov
c1b1880b34 zdtm: Check how auto-dedup works
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-30 11:44:57 +03:00
Andrew Vagin
32452b2111 zdtm.py: umount root only if it was mounted
We get the stack trace if a test failed:

Test output: ================================
09:11:34.584:     4: PASS

 <<< ================================
Traceback (most recent call last):
  File "zdtm.py", line 922, in <module>
    do_run_test(tinfo[0], tinfo[1], tinfo[2], tinfo[3])
  File "zdtm.py", line 696, in do_run_test
    t.kill()
  File "zdtm.py", line 302, in kill
    self.__flavor.fini()
  File "zdtm.py", line 168, in fini
    subprocess.check_call(["mount", "--make-private", self.root])
  File "/usr/lib64/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['mount', '--make-private', '/tmp/criu-root-YN1t3X']' returned non-zero exit status 32
umount: /tmp/criu-root-YN1t3X: not mounted

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@parallels.com>
2015-11-25 15:30:32 +03:00
Pavel Emelyanov
0a8667dfd7 zdtm: Make thread-bomb be bomb
In current implementation of thread bomb effectively only one
thread runs, the rest sit in the read from pipe.

Fix this by making threads constantly creating new ones and
just exiting.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
2015-11-20 21:17:34 +03:00
Pavel Emelyanov
8f36b7af2f zdtm.py: Ability to generate criu strace-s for sat.py
There's a sat.py script in criu-scripts repo that analyzes the strace
outputs. It's useful to check the amount of system calls criu takes to
do dump or restore of certain apps.

So add the --sat key to zdtm.py that would generate sat-able logs for
individual tests.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-17 13:13:52 +03:00
Pavel Emelyanov
8e30ef722c zdtm.py: Properly report FAIL if test dependency file doesn't exist
Right now report looks like generic python exception about
inability to copy some file.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-17 10:54:13 +03:00
Pavel Emelyanov
bada292932 zdtm.py: Fix race in root construction
If two ns_flavor.init() are called in parallel then all the os.mkdir()
calls would end up with EEXISTS exception.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-13 15:16:56 +03:00
Pavel Emelyanov
a96320604b zdtm.py: Do not run tests marked with excl in parallel (v2)
There are tests (e.g. on locks) that can conflict with each other, so
wait for all the other jobs to finish before running such.

v2:
  Wait for the excl test to finish before launching more of them.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-13 15:16:36 +03:00
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