All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH igt 1/2] lib: Export kmsg()
@ 2017-12-06 16:38 Chris Wilson
  2017-12-06 16:38 ` [PATCH igt 2/2] igt/debugfs_tests: Record which file is being opened in kmsg Chris Wilson
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Chris Wilson @ 2017-12-06 16:38 UTC (permalink / raw)
  To: intel-gfx

Export the kmsg() function for use by tests to write into the kernel
message log, useful for tests to inline their progress with kernel error
messages.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/igt_core.c | 20 ++++++--------------
 lib/igt_core.h | 17 +++++++++++++++++
 2 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 777687b5f..cec5f066b 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -385,16 +385,7 @@ void igt_log_buffer_inspect(igt_buffer_log_handler_t check, void *data)
 	pthread_mutex_unlock(&log_buffer_mutex);
 }
 
-__attribute__((format(printf, 1, 2)))
-static void kmsg(const char *format, ...)
-#define KERN_EMER	"<0>"
-#define KERN_ALERT	"<1>"
-#define KERN_CRIT	"<2>"
-#define KERN_ERR	"<3>"
-#define KERN_WARNING	"<4>"
-#define KERN_NOTICE	"<5>"
-#define KERN_INFO	"<6>"
-#define KERN_DEBUG	"<7>"
+void igt_kmsg(const char *format, ...)
 {
 	va_list ap;
 	FILE *file;
@@ -810,7 +801,7 @@ out:
 
 	if (!list_subtests) {
 		kick_fbcon(false);
-		kmsg(KERN_INFO "[IGT] %s: executing\n", command_str);
+		igt_kmsg(KMSG_INFO "%s: executing\n", command_str);
 		print_version();
 
 		sync();
@@ -937,7 +928,8 @@ bool __igt_run_subtest(const char *subtest_name)
 		return false;
 	}
 
-	kmsg(KERN_INFO "[IGT] %s: starting subtest %s\n", command_str, subtest_name);
+	igt_kmsg(KMSG_INFO "%s: starting subtest %s\n",
+		 command_str, subtest_name);
 	igt_debug("Starting subtest: %s\n", subtest_name);
 
 	_igt_log_buffer_reset();
@@ -1444,8 +1436,8 @@ void igt_exit(void)
 	}
 
 	if (command_str)
-		kmsg(KERN_INFO "[IGT] %s: exiting, ret=%d\n",
-		     command_str, igt_exitcode);
+		igt_kmsg(KMSG_INFO "%s: exiting, ret=%d\n",
+			 command_str, igt_exitcode);
 	igt_debug("Exiting with status code %d\n", igt_exitcode);
 
 	for (int c = 0; c < num_test_children; c++)
diff --git a/lib/igt_core.h b/lib/igt_core.h
index f8543d658..7af2b4c10 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -932,4 +932,21 @@ int igt_system_quiet(const char *command);
 		free(buf); \
 	} while (0)
 
+/**
+ * igt_kmsg:
+ * @format: printf-style format string with optional args
+ *
+ * Writes a message into the kernel log file (/dev/kmsg).
+ */
+__attribute__((format(printf, 1, 2)))
+void igt_kmsg(const char *format, ...);
+#define KMSG_EMER	"<0>[IGT] "
+#define KMSG_ALERT	"<1>[IGT] "
+#define KMSG_CRIT	"<2>[IGT] "
+#define KMSG_ERR	"<3>[IGT] "
+#define KMSG_WARNING	"<4>[IGT] "
+#define KMSG_NOTICE	"<5>[IGT] "
+#define KMSG_INFO	"<6>[IGT] "
+#define KMSG_DEBUG	"<7>[IGT] "
+
 #endif /* IGT_CORE_H */
-- 
2.15.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 11+ messages in thread
* [Intel-gfx] [PATCH igt 1/2] lib: Export kmsg()
@ 2018-02-21 11:28 Chris Wilson
  2018-02-21 11:28 ` [PATCH igt 2/2] igt/debugfs_tests: Record which file is being opened in kmsg Chris Wilson
  0 siblings, 1 reply; 11+ messages in thread
From: Chris Wilson @ 2018-02-21 11:28 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

Export the kmsg() function for use by tests to write into the kernel
message log, useful for tests to inline their progress with kernel error
messages.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/igt_core.c | 20 ++++++--------------
 lib/igt_core.h | 17 +++++++++++++++++
 2 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 558a538d..c292343d 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -386,16 +386,7 @@ void igt_log_buffer_inspect(igt_buffer_log_handler_t check, void *data)
 	pthread_mutex_unlock(&log_buffer_mutex);
 }
 
-__attribute__((format(printf, 1, 2)))
-static void kmsg(const char *format, ...)
-#define KERN_EMER	"<0>"
-#define KERN_ALERT	"<1>"
-#define KERN_CRIT	"<2>"
-#define KERN_ERR	"<3>"
-#define KERN_WARNING	"<4>"
-#define KERN_NOTICE	"<5>"
-#define KERN_INFO	"<6>"
-#define KERN_DEBUG	"<7>"
+void igt_kmsg(const char *format, ...)
 {
 	va_list ap;
 	FILE *file;
@@ -811,7 +802,7 @@ out:
 
 	if (!list_subtests) {
 		kick_fbcon(false);
-		kmsg(KERN_INFO "[IGT] %s: executing\n", command_str);
+		igt_kmsg(KMSG_INFO "%s: executing\n", command_str);
 		print_version();
 
 		sync();
@@ -938,7 +929,8 @@ bool __igt_run_subtest(const char *subtest_name)
 		return false;
 	}
 
-	kmsg(KERN_INFO "[IGT] %s: starting subtest %s\n", command_str, subtest_name);
+	igt_kmsg(KMSG_INFO "%s: starting subtest %s\n",
+		 command_str, subtest_name);
 	igt_debug("Starting subtest: %s\n", subtest_name);
 
 	_igt_log_buffer_reset();
@@ -1447,8 +1439,8 @@ void igt_exit(void)
 	}
 
 	if (command_str)
-		kmsg(KERN_INFO "[IGT] %s: exiting, ret=%d\n",
-		     command_str, igt_exitcode);
+		igt_kmsg(KMSG_INFO "%s: exiting, ret=%d\n",
+			 command_str, igt_exitcode);
 	igt_debug("Exiting with status code %d\n", igt_exitcode);
 
 	for (int c = 0; c < num_test_children; c++)
diff --git a/lib/igt_core.h b/lib/igt_core.h
index f8543d65..7af2b4c1 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -932,4 +932,21 @@ int igt_system_quiet(const char *command);
 		free(buf); \
 	} while (0)
 
+/**
+ * igt_kmsg:
+ * @format: printf-style format string with optional args
+ *
+ * Writes a message into the kernel log file (/dev/kmsg).
+ */
+__attribute__((format(printf, 1, 2)))
+void igt_kmsg(const char *format, ...);
+#define KMSG_EMER	"<0>[IGT] "
+#define KMSG_ALERT	"<1>[IGT] "
+#define KMSG_CRIT	"<2>[IGT] "
+#define KMSG_ERR	"<3>[IGT] "
+#define KMSG_WARNING	"<4>[IGT] "
+#define KMSG_NOTICE	"<5>[IGT] "
+#define KMSG_INFO	"<6>[IGT] "
+#define KMSG_DEBUG	"<7>[IGT] "
+
 #endif /* IGT_CORE_H */
-- 
2.16.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-02-21 11:28 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-06 16:38 [PATCH igt 1/2] lib: Export kmsg() Chris Wilson
2017-12-06 16:38 ` [PATCH igt 2/2] igt/debugfs_tests: Record which file is being opened in kmsg Chris Wilson
2017-12-06 16:51   ` Tvrtko Ursulin
2017-12-06 17:02     ` Chris Wilson
2017-12-06 17:04       ` Tvrtko Ursulin
2017-12-06 17:08         ` Chris Wilson
2017-12-11 11:02       ` Joonas Lahtinen
2017-12-11 11:05         ` Chris Wilson
2017-12-06 17:33 ` ✓ Fi.CI.BAT: success for series starting with [1/2] lib: Export kmsg() Patchwork
2017-12-06 18:54 ` ✗ Fi.CI.IGT: warning " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2018-02-21 11:28 [Intel-gfx] [PATCH igt 1/2] " Chris Wilson
2018-02-21 11:28 ` [PATCH igt 2/2] igt/debugfs_tests: Record which file is being opened in kmsg Chris Wilson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.