[CRIU] [PATCH] test: check, that parasite can rollback itself
Pavel Emelyanov
xemul at parallels.com
Fri Jun 14 07:37:53 EDT 2013
On 06/14/2013 03:31 PM, Andrey Vagin wrote:
> This test uses systemtap to replace the fourth parasite command on
I don't like "the fourth" part. Can we randomize it?
> 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.
>
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
> test/Makefile | 9 ++++++++-
> test/fault-injection/Makefile | 2 ++
> test/fault-injection/parasite.stp | 32 ++++++++++++++++++++++++++++++++
> 3 files changed, 42 insertions(+), 1 deletion(-)
> create mode 100644 test/fault-injection/Makefile
> create mode 100644 test/fault-injection/parasite.stp
>
> diff --git a/test/Makefile b/test/Makefile
> index df46688..3e6e656 100644
> --- a/test/Makefile
> +++ b/test/Makefile
> @@ -3,12 +3,19 @@ EXP = '^ns/(?!.*(tty|pty))'
>
> .FORCE:
>
> +all: .FORCE
> + $(MAKE) zdtm
> + $(MAKE) -C fault-injection
> +
> 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
> diff --git a/test/fault-injection/Makefile b/test/fault-injection/Makefile
> new file mode 100644
> index 0000000..501e37f
> --- /dev/null
> +++ b/test/fault-injection/Makefile
> @@ -0,0 +1,2 @@
> +all:
> + stap -g -d ../../criu parasite.stp -c 'bash -x ../zdtm.sh -d static/sigpending'
> diff --git a/test/fault-injection/parasite.stp b/test/fault-injection/parasite.stp
> new file mode 100644
> index 0000000..0b1a400
> --- /dev/null
> +++ b/test/fault-injection/parasite.stp
> @@ -0,0 +1,32 @@
> +global i
> +
> +probe process("../../criu").begin
> +{
> + i = 0;
> +}
> +
> +probe process("../../criu").function("__parasite_execute_daemon")
> +{
> + printf("%s\n", $$parms);
> +
> + if (i++ > 3) {
> + 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 ($return)
> + $return = 0;
> + else {
> + printf("criu exited with zero code\n");
> + $return = 1;
> + }
> +}
>
More information about the CRIU
mailing list