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>
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>
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 40dcaf885eaf3f2f51d08ecb6c18c3f948655c6e
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
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>
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>
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>
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>
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>
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>
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>
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>
We check read lock and write lock for posix file locks. After restore,
we use fcntl(fd, F_GETLK, &lock), to see if the file is hold the same
lock as it was dumped.
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Just reading if event entry exist in buffer is not
enough we rathee need to be sure that all flags
and bits are recovered well.
For this sake we parse fdinfo before and after the
c/r sessions and compare results.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
As Andrew pointed the logically it's more correct to use
err() instead of fail() if test_daemon() has not been
used.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This one is pretty trivial and need to be extented for
more masks and flags, but fine for now.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
A bash script exits with code of a last command,
so zdtm.sh return 1 if TMP_TREE is not initialized.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This functionality can help to test a patch set:
for i in `git rev-list HEAD~15..HEAD`; do
./test/zdtm.sh -c $i || break;
done
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
It's more convinient for a few reasons
* don't need to recompile sources for each test case
* don't change the current tree
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
A binary is required to get shared library dependencies
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
zdtm.sh launched by an absolute path exits with an error due to
an incorrect path to crtools
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
zdtm.sh -b <commit>
* save a current head, rollback on <commit> and compile crtools
* execute a test and dump its processes
* checkout the current head and comple crtools
* restore test processes and check results
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
* Replaced the shell interpreter with bash to run
the script test/zdtm.sh correctly.
* Added new directories into the routine contruct_root()
searched by the Debian version of the dynamic linker.
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
On my FC17 box calloc calls brk() and the subsequent mprotect(PROT_EXEC)
fails with EACCESS. Using mmap is safer here.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Kernel started with 3.8-rc1 are not report non-existent caps in
/proc/pid/status, so crtools doesn't dump/restore such caps.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
We should explicitly unlink old /dev/null instance, otherwise
if such device already exist we might hit a problem as
| (00.002984) 7412 fdinfo 0: pos: 0x 0 flags: 100002/0
| (00.003015) Dumping path for 0 fd via self 42 [/dev/null]
| (00.003025) Error (files-reg.c:422): Unaccessible path opened 2049:109720, need 5:10
| (00.003033) Error (cr-dump.c:1565): Dump files (pid: 7412) failed with -1
Reported-by: Alexander Kartashov <alekskartashov@parallels.com>
Tested-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Since we supprt FPU c/r now we can run
these tests.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This test loads ymm0/ymm7 registers and check if after
restore the contents is not changed.
The test requires xsave capability to present on the
test system, thus if we figure out that there is no
suitable cpu provided we skip the test.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
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>
Content of /proc/$pid/auxv declared as array of long and this file hasn't compat layer.
https://jira.sw.ru/browse/PSBM-16280
Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
* add exclude list. Tests from this list are executed only on C/R kernels
* check that a version of a kernel is greater than 3.7
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
The SO_BINDTODEVICE getter is changed in the kernel (before
official release) to report not index, but name to be in
harmony with setter.
Fix crtools accordingly.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>