2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-27 04:18:27 +00:00

23 Commits

Author SHA1 Message Date
Adrian Reber
eba1fba8b3 tests: fix builds on alpine and centos
Install sudo, create test user with ID 1000, install bash,
fix pidfile creation and pidfile chmod.

v2:
 * use sleep to give the criu daemon some time to start up

v3:
 * Andrei is of course right and sleep is not good solution.
   After adding --status-fd support to criu service, this
   is how we now detect that criu is ready.

v4:
 * This was much more complicated than expected which is related
   to the different versions of the tools on the different travis
   test targets. There seems to be a bug in bash on Ubuntu
    https://lists.gnu.org/archive/html/bug-bash/2017-07/msg00039.html
   which prevents using 'read -n1' on Ubuntu. As a workaround
   the result from CRIU's status FD is now read via python.

   Another problem was discovered on alpine with the loop restore test.
   CRIU says to use setsid even if the process is already using setsid.
   As a workaround, still with setsid, this process is now using
   shell-job true for checkpoint and restore.

Parts of v2 have been committed before. So the changes from this commit
are partially already in another commit.

Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-29 01:06:06 +03:00
Adrian Reber
396c37dd62 tests: fix builds on alpine and centos
Install sudo, create test user with ID 1000, install bash,
fix pidfile creation and pidfile chmod.

v2:
 * use sleep to give the criu daemon some time to start up

Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-23 08:25:07 +03:00
Cyrill Gorcunov
1e35bd8213 tests: others,rpc -- Tune up header
- string.h is missed for memX helpers
 - fcntl.h should be included instead of sys

With this patch the test-c is compiled on alpine tests,
but there is a problem related to the container itself

 | protoc-c --proto_path=. --c_out=. rpc.proto
 | gcc -g -Werror -Wall -I.   -c -o test-c.o test-c.c
 | gcc -g -Werror -Wall -I.   -c -o rpc.pb-c.o rpc.pb-c.c
 | gcc   test-c.o rpc.pb-c.o  -lprotobuf-c -o test-c
 | protoc --proto_path=. --python_out=. rpc.proto
 | cp ../../../criu/criu criu
 | chmod u+s criu
 | mkdir -p build
 | chmod a+rwx build
 | sudo -g '#1000' -u '#1000' ./criu service -v4 -W build -o service.log --address criu_service.socket -d --pidfile pidfile
 | make: sudo: Command not found

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-22 00:15:35 +03:00
Adrian Reber
50fd9df6c5 test/others/rpc: also run RPC version command via service
This extends the test.py to also run the RPC command VERSION via 'criu
service'. It was already running using 'criu swrk'.

Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-19 19:59:13 +03:00
Adrian Reber
df9ffa10bc test/other/rpc: resurrect the RPC test cases
In this directory there are various test cases using CRIU in RPC mode
(or SWRK mode).

This fixes the broken tests by moving the start of 'criu service' from
run.sh to the Makefile as the test cases is running using "sudo -g
'#1000' -u '#1000'" and the PID file created by CRIU can only be read by
the root user. If starting the 'criu service' before run.sh the PID file
still can be changed to 0666 and fixing the test script.

This also adds version.py to the test cases that are executed.

Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-19 19:59:13 +03:00
Andrei Vagin
1d5438310b test/other: add a test to check the --shell-job option
This test creates a pty pair, creates a test process and sets a slave
pty as control terminal for it.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-04-06 02:37:28 +03:00
Dmitry Safonov
057c3f2947 python: specify python2 as .py interpreter
On some distro the default python interpreter is Python 3,
which results in such errors:
>  Running zdtm/static/socket-tcp-closed.hook(--post-start)
>  make[1]: Nothing to be done for default.
>  ./socket-tcp-closed --pidfile=socket-tcp-closed.pid --outfile=socket-tcp-closed.out
>    File "zdtm/static/socket-tcp-closed.hook", line 16
>      except OSError, e:
>                    ^
>  SyntaxError: invalid syntax
>  ######### Test zdtm/static/socket-tcp-closed FAIL at hook --post-start #########
>  Running zdtm/static/socket-tcp-closed.hook(--clean)
>    File "zdtm/static/socket-tcp-closed.hook", line 16
>      except OSError, e:
>                    ^
>  SyntaxError: invalid syntax
>  Traceback (most recent call last):
>    File "zdtm.py", line 1921, in <module>
>      do_run_test(tinfo[0], tinfo[1], tinfo[2], tinfo[3])
>    File "zdtm.py", line 1388, in do_run_test
>      try_run_hook(t, ["--clean"])
>    File "zdtm.py", line 1053, in try_run_hook
>      raise test_fail_exc("hook " + " ".join(args))
>  __main__.test_fail_exc: <__main__.test_fail_exc instance at 0x76294468>

Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-04-17 18:35:58 +03:00
Adrian Reber
bc169fefb1 RPC: add script to test the new RPC version interface
This script connects to 'criu swrk' and asks for the version. If running
from a git checkout the output would look like this:

 $ ./version.py
 Connecting to CRIU in swrk mode to check the version:
 RPC: Success
 CRIU major 2
 CRIU minor 12
 CRIU gitid v2.12-635-g6d3ae4d

If not running from git checkout it looks like this:

 $ ./version.py
 Connecting to CRIU in swrk mode to check the version:
 RPC: Success
 CRIU major 2
 CRIU minor 12

If running with a CRIU binary which does not support the VERSION
command:

 $ ./version.py
 Connecting to CRIU in swrk mode to check the version:
 Error (cr-service.c:116): RPC error: Invalid req: Success
 RPC: Unexpected msg type

Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-04-11 09:01:10 +03:00
Kir Kolyshkin
e3f0c52596 travis: add "make uninstall" test
"make uninstall" is supposed to remove all the files that
"make install" (with the same arguments) have created.
This is a test to check that.

PS ideally, "make uninstall" should also remove any empty directories,
but let's not care about it for now.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-04-02 18:09:34 +03:00
Venkateswara Rao Mandela
a2225308c9 test/others/rpc: fix build error
Build in tests/others/rpc folder was failing due to the use of LDFLAGS
variable instead of LDLIBS variable to link libprotobuf-c. The makefile
uses implicit build rules.

$(CC) $(LDFLAGS) n.o $(LOADLIBES) $(LDLIBS)

Using LDFLAGS places -llibprotobuf-c before the object files, preventing
the library from being searched for required functions.  This commit
changes the variable to LDLIBS instead to fix the issue.

travis-ci: success for test/others/rpc: fix build error
Signed-off-by: Venkateswara Rao Mandela <venkat.mandela@ti.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-12-05 11:49:18 +03:00
Andrew Vagin
d4f01fa532 test/other: check criu exec
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-01 16:51:33 +03:00
Andrew Vagin
87270c8147 others/mnt-ext-dev: Force mke2fs to create a filesystem
It's required because we specify a file instead of a block device.

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-08-01 16:51:05 +03:00
Sebastian Pipping
78ab4a548f Add missing "proto2" syntax marker
.. to address protobuf 3.x proto-c warnings

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-07 12:38:39 +03:00
Ruslan Kuprieiev
947358a9ed test: add manual test for criu-coredump
Convert criu images to coredumps and check if they are
readable by readelf.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:04:00 +03:00
Ruslan Kuprieiev
e569e46b31 test: fix manual crit test
In automated tests we use test/crit-recode.py because of performance
benefits(no need to launch python interpreter more than once), but
manual test is still useful for manual testing, so lets make it
work again.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:04:00 +03:00
Andrew Vagin
d44276c143 zdtm: check mounts of external devices
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-05-27 13:31:14 +03:00
Andrew Vagin
aa40501d95 test/ext-tty: return an error if a child isn't killed by SIGHUP
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-03-16 16:16:07 +03:00
Pavel Emelyanov
f91d3f01a5 zdtm: Move crit test into others
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-29 11:36:05 +03:00
Andrew Vagin
17018b3c18 tests/others: a few fixes of paths
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-29 11:35:32 +03:00
Andrew Vagin
ee3bea7b88 tests: remove "live" from zdtm paths
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-29 11:35:30 +03:00
Andrew Vagin
f6d9d8d41a tests: move app-emu in test/others/
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-29 11:35:26 +03:00
Andrew Vagin
2cb4532e26 tests: remove zdtm.sh (v2)
It was replaced by zdtm.py.

v2: remove zdtm.sh from other scripts
    remove fault-injection, because nobody uses it

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-24 13:09:57 +03:00
Andrew Vagin
88aaae3ace tests: move non-zdtm tests to tests/others/
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-24 13:09:17 +03:00