diff mbox series

[BlueZ,1/2] test-runner: set non-quiet printk before running tests

Message ID 859a1c176765dbb9ea394dde387b8ed072365ca8.1689180344.git.pav@iki.fi
State New
Headers show
Series [BlueZ,1/2] test-runner: set non-quiet printk before running tests | expand

Commit Message

Pauli Virtanen July 12, 2023, 4:47 p.m. UTC
It is useful to see WARN_ON/bt_dev_err messages when running the tests.
Enable non-quiet printk levels after boot, so that it is on by default
and doesn't need to be handled in local test scripts.
---

Notes:
    It could be useful to also check for BUG/WARNING in the bluez test bot.

 tools/test-runner.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff mbox series

Patch

diff --git a/tools/test-runner.c b/tools/test-runner.c
index d74bb1087..288901a61 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -136,6 +136,20 @@  static const char *config_table[] = {
 	NULL
 };
 
+static void enable_printk(void)
+{
+	FILE *f;
+
+	/* Set non-quiet printk level */
+	f = fopen("/proc/sys/kernel/printk", "w");
+	if (!f) {
+		perror("Failed to set printk");
+		return;
+	}
+	fprintf(f, "7 4 1 7");
+	fclose(f);
+}
+
 static void prepare_sandbox(void)
 {
 	int i;
@@ -181,6 +195,8 @@  static void prepare_sandbox(void)
 				"mode=0755") < 0)
 			perror("Failed to create filesystem");
 	}
+
+	enable_printk();
 }
 
 static char *const qemu_argv[] = {