It works for tests which are executed in a separate pidns
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
When running test in ns/uns flavor zdtm.py builds a temp root in test/ directory.
The new action allows to remove all this stuff automatically.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
When debugging it's useful to stop zdtm.py at certain points and
check what's going on out there. For this the --sbs (step-by-step)
option is introduced. It will make zdtm.py stop and wait for user
keypress before dump, before restore and after restore.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
Generated files are often analyzed after test, so it's handy to have
their full names on the screen at once.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
Right now zdtm spawns test into a pseudo-container and redirects its
output in a temp file. This is done not to mix outputs of tests, running
in parallel, with each other.
But if we run tests one by one or there's only one test in the list
we can safely print the output right on the screen.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
If someone wants to run all tests in any, but the most
difficult for criu, flavor, the 'best' one is introduced.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Ruslan Kuprieiev <rkuprieiev@cloudlinux.com>
Currently launcher doesn't know that some tests are skipped
and draws incorrect progress bar :)
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Ruslan Kuprieiev <rkuprieiev@cloudlinux.com>
So here's the new test class that handles the test from
groups set. The class is inherited from zdtm_test one as
what it does is -- starts the pseudo-init in ns/uns flavors
and asks one to spawn() the sub-tests from the list.
All groups tests can only be run inside ns flavor, so if
the host flavor is asked, just the pseudo-init is spawned.
This is because using ns flavor is the easiest way to spawn
all the sub tests under this init (however, h flavor can be
supported by marking the pseudo-init as sub-reaper).
On stop this pseudo-init is signalled to stop, it in turn
stops all the sub-tests and then exits. When the pid
namespace destruction is complete, the sub-tests .out-s are
checked.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Introduce yet another tests set called 'groups'. Each test
in this set is a list of existing zdtm tests that can be
started side-by-side in an ns flavor.
To 'create' such a test the zdtm.py group action is used,
which lists tests and semi-randomly groups them together.
The grouping possibility is checked by comparing the .desc
files of those -- desc-s should coincide. One exception is
test dependencies, these are just merged together.
After running the group action there appears groups/ dir
with tests each containing just the list of zdtm tests
that are in a group. The respective .desc file is also
generated and this one matches the .desc for tests inside.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This is -- add ability to pull more than one binary into
mntns root and ability to start zdtm test with more stuff
in the environment than generated in start method itself.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
When using non-run command the 'sat' option is not in opts dict,
so it should be checked with softer method.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Instead of doing some dirs/files/links in launcher and some in
libzdtm, make everything in the launcher. The library is then
just to set up the namespaces.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
If we get EBUSY here, it means that we didn't umount in the test (i.e. we
didn't call fini() on some path). We should just do that instead.
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
We get the stack trace if a test failed:
Test output: ================================
09:11:34.584: 4: PASS
<<< ================================
Traceback (most recent call last):
File "zdtm.py", line 922, in <module>
do_run_test(tinfo[0], tinfo[1], tinfo[2], tinfo[3])
File "zdtm.py", line 696, in do_run_test
t.kill()
File "zdtm.py", line 302, in kill
self.__flavor.fini()
File "zdtm.py", line 168, in fini
subprocess.check_call(["mount", "--make-private", self.root])
File "/usr/lib64/python2.7/subprocess.py", line 540, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['mount', '--make-private', '/tmp/criu-root-YN1t3X']' returned non-zero exit status 32
umount: /tmp/criu-root-YN1t3X: not mounted
Cc: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
In current implementation of thread bomb effectively only one
thread runs, the rest sit in the read from pipe.
Fix this by making threads constantly creating new ones and
just exiting.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
There's a sat.py script in criu-scripts repo that analyzes the strace
outputs. It's useful to check the amount of system calls criu takes to
do dump or restore of certain apps.
So add the --sat key to zdtm.py that would generate sat-able logs for
individual tests.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
If two ns_flavor.init() are called in parallel then all the os.mkdir()
calls would end up with EEXISTS exception.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
There are tests (e.g. on locks) that can conflict with each other, so
wait for all the other jobs to finish before running such.
v2:
Wait for the excl test to finish before launching more of them.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
It seems with the new zdtm.py that pids collide a lot more (perhaps because
everything is in its own pid namespace? not sure). In any case, this is
annoying as it prevents a second run of the tests from actually getting to
the test part.
So, let's try to move the old directory out of the way.
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Most python uses spaces, so that's probably what people have their editors
configured to do. Since this file uses tabs, let's be explicit about it.
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This avoids problems like:
$ sudo ./zdtm.py run -a
Skipping test zdtm/live/static/mem-touch (manual run only)
./sock_opts00 --pidfile=sock_opts00.pid --outfile=sock_opts00.out
./sock_opts00 --pidfile=sock_opts00.pid --outfile=sock_opts00.out
==================== Run zdtm/live/static/sock_opts00 in h =====================
Start test
Test is SUID
Run CRIU: [dump -o dump.log -D dump/zdtm/live/static/sock_opts00/74/1 -v4 -t 74 --pidfile /home/ubuntu/criu/test/zdtm/live/static/sock_opts00.pid]
Run CRIU: [restore -o restore.log -D dump/zdtm/live/static/sock_opts00/74/1 -v4 --pidfile /home/ubuntu/criu/test/zdtm/live/static/sock_opts00.pid --restore-detached]
Wait for zdtm/live/static/sock_opts00 to die for 0.100000
Remvoing dump/zdtm/live/static/sock_opts00/74
==================== Test zdtm/live/static/sock_opts00 PASS ====================
==================== Run zdtm/live/static/sock_opts00 in ns ====================
Construct root for zdtm/live/static/sock_opts00
Start test
Test is SUID
Traceback (most recent call last):
File "zdtm.py", line 850, in <module>
do_run_test(tinfo[0], tinfo[1], tinfo[2], tinfo[3])
File "zdtm.py", line 641, in do_run_test
cr(cr_api, t, opts)
File "zdtm.py", line 562, in cr
cr_api.set_test(test)
File "zdtm.py", line 469, in set_test
os.makedirs(self.__dump_path)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 17] File exists: 'dump/zdtm/live/static/sock_opts00/153'
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "zdtm.py", line 46, in clean_tests_root
os.rmdir(tests_root)
OSError: [Errno 16] Device or resource busy: '/tmp/criu-root-MmGEQD'
Error in sys.exitfunc:
Traceback (most recent call last):
File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "zdtm.py", line 46, in clean_tests_root
os.rmdir(tests_root)
OSError: [Errno 16] Device or resource busy: '/tmp/criu-root-MmGEQD'
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
On debian/ubuntu systems, we don't have a /bin/env by default; on rhel
systems (my limited testing seems to indcate that) /usr/bin/env is a
symlink to /bin/env, so let's just use that so it works everywhere.
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
It's very inconvenient to read the zdtm.py output with long
lines of options.
Reported-by: Andrey Vagin <avagin@odin.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Otherwise make's output appears in logs before zdtm.py's one
Reported-by: Andrey Vagin <avagin@odin.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
First -- set cannot be made out of lists (and maps lists contain lists of pairs)
Second -- it is much better to read map diffs in hex, rather than ints (as they
would be if repr-ed by default)
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
It allows to execute zdtm.py not only from the test directory.
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This script prepares the cgroups hierarchies that are used by
tests to avoid creation of those in parallel with tests, that
do not expect them to appear.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>