[CRIU] [PATCH 3/4] fi: Test that parasite can cure itself

Andrew Vagin avagin at odin.com
Mon Sep 28 06:10:09 PDT 2015


On Thu, Sep 24, 2015 at 06:08:12PM +0300, Pavel Emelyanov wrote:
> For this the static/env00 test is marked with .fault
> file, criu dump is asked to abort right after parasite
> infection. The "correctly failed dump" is then the one
> that leaves test running.
> 
> Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
> ---
>  cr-dump.c                         |  6 ++++++
>  include/fault-injection.h         |  1 +
>  test/zdtm.sh                      |  3 +++
>  test/zdtm/live/static/env00.fault | 15 +++++++++++++++
>  4 files changed, 25 insertions(+)
>  create mode 100755 test/zdtm/live/static/env00.fault
> 
> diff --git a/cr-dump.c b/cr-dump.c
> index 3af077b..8c49795 100644
> --- a/cr-dump.c
> +++ b/cr-dump.c
> @@ -80,6 +80,7 @@
>  #include "lsm.h"
>  #include "seccomp.h"
>  #include "seize.h"
> +#include "fault-injection.h"
>  
>  #include "asm/dump.h"
>  
> @@ -1193,6 +1194,11 @@ static int dump_one_task(struct pstree_item *item)
>  		goto err;
>  	}
>  
> +	if (fault_injected(FI_DUMP_EARLY)) {
> +		pr_info("fault: CRIU sudden detach\n");
> +		BUG();
> +	}
> +
>  	if (root_ns_mask & CLONE_NEWPID && root_item == item) {
>  		int pfd;
>  
> diff --git a/include/fault-injection.h b/include/fault-injection.h
> index 97531e6..31826ba 100644
> --- a/include/fault-injection.h
> +++ b/include/fault-injection.h
> @@ -4,6 +4,7 @@
>  
>  enum faults {
>  	FI_NONE = 0,
> +	FI_DUMP_EARLY,
>  	FI_MAX,
>  };
>  
> diff --git a/test/zdtm.sh b/test/zdtm.sh
> index b0cf868..75bc439 100755
> --- a/test/zdtm.sh
> +++ b/test/zdtm.sh
> @@ -211,6 +211,7 @@ generate_test_list()
>  		static/apparmor
>  		ns/static/apparmor
>  		static/different_creds
> +		finj/static/env00
>  	"
>  
>  	TEST_CR_KERNEL="
> diff --git a/test/zdtm/live/static/env00.fault b/test/zdtm/live/static/env00.fault
> new file mode 100755
> index 0000000..4a09293
> --- /dev/null
> +++ b/test/zdtm/live/static/env00.fault
> @@ -0,0 +1,15 @@
> +#!/bin/bash
> +#fault:1
> +if [ "$1" != "dump" ]; then
> +	echo "Unexpected CRIU fail @$1"
> +	exit 1
> +fi
> +
> +pid=$(pidof 'env00')
> +if [ -z "$pid" ]; then
> +	echo "Test died when CRIU did."
> +	exit 1
> +fi
> +
> +echo "Looks OK"
> +exit 0

Do you check results of this test in this case?

> -- 
> 1.9.3
> 
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list