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

1777 Commits

Author SHA1 Message Date
Tycho Andersen
34f33bd7ba tests: add a test for c/r of an empty bridge
v2: * add a zdtm.py .desc file
    * only look to make sure inet addresses match (in particular, don't
      match the state)

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-12 10:32:24 +03:00
Andrew Vagin
1c1795412e jenkins: add script to create a test container
We want to execute tests in an isolated environment

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-11 11:40:10 +03:00
Pavel Emelyanov
20088c4fcc jenkins: Move regular test on .py
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-11 11:36:18 +03: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
Andrew Vagin
2440482bcf zdtm: create devices with proper major and minor numbers
Currently numbers for /dev/net/tun and /dev/rtc are hardcoded and
they changed after the last kernel update.

Reported-by: Mr Jenkins
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-10 15:55:51 +03:00
Andrey Vagin
4aaa707260 jenkins: save report in the "test" directory
Now we save report in test/dump/report. It doesn't work when
we mount tmpfs into test/dump, because Jenkins runs in another
mount namespace.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-10 15:55:15 +03:00
Andrew Vagin
9bbb2b092c zdtm: call test_daemon when a test state is created
Otherwise a test can create or delete some mappings:

8306  getppid()                         = 83
8306  kill(83, SIGTERM)                 = 0
8306  clock_gettime(CLOCK_BOOTTIME, {1916694, 423447417}) = 0
8306  clock_gettime(CLOCK_MONOTONIC_COARSE, {1916694, 419509587}) = 0
8306  open("/etc/localtime", O_RDONLY|O_CLOEXEC)              = 3
8306  fstat(3, {st_mode=S_IFREG|0644, st_size=127, ...}) = 0
8306  fstat(3, {st_mode=S_IFREG|0644, st_size=127, ...}) = 0
8306  mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0 <unfinished ...>
8306  <... mmap resumed> )              = 0x3fffa8570000
8306  read(3, "TZif2...", 4096) = 127
8306  lseek(3, -71, SEEK_CUR)             = 56
8306  read(3, "TZif2...", 4096) = 71
8306  close(3 <unfinished ...>
8306  <... close resumed> )             = 0
8306  munmap(0x3fffa8570000, 4096 <unfinished ...>
8306  <... munmap resumed> )            = 0
8306  write(2, "12:15:36.347:    84: ( start) boottime 1916694 boottime-coarse 1916694 total_sleep_time 0\n", 90 )             = 90
8306  futex(0x10020850, FUTEX_WAIT, 0, NULL <unfinished ...>

Reported-by: Mr Jenkins
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-09 19:30:51 +03:00
Tycho Andersen
5f0b9ae1de net: ipv4: add ignore_routes_with_linkdown sysctl
Looks like this is new as of the 4.2 timeframe. It does bring up a
question: should we do a ls /proc/sys/net/conf/lo on the host to figure out
what sysctls to try and dump instead of use this hardcoded list? I guess we
need to check file modes too, because of mc_forwarding, but something like
that.

v2: add ignore_routes_with_linkdown to the end of the hardcoded devconfs
    list, so as not to break migration across criu versions.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-09 12:02:40 +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
69f6a4794f jenkins: collect an report for each run
Now zdtm.py can construct an report which contains all required
inforamtion for investigating a problem. This patch adds support
of this functionality to jenkins scripts.

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-30 14:57:01 +03: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
Andrei Vagin
abdea652a9 zdtm/netns: user correct file names for test files
We clean up test files from Makefile.
The name format for them is testname.XXX.test.

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-29 09:14:39 +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
fffbe3740b zdtm: Move netns test into ns/uns flavor
This one got lost in rebase, sorry :)

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@odin.com>
2015-10-28 16:54:02 +03:00
Pavel Emelyanov
4f3474e000 zdtm: Move netns-nf test into ns/uns flavor
After this patch it stops working in zdtm.sh launcher duo to incomplete
root constructed. Do we want to fix it?

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:51 +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
Andrey Vagin
858c30e1c6 jenkins: call fail() in a error case
fail() saves all files in an archive for further investigations.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-28 15:20:16 +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
Andrew Vagin
c51cdedcf9 jenkins: use zdtm.py for criu-iter
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-27 22:55:58 +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
Andrew Vagin
64b00b3b09 zdtm: don't execute ipc_namespace in userns (v2)
There is no permissions to set sysctl-s

v2: add the suid flag
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-26 22:15:12 +03:00
Andrew Vagin
907a444c2c zdtm: use syscalls to set hostname and domaninname
We don't have enough permissions to set sysctl-s from userns, while
system calls are ns_capable()-protected in the kernel and thus work
in user-namespaces.

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-26 22:15:04 +03:00
Pavel Emelyanov
3ec9e128de zdtm: Mark utsname as suid
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-26 15:26:47 +03:00
Andrew Vagin
7a2afe33fb zdtm: allow to execute shm and msgque in userns
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-26 12:20:14 +03:00
Andrew Vagin
fe44213e84 zdtm: allow to execute ipc_namespace and utsname tests in userns
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-26 12:20:13 +03:00
Kir Kolyshkin
e1e0f2ce56 zdtm: introduce and use pr_err()
Sometimes pr_perror() is used in places that don't have errno set.
In such places, pr_perror() should not be used as it will print
some nonsense.

Introduce and use pr_err() for such cases.

Now, I see sometimes fail() is used in such cases but I think
it is reserved for places where test fails (rather than there is
something that prevents the test from working).

Also, sometimes test_msg() is used but it doesn't print source
file name and line number.

If there will be a need, we can unify pr_err() with say fail(),
it will be easier to do after this patch.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Andrew Vagin <avagin@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-26 12:16:48 +03:00
Kir Kolyshkin
036d405312 zdtm unix_sock: don't use errno
In this place, errno is not being set and can be 0 or some random value,
so we should not use it. In case errno happens to be 0, we end up returning
a success status from a function while we should have returned a failure.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Andrew Vagin <avagin@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-26 12:13:36 +03:00
Kir Kolyshkin
40978ef32c zdtm/live/static/socket-tcpbuf: fix error message
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Andrew Vagin <avagin@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-26 12:13:27 +03:00
Kir Kolyshkin
f42bc58311 zdtm: sanitize pr_perror() usage
Log function pr_perror() automatically adds
 - numeric errno value
 - string errno value (aka strerror(errno), aka %m)
 - a newline

So, its callers don't have to do all these things.

While at it, also
 - fix or improve some message texts
 - replace fnprintf() with pr_perror()

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Andrew Vagin <avagin@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-26 12:13:16 +03:00
Kir Kolyshkin
d033577954 test_msg(): avoid recursion
In (highly unlikely) case localtime() failed, test_msg() calls
pr_perror() which is a wrapper around test_msg() so we're
calling ourselves, which can lead to infinite recursion if
localtime() keeps failing. Use fprintf() here to avoid this.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Andrew Vagin <avagin@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-26 12:12:54 +03:00