Commit graph

496 commits

Author SHA1 Message Date
Andrew Vagin
20a835a686 zdtm: return back tun test to auto-list
The kernel was compiled without the tun driver.

This reverts commit 889a21292f.

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-28 17:17:43 +04:00
Andrey Vagin
1806f0f6c5 zdtm: set the dumpable flag after setuid and setgid (v2)
setuid and setgid drops the dumpable flag, so it should be set back.
Otherwise proccesses will not able to read a few files in proc (e.g.
/proc/pid/pagemap).

This patch affects cow01:
11:50:04.429:     4: ERR: cow01.c:99: Unable to read data (errno = 13 (No such file or directory))

v2: typo fix
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-28 17:17:18 +04:00
Andrey Vagin
5b3d657707 Revert "zdtm.sh: dump traffic for *tcpbuf* tests"
This reverts commit 21d94e0086.

This patch was created for investigating
https://bugzilla.openvz.org/show_bug.cgi?id=2676

The bug is fixed and this patch does nothing useful, because tcpdump
starts too late.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-28 17:02:49 +04:00
Ruslan Kuprieiev
f6654dc411 v4 zdtm: test semi-closed unix stream connection for data loss
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-28 16:52:45 +04:00
Pavel Emelyanov
5d66f72c92 zdtm: Check tap's hwaddr doesn't change after c/r
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-24 01:08:03 +04:00
Pavel Emelyanov
889a21292f zdtm: Drop tun test from auto-list
There's some strange setup on Jenkins boxes, so that /dev/net/tun
is inaccessible. Need to check this after holidays :(

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-23 19:38:12 +04:00
Pavel Emelyanov
ed5f82c7e6 zdtm: Basic checks for tun files/links are c/r-ed properly
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-23 19:12:00 +04:00
Yicheng Qin
7daefd9751 test/zdtm: add option -r to run test with specified name
The option can run test with specified name directly without check
or match.

It can be used to run experimental test that is not in TEST_LIST.

Signed-off-by: Yicheng Qin <yichengq@google.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-21 17:33:10 +04:00
Andrey Vagin
0c5b606b48 zdtm: add a new test, where both sides of a tcp connection is dumped
Reported-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-20 14:58:14 +04:00
Andrey Vagin
4329287717 zdtm: clean up test_fork
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-20 14:57:13 +04:00
Yicheng Qin
156b1b8195 test: create env.sh for environment setting
Currently, env.sh only contains the location of criu executable.

Signed-off-by: Yicheng Qin <yichengq@google.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-20 14:52:34 +04:00
Yicheng Qin
f1684be8a4 test/tcp/run.sh: fix permission
Signed-off-by: Yicheng Qin <yichengq@google.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-20 14:51:52 +04:00
Pavel Emelyanov
33c70a244e zdtm: Simplify TEST_LIST formation
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-16 17:17:13 +04:00
Pavel Emelyanov
a9e10c6056 zdtm: Remove explicit namespaces specification on restore
Yet again -- namespaces are auto-detected now, no need in this.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-16 17:15:59 +04:00
Pavel Emelyanov
aa7e079d8c zdtm: Remove per-namespace list
We have automatic namespaces detection, no need in this.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-16 17:14:15 +04:00
Andrey Vagin
3e6f1ae82d zdtm: exit with the zero code if everything is ok
Cc: Yicheng Qin <yichengq@google.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-14 14:47:20 +04:00
Yicheng Qin
05745ceed4 test/zdtm: add option -n for batch test
In batch-test mode, the script skips failed individual tests
instead of exiting. This ensures that all zdtm tests can be run
in one pass, which provides better overview of test result.

Signed-off-by: Yicheng Qin <yichengq@google.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-14 13:43:07 +04:00
Yicheng Qin
a7a787a402 test: adjust the output for tests
Adjust the format of information printed.
Print out more necessary debug information.
Display error message in STDERR and make it more readable.

Signed-off-by: Yicheng Qin <yichengq@google.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-14 13:43:06 +04:00
Yicheng Qin
073af12d5f test/zdtm: use TEST_PATTERN as argument
Use TEST_PATTERN instead of TEST_NAME as argument.
All previous zdtm commands can be used still.
It is useful to run certain part of tests.

Example of running in-namespace tests only:
	./test/zdtm.sh ^ns/.*

Signed-off-by: Yicheng Qin <yichengq@google.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-13 14:24:57 +04:00
Yicheng Qin
8891bb759d test/zdtm: add -g option to generate binary only
Add -g option in zdtm.sh.

Using -g option can just generate binaries of all
tests to run in zdtm. Moreover, appending test name after
-g option can just generate the binary for the test.

Signed-off-by: Yicheng Qin <yichengq@google.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-13 14:24:55 +04:00
Yicheng Qin
62ca87d58b test/zdtm: clear unused variable "FILE_LOCK_TEST_LIST"
Signed-off-by: Yicheng Qin <yichengq@google.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-13 14:22:42 +04:00
Andrey Vagin
eef4853cc4 zdtm: add a new test case for checking vma-s with the MAP_GROWSDOWN flags
Here are two case:
* check that a vma grows after restoring
* check that a vma can be restored if its guard page was overlapped by
  another vma.

Currently criu isn't able to dump/restore this test case. Who wants to
fix this issue?

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-09 15:40:17 +04:00
Yicheng Qin
e2c6abcb6a test/zdtm/cwd00: add error checking to cleanup code
The checking helps debug unexpected failures.

The patch is useful to debug test failure. Chdir() may meet failure
if the process does not have enough permissioin. Then, it cannot
rename in-progress output file to output file. Finally, test script
cannot catch 'PASS' flag from the output file and record it as
failure. As the result, the test fails without any error message.

Signed-off-by: Yicheng Qin <yichengq@google.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-07 12:45:06 +04:00
Yicheng Qin
fdfaf0a769 test/zdtm/cwd00: remove redundant chdir()
Label 'out' and chdir() below it are just redundant. Remove them
to make test simple.

Signed-off-by: Yicheng Qin <yichengq@google.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-07 12:43:41 +04:00
Yicheng Qin
73a6dcbc9f test/zdtm/sockets_dgram: Use shorter pathname to support
struct sockaddr_un

Struct sockaddr_un is used in program for bind() to listen on a local file.

Path is one of its attributes and only has 108-byte size. It may happen
that the path is too small to contain the whole real path, which contains
current working directory now. This may lead to two sockets listening on
the same file.

So, we change the path to be "/tmp". It ensures that filename cannot
exceed the limit.

Additionally, to run it well with namespace, make new directory named
'tmp' under constructed root.

Signed-off-by: Yicheng Qin <yichengq@google.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-07 12:27:11 +04:00
Yicheng Qin
de0c3b9519 test/zdtm/sockets_dgram: check the length of path used
Path generated in the test is copied into sun_path attribute in
struct sockaddr_un. Additional check on whether sun_path can
contain the whole path is added. It is useful because if sun_path
can only contain the first part of the path, all sockadd_un
will point to the same location, which leads to error.

Signed-off-by: Yicheng Qin <yichengq@google.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-07 12:15:36 +04:00
Andrey Vagin
b95407e264 test: check, that parasite can rollback itself (v2)
This test uses systemtap to replace random parasite command on
invalide command. The parasite code received this command and should
rollback itself. CRIU didn't recived ack, should understand that
something wrong and exits. The systemtap inverts exit code of criu.

"zdtm.sh -d" is used for executing tests and testing that the state of
processes don't corrupted.

criu should be compiled without optimizations (make DEBUG=1)

v2: randomize a command, which will be replaced
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-06 15:11:12 +04:00
Yicheng Qin
b20ee87785 test/zdtm/mountpoints: clear the umask when creating
/dev/null

Clear the umask when creating /dev/null and restore the umask
after the creation.
Mountpoints test unlinks and makes new /dev/null inside by mknod.
But in some linux, there is default umask, e.g., as 022. It means that
/dev/null created directly cannot be wrote by group and other users.
It is not reasonable because /dev/null should be accessable to all
users.

Signed-off-by: Yicheng Qin <yichengq@google.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-06 14:19:52 +04:00
Cyrill Gorcunov
fe01c987a6 test: fanotify00 -- Add missing space in output
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-06 14:17:40 +04:00
Andrey Vagin
a3f7a16fe7 zdtm: check that overmounted parts of tmpfs are restored
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-05 18:06:42 +04:00
Andrey Vagin
2508d051ac zdtm: the post-dump scripts returns zero, if action is not post-dump
All scripts are executed for all actions, so if one of them failed for
any actions, crtools returns with non-zero code.
E.g: ./zdtm.sh -d ns/static/env00

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-24 19:10:49 +04:00
Andrey Vagin
29ade09411 zdtm.sh: wait page-server by a proper way
page-server is forked and the child is running in background, so a bash
variable $! contains PID of the last command, which is executed in
background.

Currently it's tcpdump and zdtm.sh is waiting it and never returns back.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-24 19:10:23 +04:00
Cyrill Gorcunov
ff0e96dcf9 zdtm: Use "post-dump" script for "-d" and "-s" option
v2:
 - Use special opcode 32 to distinguish error cases
 - Use --scripts for snapshot testings
v3:
 - test for both 32 and 0 for error code
v4: (by avagin@)
 - restore from the last snapshot
v5:
 - update comment

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

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-22 19:36:47 +04:00
Andrey Vagin
21d94e0086 zdtm.sh: dump traffic for *tcpbuf* tests
Sometimes these tests don't pass successfully and we need more
information to investigate the problem.

https://bugzilla.openvz.org/show_bug.cgi?id=2676
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-22 16:37:12 +04:00
Andrey Vagin
b18a4d9555 socket-tcpbuf: fix the message
The number of bytes, which were sent and received, should be
exchanged in the message

Thanked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-12 18:16:27 +04:00
Andrey Vagin
f38fe4480c zdtm: use tkill instead of kill in sigaltstack
Each signals should be sent to a proper thread..

Probably it was a reason of a error, which was caught yesterday
+ cat zdtm/live/static/sigaltstack.out
20:57:10.933:  4380:        thread in sas: at 0x6083e0 (size   0x2000 flags 0x1)
20:57:10.934:  4380: Waiting in thread SAS
20:57:11.219:  4380: Thread may leave SAS
20:57:11.219:  4380: Leaving thread SAS
20:57:11.219:  4380:        leader in sas: at 0x6083e0 (size   0x2000 flags 0x1)
20:57:11.219:  4380:             main old: at 0x6063e0 (size   0x2000 flags 0x1)
20:57:11.220:  4380:             main new: at 0x6083e0 (size   0x2000 flags 0x1)
20:57:11.220:  4380:             thrd old: at 0x6083e0 (size   0x2000 flags 0x1)
20:57:11.220:  4380:             thrd new: at 0x6083e0 (size   0x2000 flags 0x1)
20:57:11.220:  4380: FAIL: sigaltstack.c:163: sas not restored (errno = 11 (Resource temporarily unavailable))

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

Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-12 18:10:32 +04:00
Andrey Vagin
ae44dd36a1 zdtm: exclude vdso before modifing output of ldd
ldd pipe00:
linux-vdso.so.1 =>  (0x00007fffbb0cb000)

Currently the first part of line is dropts, if the line contains "=>",
so we need to exclude vdso, before modifing lines.

This patch fixes bug:
$ zdtm.sh ns/static/pipe00
Failed at  (0x00007fffa49fe000)

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-11 22:32:27 +04:00
Andrey Vagin
1795ddca0e zdtm: fix path to libriries on RPi
Remove the first part from linues like this:
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6d83000)

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-11 19:05:31 +04:00
Andrey Vagin
ab9296cf61 zdtm: hide output of commands, which checks existence of something
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-11 15:35:59 +04:00
Andrey Vagin
ccb2b04f7c zdtm: don't print useless messages from Makefile
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-11 15:35:51 +04:00
Andrey Vagin
9a0eedb6d2 zdtm: remove many useless messages from make
make: Entering directory `/root/crtools/test/zdtm/live/static'
make -C ../../lib
make[1]: Entering directory `/root/crtools/test/zdtm/lib'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/root/crtools/test/zdtm/lib'
rm -f -f -r env00.pid env00.out* *env00.test* env00.*.test env00.state
make: Leaving directory `/root/crtools/test/zdtm/live/static'
pid00 caps00 maps01 groups sched_prio00 sched_policy00 sock_opts00 sock_opts01 cmdlinenv00 packet_sock fanotify00 sk-netlink
make: Entering directory `/root/crtools/test/zdtm/live/static'
make -C ../../lib
make[1]: Entering directory `/root/crtools/test/zdtm/lib'

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-11 15:35:40 +04:00
Andrey Vagin
0c2df44daf zdtm: remove error messages, that this directory is exist
Like this:
mkdir: cannot create directory ‘/tmp/criu-root.wt2oW0/lib64’: File exists

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-11 15:35:23 +04:00
Andrew Vagin
231f88a684 zdtm: define PAGE_SIZE in zdtmtst.h
This patches fixes compilation on Raspberry Pi and
removes a few defines from tests.

msg.c: In function ‘test_msg’:
msg.c:41:11: error: ‘PAGE_SIZE’ undeclared (first use in this function)

CC: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-11 15:31:56 +04:00
Andrey Vagin
a66a06c7f0 zdtm: wait a test process instead of output file
zdtm.sh reports error immediatly, if a test process exited or crashed.

We should be fear, that pid can be reused. There are many place, which
will fail in this case. And a chance to get this situation is really small.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-11 15:31:22 +04:00
Cyrill Gorcunov
535115eecd test: zdtm -- Add test for alternative signal stack
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-11 14:05:12 +04:00
Andrey Vagin
55fe093908 zdtm: don't destruct an external mount-namespace
Before doing something with mounts they should be marked as private,
otherwise our actions can affects someone else.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-08 13:39:22 +04:00
Pavel Emelyanov
c8f3e09f17 zdtm: Add test for semi-closed unix connection
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-02 02:30:14 +04:00
Cyrill Gorcunov
b62df5c986 test: app-emu -- Fix typo in command line
$pid variable get chopped by editor

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-01 19:39:45 +04:00
Cyrill Gorcunov
47faeca62c test: app-emu -- Use new -v syntax
We've slightly updated -v option argument parsing,
thus update cmdline used in a few app-emu tests.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-01 19:31:09 +04:00
Andrey Vagin
1b2c3e699b zdtm: don't take into account cpt/rst time in posix_timer
Add cpt/rst timeout to inaccuracy.

All timers are stopped during cpt/rst. We don't know in which moment
they are stopped and run, so this timeout is added to acceptable
inaccuracy.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-01 18:41:02 +04:00