[CRIU] [PATCH] tests: be extra defensive about /dev and /dev/pts

Pavel Emelyanov xemul at virtuozzo.com
Fri Feb 12 06:49:58 PST 2016


> diff --git a/test/zdtm/lib/ns.c b/test/zdtm/lib/ns.c
> index bc5c395..812872a 100644
> --- a/test/zdtm/lib/ns.c
> +++ b/test/zdtm/lib/ns.c
> @@ -93,6 +93,21 @@ static int prepare_mntns(void)
>  		return -1;
>  	}
>  
> +	if (mkdir("/dev", 0777) && errno != EEXIST) {
> +		fprintf(stderr, "mkdir(/dev) failed: %m\n");
> +		return -1;
> +	}
> +
> +	if (mount("devtmpfs", "/dev", "devtmpfs", 0, NULL)) {
> +		fprintf(stderr, "mount(/dev) failed: %m\n");
> +		return -1;
> +	}

The /dev is populated in zdtm.py's __construct_root, this mount would just ruin
the whole thing.

Did you manage to find out why /dev gets killed during tests?

> +
> +	if (mkdir("/dev/pts", 0777) && errno != EEXIST) {
> +		fprintf(stderr, "mkdir(/dev) failed: %m\n");
> +		return -1;
> +	}
> +
>  	if (mount("pts", "/dev/pts", "devpts", MS_MGC_VAL, "mode=666,ptmxmode=666,newinstance")) {
>  		fprintf(stderr, "mount(/dev/pts) failed: %m\n");
>  		return -1;
> 



More information about the CRIU mailing list