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

1777 Commits

Author SHA1 Message Date
Andrew Vagin
7b84bc8811 tempfs: check inaccessible tempfs mounts
criu dump should return an error in this case

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-05-27 13:31:45 +03:00
Andrew Vagin
aee6cca66a zdtm: check enabled file systems
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-05-27 13:31:43 +03:00
Andrew Vagin
bfe7f6dce5 zdtm: remove bashisms from hooks
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-05-27 13:31:14 +03:00
Andrew Vagin
a1709f6e75 zdtm/cwd02: typo fix
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-05-27 13:31:14 +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
Cyrill Gorcunov
4912da57fb test: sigaltstack -- Setup proper stack size
We use test_msg helper inside alternative stack
which in turn allocates TEST_MSG_BUFFER_SIZE
by its own, so we increased the stack storage
in @stack_thread and @stack_main but miss to
inform the kernel about bigger stack size.

Thus in worst scenario we can screwup the stack
so provide proper size here.

Reported-by: Vasily Averin <vvs@virtuozzo.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-05-13 13:56:33 +03:00
Andrei Vagin
7fdbfba40a zdtm/atomic: atomic_inc should return the old value
00:24:30.269:    44: ERR: test.c:208: Test exited on unexpected signal

It's a correct name for this function. For example, we use this name
here criu/arch/ppc64/include/asm/atomic.h

And you can find the same set of functions here:
test/zdtm/lib/arch/aarch64/include/asm/atomic.h

I think this code is more readable (understandable) than just
return t - 1.

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-05-06 14:39:27 +03:00
Andrew Vagin
9d03d77f20 zdtm: check a ghost file in a read-only directory
=[log]=> dump/zdtm/static/unlink_fstat00/39/1/restore.log
------------------------ grep Error ------------------------
(00.097701)      4: Error (files-reg.c:1231): Can't link zdtm/static/unlink_fstat00.test/test\file'
(00.097707)      4: Error (files-reg.c:1431): Can't link zdtm/static/unlink_fstat00.test/test\file'
(00.097952)      1: Error (cr-restore.c:1404): 4 exited, status=1
(00.108085) Error (cr-restore.c:1407): 64 killed by signal 9: Killed
(00.114341) Error (cr-restore.c:2246): Restoring FAILED.
------------------------ ERROR OVER ------------------------

v2: add a new test instead of changing the existing one.
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-05-06 14:39:27 +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
Pavel Emelyanov
4576a03385 tests: Check that no-breakpoints restore works
v2: Don't clear_breakpoints too.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-05-06 14:38:29 +03:00
Kirill Tkhai
781601a053 zdtm: Custom file names in binfmt_misc test
If several copies of binfmt_misc test are running, we may fail because of duplicate names.
Fix that by giving a custom name for registered /proc/sys/fs/binfmt_misc/xxx.

################## Test zdtm/static/binfmt_misc FAIL at start ##################
Test output: ================================
18:03:33.594: 4: string: :magic_file:M:9:\x73\x51\xff\x4a\xec\x29\xcd\xba\xab\xf2::/bin/interpreter:OCP
18:03:33.594: 4: FAIL: binfmt_misc.c:133: write magic_file (errno = 22 (Invalid argument))
18:03:33.594: 3: ERR: test.c:204: Test exited unexpectedly with code 1

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-27 14:12:25 +03:00
Andrew Vagin
7a2068e374 zdtm: fix compilation of netns-dev
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-27 14:11:03 +03:00
Pavel Tikhomirov
0d8289d852 zdtm/net/ipv4: rename devconfs4 and rand_limit4 and dir4
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-27 14:11:03 +03:00
Pavel Tikhomirov
ae682757fd net/ipv4: add new sysctls
drop_unicast_in_l2_multicast and drop_gratuitous_arp appeared in MS:

commit 12b74dfadb5a ("ipv4: add option to drop unicast encapsulated in
L2 multicast")
commit 97daf3314550 ("ipv4: add option to drop gratuitous ARP packets")

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-27 14:11:03 +03:00
Andrew Vagin
6e7e2efc5e criu: check without file descriptors
Cc: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Acked-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-21 16:21:24 +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
Andrew Vagin
52fe2af2f3 zdtm: non-root user can't dump aio01 (v2)
v2: copy aio00.desc

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-07 13:54:56 +03:00
Kirill Tkhai
3ed375809e zdtm: Add aio01 test
Description:

1)Create io context, submit several io operations and
get events of some of them.

2)Sleep on signal.

3)Check tail, head and nr events restored correct.

4)Emit one more io operation.

5)Check tail has moved one number forward (i.e. synchronize
in-kernel and userspace tails if they were different).

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-07 13:54:55 +03:00
Dmitry Safonov
35f209ff76 fault: add dump pages fault for parasite_dump_pages_seized
Parasite should cleanup after fauilure and remove read-protection
from VMAs. Check it with maps00 test & fault injection.

Tested on travis with some addition:
python test/zdtm.py run -t zdtm/static/maps00 --fault 3 --keep-going --report report -f h || false
https://travis-ci.org/0x7f454c46/criu/jobs/119252291

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-04 17:10:15 +03:00
Pavel Emelyanov
070d420be6 test: Check nomemfd parasite injection
By default criu tries to create parasite mem with memfd syscall,
which is present in many systems. Let's check also the legacy way.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-04 17:10:14 +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
Cyrill Gorcunov
afbc03ee15 tests: remap_dead_pid[_root] -- Run in namespace only
These tests check for file descriptor being assigned
to the pid which is freed already, so check them
in PID namespace only, otherwise the kernel may
give PID someone else and the check from
commit c4cf5f0b7638a679be65b05bdb8269d34c2a4573
might trigger and stop testing procedure.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-01 18:06:30 +03:00
Andrew Vagin
08ff91d966 jenkins: build a coverage report if GCOV is set (v2)
v2: set umask to 0000. It's required to generate gcda, gcno files
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-04-01 18:06:29 +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
Andrew Vagin
8d23e3342f jenkins: use a full name of the --keep-img option
+ ./test/zdtm.py run --all -f best -x maps04 -x cgroup02 --norst --keep always
usage: CRIU test suite run [-h] [-a] [-t TEST] [-T TESTS] [-f FLAVOR]
                           [-x EXCLUDE] [--sibling] [--pre PRE] [--snaps]
                           [--dedup] [--nocr] [--norst] [--iters ITERS]
                           [--fault FAULT] [--sat] [--sbs]
                           [--freezecg FREEZECG] [--user] [--page-server]
                           [-p PARALLEL] [--dry-run]
                           [-k {always,never,failed}] [--report REPORT]
                           [--keep-going]
CRIU test suite run: error: ambiguous option: --keep could match --keep-img, --keep-going

It worked fine without the --keep-going option.

[xemul: Remove the --keep-going and --report options, the run
        of zdtm.py is not of much interest for TAP ]

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
229a6edfbd jenkins: change jenkins script to run full set of tests
add options --keep-going and --report (if it was absent)
to run full testrun with report creation

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: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
Andrey Vagin
69adfe7b5c zdtm: emulate a situation with invalid files in irmap cache
Fixes #134

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-25 23:36:13 +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
Andrew Vagin
9892355192 zdtm/mountpoints: clean up
Now, we execute this test in a test mount namespace, which contains only
test mounts.

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-16 16:16:08 +03:00
Andrew Vagin
3006ada21d jenkins: add a script to execute tests on overlayfs
Here are all tests which pass now

And I created an issue to investigate fails of other tests:
https://github.com/xemul/criu/issues/136

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
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
Andrew Vagin
aa40501d95 test/ext-tty: return an error if a child isn't killed by SIGHUP
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
Andrew Vagin
ab8fdf82b3 zdtm: Check a private mount in a shared mount
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-09 12:56:02 +03:00
Pavel Emelyanov
fbdc00391d zdtm: Relax on-stack args for ns creation
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-09 12:49:57 +03:00
Pavel Emelyanov
c88d40991a zdtm: Factor out pidfiles creation
After the pidfile manipulation is sanitized, we can have
a helper for pidfile wrting.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-09 12:49:55 +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