Skip to contentSkip to conversation

Skip cgroup-related tests if `/sys/fs/cgroup` readonly

PATCH In review Marius Kittler 4 participants 7 messages Sep 25, 2023 – Sep 27, 2023 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Skip cgroup-related tests if `/sys/fs/cgroup` readonly

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.

---
 lib/tst_cgroup.c | 3 +++
 1 file changed, 3 insertions(+)
lib/tst_cgroup.c +3 -0
index fdeac6059..5240aadaa 100644
@@ -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)",
Signature · 5 lines
2.42.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v1 1/1
#1 lore raw

Hi all,

Quoted 3 lines

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.

IMHO another candidate for merging before release.

Kind regards,
Petr

Quoted 19 lines
---
 lib/tst_cgroup.c | 3 +++
 1 file changed, 3 insertions(+)
lib/tst_cgroup.c +3 -0
index fdeac6059..5240aadaa 100644
@@ -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)",
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Tested-by Wei Gao
#2 lore raw
Quoted 7 lines · Petr Vorel

Hi all,

Quoted 3 lines

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.

Quoted 28 lines

IMHO another candidate for merging before release.

Kind regards,
Petr

Quoted 19 lines
---
 lib/tst_cgroup.c | 3 +++
 1 file changed, 3 insertions(+)
lib/tst_cgroup.c +3 -0
index fdeac6059..5240aadaa 100644
@@ -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)",
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw

Hi,

...

Quoted 2 lines
Quoted 1 line

^
Unwanted whitespace before the tag.

Wei, please don't put this whitespace space next time.

Not only this is wrong, but it breaks automatic adding of your tag. Patchwork (https://patchwork.ozlabs.org/project/ltp/list/) which we use for downloading patches automatically adds all tags associated with the patch, unless there is whitespace before the tag.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#4 lore raw
Quoted 8 lines · Petr Vorel

Hi,

...

Quoted 2 lines
Quoted 1 line

^
Unwanted whitespace before the tag.

Quoted 6 lines

Wei, please don't put this whitespace space next time.

Not only this is wrong, but it breaks automatic adding of your tag. Patchwork (https://patchwork.ozlabs.org/project/ltp/list/) which we use for downloading patches automatically adds all tags associated with the patch, unless there is whitespace before the tag.

Got it. Thanks for correcting the error.

Quoted 3 lines

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v1 1/1
#5 lore raw
In reply to Marius Kittler

Hello,

Quoted 5 lines · Marius Kittler

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.

Quoted 20 lines
---
 lib/tst_cgroup.c | 3 +++
 1 file changed, 3 insertions(+)
lib/tst_cgroup.c +3 -0
index fdeac6059..5240aadaa 100644
@@ -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)",
Signature · 1 line
2.42.0
Signature · 5 lines
Thank you,
Richard.

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#6 lore raw

Hi Richie, Wei,

thanks for your review/testing, merged.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp