[LTP] [PATCH v1] Skip cgroup-related tests if `/sys/fs/cgroup` readonly

Richard Palethorpe rpalethorpe@suse.de
Tue Sep 26 12:27:04 CEST 2023


Hello,

Marius Kittler <mkittler@suse.de> writes:

> Otherwise clone303 fails with TBROK when `/sys/fs/cgroup` is mounted as
> read-only which is normal in a container. The test result should better
> be TCONF like it is already done in case of a permission error.
>
> Signed-off-by: Marius Kittler <mkittler@suse.de>

Reviewed-by: Richard Palethorpe <rpalethorpe@suse.com>

> ---
>  lib/tst_cgroup.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c
> index fdeac6059..5240aadaa 100644
> --- a/lib/tst_cgroup.c
> +++ b/lib/tst_cgroup.c
> @@ -383,6 +383,9 @@ static void cgroup_dir_mk(const struct cgroup_dir *const parent,
>  		tst_brk(TCONF | TERRNO,
>  			"Lack permission to make '%s/%s'; premake it or run as root",
>  			dpath, dir_name);
> +	} else if (errno == EROFS) {
> +		tst_brk(TCONF | TERRNO, "'%s/%s' must not be read-only",
> +			dpath, dir_name);
>  	} else {
>  		tst_brk(TBROK | TERRNO,
>  			"mkdirat(%d<%s>, '%s', 0777)",
> -- 
> 2.42.0


-- 
Thank you,
Richard.


More information about the ltp mailing list