[LTP] [PATCH v4 2/2] syslog11: save and restore console log level

Hongchen Zhang zhanghongchen@loongson.cn
Tue Jul 19 13:05:10 CEST 2022


the console loglevel is forced to be 7(LOGLEVEL_DEFAULT) after test,
which is not the desired behavior.So we save and restore the console
loglevel using the .save_restore interface.

Signed-off-by: Lingling Li <lilingling@loongson.cn>
Signed-off-by: Hongchen Zhang <zhanghongchen@loongson.cn>
---
 testcases/kernel/syscalls/syslog/syslog11.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/testcases/kernel/syscalls/syslog/syslog11.c b/testcases/kernel/syscalls/syslog/syslog11.c
index 8a19a2a..e60bd2b 100644
--- a/testcases/kernel/syscalls/syslog/syslog11.c
+++ b/testcases/kernel/syscalls/syslog/syslog11.c
@@ -57,6 +57,10 @@ static void run(unsigned int n)
 
 static struct tst_test test = {
 	.test = run,
+	.save_restore = (const struct tst_path_val[]) {
+		{"!/proc/sys/kernel/printk", NULL},
+		{NULL, NULL}
+	},
 	.needs_root = 1,
 	.tcnt = ARRAY_SIZE(tcases),
 };
-- 
1.8.3.1



More information about the ltp mailing list