mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 06:15:24 +00:00
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>
This commit is contained in:
committed by
Pavel Emelyanov
parent
0a1b70bb23
commit
b95407e264
@@ -3,12 +3,18 @@ EXP = '^ns/(?!.*(tty|pty))'
|
||||
|
||||
.FORCE:
|
||||
|
||||
all: .FORCE
|
||||
$(MAKE) zdtm
|
||||
|
||||
zdtm: .FORCE
|
||||
$(MAKE) zdtm_ns
|
||||
for t in $(shell echo "$(TST)" | tr ' ' '\n' | grep -Pv $(EXP)); do \
|
||||
$(MAKE) $$t || break; \
|
||||
done
|
||||
|
||||
|
||||
fault-injection: .FORCE
|
||||
$(MAKE) -C fault-injection
|
||||
|
||||
zdtm_ns: $(shell echo "$(TST)" | tr ' ' '\n' | grep -P $(EXP))
|
||||
$(TST):
|
||||
./zdtm.sh $(@) &> $(subst /,_,$@).log
|
||||
|
2
test/fault-injection/Makefile
Normal file
2
test/fault-injection/Makefile
Normal file
@@ -0,0 +1,2 @@
|
||||
all:
|
||||
stap -g -d ../../criu parasite.stp $$RANDOM -c 'bash -x ../zdtm.sh -d -x socket-tcp'
|
44
test/fault-injection/parasite.stp
Normal file
44
test/fault-injection/parasite.stp
Normal file
@@ -0,0 +1,44 @@
|
||||
global i, n, fini_cmd = -1, last_cmd
|
||||
|
||||
probe process("../../criu").begin
|
||||
{
|
||||
i = 0;
|
||||
/* randint() returns numbers multiple of 5 */
|
||||
n = randint(20 * 5) / 5
|
||||
printf("The %d command will be replaced on -1\n", n);
|
||||
}
|
||||
|
||||
probe process("../../criu").function("__parasite_execute_daemon")
|
||||
{
|
||||
printf("%s\n", $$parms);
|
||||
last_cmd = $cmd;
|
||||
if (++i > n) {
|
||||
printf("Send invalid command to parasite\n");
|
||||
$cmd = -1;
|
||||
}
|
||||
}
|
||||
|
||||
probe process("../../criu").function("__parasite_execute_daemon").return
|
||||
{
|
||||
printf("%d\n", $return);
|
||||
}
|
||||
|
||||
probe process("../../criu").function("main").return
|
||||
{
|
||||
printf("CRIU exits with code %d\n", $return);
|
||||
if ( i > n) {
|
||||
if ($return)
|
||||
$return = 0;
|
||||
else {
|
||||
printf("CRIU exited with zero code\n");
|
||||
if (fini_cmd < 0 || fini_cmd == last_cmd) {
|
||||
printf("%d looks like FINI command\n", n);
|
||||
fini_cmd = last_cmd
|
||||
} else {
|
||||
printf("This is the second FINI command %d (%d)",
|
||||
n, fini_cmd);
|
||||
$return = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user