Skip to contentSkip to conversation

zram03: unload zram when it is loaded during test run

PATCH In review Xiao Liang 2 participants 4 messages Sep 5, 2022

lore
Share & tools
lore

Xiao Liang

author
#0 lore raw

PATCH 1/1 zram03: unload zram when it is loaded during test run

---
 testcases/kernel/device-drivers/zram/zram03.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
testcases/kernel/device-drivers/zram/zram03.c +8 -9
index b9867a573..98eb61e1c 100644
@@ -187,16 +187,15 @@ static void setup(void)
 
 	 /* zram module was built in or being used on old kernel */
 	SAFE_CMD(cmd_modprobe, NULL, NULL);
-	if (access(ZRAM_CONTROL_PATH, F_OK)) {
-		file = SAFE_FOPEN("/proc/modules", "r");
-		while (fgets(line, sizeof(line), file)) {
-			if (strstr(line, "zram")) {
-				modprobe = 1;
-				break;
-			}
+	file = SAFE_FOPEN("/proc/modules", "r");
+	while (fgets(line, sizeof(line), file)) {
+		if (strstr(line, "zram")) {
+			modprobe = 1;
+			break;
 		}
-		SAFE_FCLOSE(file);
-
+	}
+	SAFE_FCLOSE(file);
+	if (access(ZRAM_CONTROL_PATH, F_OK)) {
 		if (modprobe) {
 			tst_res(TINFO,
 				"rmmod zram before test on old kernel without zram-control interface");
Signature · 5 lines
2.37.2


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

Hi Xiao,

Indeed, test does not unload zram on older kernels without zram-control interface. Good catch!

Kind regards,
Petr

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

Hi Xiao,

Quoted 2 lines

Indeed, test does not unload zram on older kernels without zram-control interface. Good catch!

I was wrong, for both cases the module was kept even not loaded before. Anyway merged, thanks for your fix!

Kind regards,
Petr

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

Thanks, Petr

Rgs,
Frank

Quoted 11 lines · Petr Vorel

Hi Xiao,

Quoted 2 lines

Indeed, test does not unload zram on older kernels without zram-control interface. Good catch!

I was wrong, for both cases the module was kept even not loaded before. Anyway merged, thanks for your fix!

Kind regards,
Petr

Signature · 2 lines
-- 
Mailing list info: https://lists.linux.it/listinfo/ltp