Commit graph

49 commits

Author SHA1 Message Date
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
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
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
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
fb14f5d118 zdtm: remove mentions of test_init
test_init was removed a long ago

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 15:52:00 +04:00
Cyrill Gorcunov
4685b56336 zdtm: Add cpuid.h
The test for fpu transition will require to do
a runtime check for the cpu features it's running
on. For this sake we need to use cpuid. Thus make
it more widely available by providing in the general
header.

The code is adopted from the linux kernel code.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-21 17:35:44 +04:00
Andrey Vagin
b7cffae5d4 zdtm: adapt all tcp tests for ipv6
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-23 16:37:39 +04:00
Andrey Vagin
ed5f540c99 zdtm: add new test case for testing logic about COW memory (v2)
This test tests the following combinations:

1. parent and child have a cow-ed mapping
2. parent and child have just coinciding mappings

the pages state in both should be in all possible combinations of

 a. write mapped
 b. read mapped
 c. not touched
 d. before fork
 e. after fork

v2: * wait until a child are not prepared
    * check a FILE | PRIVATE mappings

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-20 20:48:36 +04:00
Andrey Vagin
c80b08643f zdtm: print string describing error number
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-02 17:43:59 +04:00
Cyrill Gorcunov
79d00c29c0 zdtm: Don't forget to create /dev/ptmx in new root
Otherwise pty tests might fault.

Reported-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-02 23:08:02 +04:00
Cyrill Gorcunov
4b99537cd4 zdtm: Mount devpts in new root
In case if we enter the new rootfs don't forget to
mount devpts, otherwise ttys can't be connected.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-02 19:21:30 +04:00
Andrey Vagin
0ee1eed5fd zdtm: simplify a case, when a root should be changed
We don't need to umount each points one by one,
if we are goning to do pivot_root().

"""
pivot_root moves the root file system of the current process to the
directory put_old and makes new_root the new root file system.
"""

So I suggest to do pivot_root() and then detach the old root, all
other mount points will be unmounted automatically.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-02 19:20:32 +04:00
Victor Konyashkin
c52be774f0 zdtm: It's need add format to fprintf
It's need add format to fprintf to avoid following error in Ubuntu 12.04:
msg.c:59:2: error: format not a string literal and no format arguments [-Werror=format-security]

Signed-off-by: Victor Konyashkin  <vkonyashkin@parallels.com>
Acked-by: Andrey Vagin <avagin@openvz.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-02 19:19:35 +04:00
Andrey Vagin
e628b63b17 zdtm: close an external tty
Redirect standard descriptors of a test init process in to the log file.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-13 16:09:13 +04:00
Andrey Vagin
499e4486f5 zdtm: run test in a new session
It was lost for tests which executed in a new namespaces.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-13 16:08:39 +04:00
Andrey Vagin
689317bf4e zdtm: add a set of function for creating a tcp connection
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-13 14:55:08 +04:00
Konstantin Khlebnikov
cfa2150490 zdtm: fix comilation for non-constant PAGE_SIZE
On some systems PAGE_SIZE is declared as sysconf(_SC_PAGESIZE) in <sys/user.h>
this is non-constant expression, so it cannot be used in type declarations.

cc -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0   -c -o ns.o ns.c
ns.c:124:7: error: variably modified ‘stack’ at file scope

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-12 14:36:30 +04:00
Konstantin Khlebnikov
dccb15cc0f zdtm: fix compilation in test_msg()
cc -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0   -c -o msg.o msg.c
msg.c: In function ‘test_msg’:
msg.c:40:6: error: variable ‘len’ set but not used [-Werror=unused-but-set-variable]

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-12 14:36:21 +04:00
Andrey Vagin
d8af1d72fa zdtm: don't use dprintf, because it's not thread safe
pthread00 hangs if dprintf is used, and works well if fprintf is used.

One more mention of this bug is here:
http://sourceware.org/bugzilla/show_bug.cgi?id=12847

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-02 01:03:10 +04:00
Andrey Vagin
c5f6a082b9 zdtm: use a current stack for preccesses created by clone()
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-28 23:19:45 +04:00
Andrey Vagin
410345a9d1 zdtm: add ability to create an external tasks
It will be used for checking tcp connections, external unix sockets, etc

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-21 15:31:59 +04:00
Andrey Vagin
c238e99b29 zdtm: rework logging
* Delete internal buffer, all data are written immediately in a log file
* Add timestamp and pid in a message
* All processes write log messages in one file

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-21 15:31:23 +04:00
Andrey Vagin
b50861327e zdtm: don't compile tests with --static
zdtm.sh copies all required libraries in a new root

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-15 15:06:49 +04:00
Andrey Vagin
6aaf65642b zdtm: move all logic about namespaces from test_init in libzdtm
A test will be executed in new set of namespaces if the environment
variable ZDTM_NEWNS is set. A pid of the root task will be written in
$ZDTM_PIDFILE and a root fyle system will be changed on $ZDTM_ROOT.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 12:56:20 +04:00
Andrey Vagin
9c1fa58c9d test_init: add support of mount namespaces
A part of code has been copied from mountpoints.c

This code umounts all points except /proc and /

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-01 07:01:29 +04:00
Andrey Vagin
368d7ac0e6 zdtm: test_init exits, if all children died
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-31 15:48:16 +04:00
Andrey Vagin
a954120154 zdtm: close a write end of a status pipe in a parent process
Otherwise a parent hangs if a child died, because
it reads from a status pipe.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-31 15:47:15 +04:00
Andrey Vagin
44c2ac9310 zdtm: test_init creates a pid file
Before this patch we use pidof to get a pid of a test process.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-31 15:47:07 +04:00
Victor Konyashkin
2fe7ed666b zdtm: It's need define CLONE_NEWIPC for redhat-el5
The patch allows define CLONE_NEWIPC for redhat-el5.

Signed-off-by: Victor Konyashkin  <vkonyashkin@parallels.com>
Acked-by: Andrey Wagin <avagin@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-31 15:08:25 +04:00
Victor Konyashkin
fc3a5ebd3d zdtm: It's need define CLONE_NEWPID for redhat-el5
The patch allows define CLONE_NEWPID for redhat-el5 to avoid error:
test_init.c:114: error: 'CLONE_NEWPID' undeclared (first use in this function)

Signed-off-by: Victor Konyashkin  <vkonyashkin@parallels.com>
Acked-by: Andrey Wagin <avagin@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-31 15:07:07 +04:00
vkonyashkin
d1a36cc98a zdtm: It's need turn off FORTIFY_SOURCE instead of use -Wno-unused-result option
The -Wno-unused-result option looks to have been introduced in GCC 4.5.0.
So it's need turn off FORTIFY_SOURCE (compiler warn about unused results
in fortification mode) instead of use -Wno-unused-result to avoid error
in versions prior to 4.5.0.

Signed-off-by: Victor Konyashkin  <vkonyashkin@parallels.com>
Acked-by: Andrey Wagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-31 14:06:04 +04:00
Andrey Vagin
23501ffe32 zdtm: add ability to set id of a test proccess
It's just easy for debugging

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-02 16:53:51 +04:00
Andrey Vagin
faf12f405b zdtm: copy futex engine from crtools (v2)
We can't reuse it from crtools, because zdtm is used separately.

v2 syscall() returns an error code in errno.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-02 16:53:50 +04:00
Andrey Vagin
877f8c8276 zdtm: simplify sys_gettid
It fix compilation on x32

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-28 20:54:12 +04:00
Cyrill Gorcunov
8d7a55ed74 zdtm: Add task_waiter_ helpers v3
Sometime we need sync points in testee program flow,
for this reason task_waiter_ introduced.

The call semantics is the following

        Parent                  Child
        ------                  -----
        task_waiter_init
                                task_waiter_wait4
        task_waiter_complete
                                task_waiter_wait4
        task_waiter_complete

                ...

Thus initially task_waiter_init should be called
to initialize all internals guts needed.

Then one become waitee and calls for task_waiter_wait4,
where lockid should be provided as an argument. Since
it should be unique values the best option might be
gettid().

The same applies to a waiter side -- it should call
for task_waiter_complete and provide a lockid.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrey Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-27 21:03:31 +04:00
Andrey Vagin
d4a5938d8f zdtm: add a test init for executing tests in PIDNS
Add a small program, which clones a process in new PIDNS and executes
a test.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 22:18:23 +04:00
Victor Konyashkin
fc8c66c629 zdtm: Need add -Wno-unused-result option lib and static Makefile
It's need to add -Wno-unused-result option to lib and
static Makefile to avoid errors like:
msg.c:58:8: error: ignoring return value of 'write', declared with
attribute warn_unused_result [-Werror=unused-result]

Signed-off-by: Victor Konyashkin <vkonyashkin@parallels.com>
Acked-by: Andrey Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-30 12:46:23 +04:00
Andrey Vagin
9fc24621d5 zdtm: delete an unused file
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-12 16:17:12 +04:00
Andrey Vagin
f53888480e zdtm: open log files with O_APPEND
I'm a paranoiac.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-11 17:39:02 +04:00
Kinsbursky Stanislav
f5f931f0aa zdtm: enhance namespaces isolation environment
1) pass cmd line args to function to clone to - required for parametrized
tests.
2) handle function result  - required for multi-process tests.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Andrey Vagin <avagin@gmail.com>
2012-02-10 12:41:57 +04:00
Kinsbursky Stanislav
c79532b435 zdtm: return positive value from clonned process
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Andrey Vagin <avagin@gmail.com>
2012-02-10 12:41:57 +04:00
Andrey Vagin
dd73699b37 zdtm: set SA_RESTART everywhere 2012-02-01 16:53:37 +04:00
Andrey Vagin
61f50a9cf9 zdtm: remove warnings 2012-01-27 13:10:12 +04:00
Andrey Vagin
af7a89778c zdtm: say no to EINTR
Everyone have known that EINTR is returned due to cpt/rst.
But it's error, we forgot to set SA_RESTART;).
2012-01-27 12:32:02 +04:00
Pavel Emelyanov
dcd64e9d10 zdtm: Test for UTS namespace
Plus a small infrastructure change to fork a test task
in a desired namespace.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-26 19:04:09 +04:00
Cyrill Gorcunov
d2f664b877 make: Eliminate deps build on no-deps targets in zdtm
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-25 19:14:39 +04:00
Andrey Vagin
5a49b9e216 zdtm: Zero Downtime Migration Test Suite
This test suite contains many small test cases for different subsystems.

Example of execution:
 # make busyloop00.pid
 # ../../../../crtools -d -t `cat busyloop00.pid`
 # kill -9 `cat busyloop00.pid`
 # ../../../../crtools -r -t `cat busyloop00.pid`
 # cat busyloop00.out
PASS

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-02 17:49:08 +04:00