Commit graph

408 commits

Author SHA1 Message Date
Pavel Emelyanov
1abb8782a8 page-server: Implement holes writing into pagemap
Just add new protocol command and call local_xfer->write_hole on
server side. Also tune the mem-snap test to test memory xfer via
page server.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-18 17:34:47 +04:00
Pavel Emelyanov
68bfaeb852 test: Rise verbosity of mem-snap test's dump
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-16 12:17:15 +04:00
Pavel Emelyanov
78b8abe9a5 test: Add test for memory snapshots
Two args (optional) -- number of snaps (3 defail) and pause
between them (4 defail).

Uses memory toucher from zdtm/.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-15 14:50:09 +04:00
Kir Kolyshkin
4eb723db98 Fix typos in messages from test suite
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-15 12:46:01 +04:00
Pavel Emelyanov
ea5b03cefa zdtm: Test for manual (for now) testing
This guy touches a random page once per second and backs-up
what was touched. At the end it checks whether everything is
OK. It can be used to test how snapshots work -- take several
snapshots with several seconds pauses in betweem and restore
form the last.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-12 19:45:28 +04:00
Andrey Vagin
82ac1ae325 zdtm: add fanotify00 in the default list
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-11 22:06:55 +04:00
Alexander Kartashov
4498dffce3 zdtm.sh: fixed shared libraries retrieval
The pipe retrieving shared libraries the test depends on

ldd $test_path $ps_path | awk '/^\s/{ print $1 }'

doesn't actually produce any output so all NS tests fail
bacause the system linker fails to locate shared libraries
the test program depends on. This patch fixes the pipe
to retrieve the list of libraries properly.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-11 19:59:49 +04:00
Cyrill Gorcunov
3c3a249e29 test: zdtm -- Fix fanotify00 test
@mnt_id do change on remount so exclude it from
compare.

Reported-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Tested-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-11 19:58:40 +04:00
Andrey Vagin
6a54f17411 zdtm: don't create loops of bind mounts
Before this patch crtools/test is bound to crtools/test/dump/crtools.XXXXXXX

It's a main reason why "make clean" deletes all content from crtools/test.

Always when you have a test bind mount. You have a test bind mount, when
a test is executed. You execute a test sometimes. So "make clean"
deletes all content sometimes;).

This patch fixes this problem.

Actually this patch fixes more significan problem. If / is a shared
mount (it's defult in FC19),
$ mount --bind crtools/test crtools/test/dump/crtools.XXXXXXX
will recursively copy all previous bind mounts.

E.g:

cd crtools/test
make -j 4
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.b86wVA ext4 rw,relatime,data=ordered 0 0
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.DMoEZv ext4 rw,relatime,data=ordered 0 0
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.b86wVA/dump/crtools-root.DMoEZv ext4 rw,relatime,data=ordered 0 0
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.oLnVTw ext4 rw,relatime,data=ordered 0 0
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.DMoEZv/dump/crtools-root.oLnVTw ext4 rw,relatime,data=ordered 0 0
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.b86wVA/dump/crtools-root.DMoEZv/dump/crtools-root.oLnVTw ext4 rw,relatime,data=ordered 0 0
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.b86wVA/dump/crtools-root.oLnVTw ext4 rw,relatime,data=ordered 0 0
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.7zQrDs ext4 rw,relatime,data=ordered 0 0
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.oLnVTw/dump/crtools-root.7zQrDs ext4 rw,relatime,data=ordered 0 0
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.DMoEZv/dump/crtools-root.oLnVTw/dump/crtools-root.7zQrDs ext4 rw,relatime,data=ordered 0 0
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.b86wVA/dump/crtools-root.DMoEZv/dump/crtools-root.oLnVTw/dump/crtools-root.7zQrDs ext4 rw,relatime,data=ordered 0 0
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.b86wVA/dump/crtools-root.oLnVTw/dump/crtools-root.7zQrDs ext4 rw,relatime,data=ordered 0 0
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.DMoEZv/dump/crtools-root.7zQrDs ext4 rw,relatime,data=ordered 0 0
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.b86wVA/dump/crtools-root.DMoEZv/dump/crtools-root.7zQrDs ext4 rw,relatime,data=ordered 0 0
/dev/mapper/vg-lv_root /root/crtools/test/dump/crtools-root.b86wVA/dump/crtools-root.7zQrDs ext4 rw,relatime,data=ordered 0 0

make -j 32 generates ~2^32 mounts.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-11 15:31:25 +04:00
Andrey Vagin
edc865361e zdtm: print an error message and exit if exec failed
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-10 01:24:08 +04:00
Alexander Kartashov
4200d42ee6 session02: hard-code the value of the macro CLONE_STACK_SIZE
The macro PAGE_SIZE is declared in the following way in Debian:

 #define PAGE_SIZE               (sysconf(_SC_PAGESIZE))

that makes it impossible to use the macro as the size of
the array clone_args::stack since this generates the following error:

cc -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -iquote ../../lib/arch/arm/include -I../../lib   session02.c ../../lib/libzdtmtst.a   -o session02
session02.c:70:7: error: variably modified 'stack' at file scope

Cc: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-04 14:07:20 +04:00
Andrey Vagin
58f0955d81 zdtm: each test file name should contain a test name
It's required for per-test cleaning.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-01 20:12:04 +04:00
Andrey Vagin
ddc6789dca test: don't skip errors if someone fails
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-01 20:10:05 +04:00
Andrey Vagin
1b234fd890 zdtm: show a process tree before and after c/r
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-01 12:31:14 +04:00
Andrew Vagin
cc97a2d012 zdtm: add one more test case to create a process tree (v2)
Actually this test case is a frame work for creating a process tree.
It creates a process tree according with a predefined sequence of
actions.

This test case create the following process tree:
  5     5  \_ session02               ( 0)
  6     6      \_ session02           ( 1)
  8     7      |   \_ session02       ( 3)
 15    12      |   \_ session02       (10)
 10    10      \_ session02           ( 5)
 11     7          \_ session02       ( 6)
 13    12          \_ session02       ( 8)

v2: improve log messages

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-01 12:31:12 +04:00
Andrey Vagin
0b492b0b10 zdtm: protect random pages in maps04
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-30 00:17:36 +04:00
Andrew Vagin
f16d7c64e5 mount: remove root with MS_PRIVATE before cleaning up mntns
Otherwise we will clean up the root mntns too.

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-27 17:28:30 +04:00
Andrew Vagin
929a0f24fd mount: remove root with MS_PRIVATE before pivot_root
Otherwise if the root is mounted with MS_SHARED, pivot_root fails with EINVAL.

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-27 17:28:27 +04:00
Andrey Vagin
c721df565a zdtm: execute sigpending and sk-netlink only on linux-cr
The functionality for dumping signals and netlink sockets are not merged
in the upstream kernel yet.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-27 15:52:43 +04:00
Andrey Vagin
282aaf2cba zdtm: add a test case for netlink sockets
* create two bound socket (for unicase and broadcase messages),
  a connected socket, an unbound and unconnected socket.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 00:24:30 +04:00
Andrey Vagin
07a1a33fd6 zdtm.sh: add static/sigpending in the default set
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-25 23:44:12 +04:00
Andrey Vagin
13e9291b51 zdtm: add a test case for pending signals
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-25 23:43:30 +04:00
Andrey Vagin
967ca651a8 tty: restore sid on master points only (v2)
If a master point has sid, it doesn't mean, that all slave points
will have sid. Look at tty03 for example:

  PID   SID TT       COMMAND
26748 26748 ?        tty03
26749 26749 pts/2     \_ tty03
26750 26750 ?             \_ tty03

The second process has not a file descriptor for the ctl tty,
but this tty is opened in tty03.

v2: If a slave point with sid has not a master point, the option
--shell-job must be set and sid isn't restored for such terminals.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-19 23:01:51 +04:00
Andrey Vagin
ef726ad51d zdtm: one more test case for controlling terminals
PID   SID TT       COMMAND
26748 26748 ?        tty03
26749 26749 pts/2     \_ tty03
26750 26750 ?             \_ tty03

The second process has not a file descriptor for the ctl tty,
but this tty is opened in tty03.

Currently CRIU can not restore this test case correctly.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-19 23:01:27 +04:00
Andrey Vagin
f2664d6524 pipe: don't reopen pipes via /proc, if it's not required
The system call open can add O_LARGEFILE.

A point is reopend for unsharing a file descriptor. So here are two
types of points. One is returned by pipe() and all other ones are
got via opening /proc/PID/fd.

Currently I know only one difference between these types, it's
O_LARGEFILE.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Tested-by: Alexander Kartashov <alekskartashov@parallels.com
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-19 23:00:59 +04:00
Pavel Emelyanov
9486946b81 zdtm: Return x perms back
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-15 17:31:21 +04:00
Andrey Vagin
a4f4ca73a1 zdtm: check unshared descriptors for one end of a pipe
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-14 19:36:17 +04:00
Andrey Vagin
7dc741f4f8 app-emu/lxc: create /var/run/netns/
In Fedora /var/run is on tmpfs, so all directories should be
recreated each times.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-14 19:35:36 +04:00
Pavel Emelyanov
36b96d1e8a zdtm: Test how page server works
When -p is used, launch page server in the same dir as
crtools dump is to get fill dump in it.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-14 18:16:46 +04:00
Andrey Vagin
a59fd3533f zdtm: make datagen/datachk faster for big chunks
Generate random data only for buffers with sizes less than FAST_SIZE
If a size of buffer is more that FAST_SIZE, the first FAST_SIZE bytes
are filled by random generator and then this chunk is used as pattern
for all other chunks.

With out this patch:
$ time bash -x test/zdtm.sh static/maps04
real	0m16.777s
user	0m0.054s
sys	0m0.724s

With this patch:
$ time bash -x test/zdtm.sh static/maps04
real	0m1.865s
user	0m0.128s
sys	0m0.745s

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-06 00:34:02 +04:00
Cyrill Gorcunov
28f063ab9c zdtm: ipc_namespace: Bound min/max for mqueue/msg_max
Otherwise
 | 11:03:13.524: 19446: ERR: ipc_namespace.c:212: Can't write 0 into /proc/sys/fs/mqueue/msg_max (errno = 22 (Invalid argument))
 | 11:03:13.524: 19446: ERR: ipc_namespace.c:273: Failed to randomize ipc namespace tunables (errno = 22 (Invalid argument))
 | 11:03:13.524: 19446: ERR: ipc_namespace.c:336: Failed to randomize ipc ns before migration (errno = 22 (Invalid argument))
 | 11:03:13.527: 19445: ERR: test.c:298: Test exited with unexpectedly with code 1 (errno = 4 (Interrupted system call))

https://bugzilla.openvz.org/show_bug.cgi?id=2530

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-06 00:32:07 +04:00
Andrey Vagin
50a20dfbdc zdtm: fix race in test_waitsig for multithreaded tests
A signal can be handled by non-leader thread and sigsuspend
will not be woken up.

kill can send signals to a specified thread, so a futex is used for
synchronization.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-06 00:31:14 +04:00
Pavel Emelyanov
fd0d380112 zdtm: Test HUGE mappings to dump/restore OK
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-01 20:13:42 +04:00
Andrew Vagin
d767625be9 zdtm.sh: fix the mainstream-kernel tests list
Currently the mainstream-kernel tests list is equal to cr test list.

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-20 14:26:54 +04:00
Cyrill Gorcunov
7a74043c59 zdtm: Add mmap03 test case
To be able to test it one need indeed enough
physical memory on the node (at least 16G).
Thus I don't include this test for regular
passes.

Inspired by commit 40dcaf885e

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-06 21:20:23 +04:00
Cyrill Gorcunov
96dd1d22d0 zdtm: Unlink link_remap files once dump complete
In case if only "dump" procedure is invoked we left service
"link_remap.%d" file(s) on disk. This prevents next "dump"
procedure of same test to fail because we hit the situation
where same named "link_remap.%d" already exist.

So, if test is passed with "-d" option we remove the link remap
file at the end.

Also with this patch we start passing --link-remap option
only for tests which have "unlink_" prefix in name. This applies
some limitation on how test could be named, thus maybe we need
more flexible solution here.

https://bugzilla.openvz.org/show_bug.cgi?id=2489

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-06 21:07:16 +04:00
Cyrill Gorcunov
8afd8a4cb2 zdtm: make -- Add -f key on clean* ops
Otherwise if no such files present I'm getting warnings.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-06 01:40:34 +04:00
Andrey Vagin
ccbbb18ae2 zdtm: check that file permissions are restored for unix sockets
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-30 03:28:09 +04:00
Alexander Kartashov
d9adda7cd1 zdtm: autodetect the target machine v2
Andrew Vagin pointed out that the static testsuite compilation
may run as standalone so the variable ARCH won't be available.

This patch introduces the facility test/zdtm/Makefile.inc
designated to detect the target machine automatically
if the variable ARCH isn't defined. This makefile is supposed
to be included into all test subsuite Makefiles.

Andrew Vagin also pointed out that machine-dependent tests
may be added into non-static subsuites as well so the macro
adding machine-specific headers into CPPFLAGS goes to
the file test/zdtm/Makefile.inc.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-24 15:16:39 +04:00
Alexander Kartashov
8fa8ca9feb arm: added ARM-specific files modelled after arch/x86
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-22 22:53:24 +04:00
Alexander Kartashov
31f9ef8f90 zdtm: moved lib/atomic.h to lib/arch/x86/include/asm/atomic.h
The file lib/atomic.h is the only machine-dependent file in the test suite
that breaks compilation of the test static/session01 on ARM.

The file is moved into a separate directory and the build system is modified
accordingly to prevent this.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-22 22:52:00 +04:00
Andrey Vagin
5500145557 test: add ability to execute tests in parallel
All tests which executed in pid namespaces can be executed in parallel.

$ make zdtm_ns
real	0m54.806s
user	0m2.779s
sys	0m4.338s

$ make -j zdtm_ns
real	0m11.587s
user	0m3.361s
sys	0m5.134s

Another feature of this patch is that the subset of parallel tests is
executed before the subset of sequential tests.

If a first subset are not failed, the second one has a small chance to
fail, so a most part of bugs will be found in a few first seconds.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-22 22:48:00 +04:00
Andrey Vagin
f35bfe1f7d zdtm.sh: exec cleanout per test
It's required for parallel execution of tests.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-22 22:47:58 +04:00
Andrey Vagin
c8484f10ef zdtm: add ablitiy to execute cleanout per test
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-22 22:47:56 +04:00
Andrey Vagin
324e432cbb zdtm: get a test file name from arguments
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-21 17:39:18 +04:00
Andrey Vagin
abdaea2421 zdtm: don't hardcode file names
A test should get file names from arguments

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-21 17:39:13 +04:00
Andrey Vagin
cd88cafc37 app-emu/lxc: dump/restore file locks
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-21 17:36:38 +04:00
Andrey Vagin
ab2d10c247 zdtm: move file_locks test-cases to the common list
In this case they will be executed in other name-spaces.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-21 17:35:08 +04:00
Cyrill Gorcunov
8587f7dec1 zdtm: sched_prio -- Add missing headers
On glibc-2.16 I'm getting

 | sched_prio00.c: In function ‘main’:
 | sched_prio00.c:48:3: error: implicit declaration of function ‘setpriority’ [-Werror=implicit-function-declaration]
 | sched_prio00.c:48:19: error: ‘PRIO_PROCESS’ undeclared (first use in this function)
 | sched_prio00.c:48:19: note: each undeclared identifier is reported only once for each function it appears in
 | sched_prio00.c:60:3: error: implicit declaration of function ‘getpriority’ [-Werror=implicit-function-declaration]

fix it adding headers needed.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-21 17:32:18 +04:00
Qiang Huang
4a70646335 zdtm: add flock file lock's test case
We check shared lock, exclusive lock and mandatory-read lock for flock
file locks. After restore, by parsing /proc/locks file, we check if
the process holds the same file locks as it was dumped.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-17 14:42:50 +04:00