From: Chris Wilson Date: Fri, 25 Jul 2014 13:29:47 +0000 (+0100) Subject: core: Inject program name into dmesg X-Git-Tag: intel-gpu-tools-1.8~120 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b9e7637542364f9834c620ce2ee3b4ca11ba6f27;p=platform%2Fupstream%2Fintel-gpu-tools.git core: Inject program name into dmesg Write the program name if !list_only so that we associate oops with simple tests. Signed-off-by: Chris Wilson --- diff --git a/lib/igt_core.c b/lib/igt_core.c index 7bd8e19..a0c9499 100644 --- a/lib/igt_core.c +++ b/lib/igt_core.c @@ -218,6 +218,24 @@ int num_test_children; int test_children_sz; bool test_child; +__attribute__((format(printf, 1, 2))) +static void kmsg(const char *format, ...) +#define KERN_INFO "<5>" +{ + va_list ap; + FILE *file; + + file = fopen("/dev/kmsg", "w"); + if (file == NULL) + return; + + va_start(ap, format); + vfprintf(file, format, ap); + va_end(ap); + + fclose(file); +} + bool __igt_fixture(void) { assert(!in_fixture); @@ -378,8 +396,6 @@ static int common_init(int argc, char **argv, } } - oom_adjust_for_doom(); - out: free(short_opts); free(combined_opts); @@ -399,7 +415,12 @@ out: /* exit with no error for -h/--help */ exit(ret == -1 ? 0 : IGT_EXIT_INVALID); - print_version(); + if (!list_subtests) { + kmsg(KERN_INFO "%s: executing\n", command_str); + print_version(); + + oom_adjust_for_doom(); + } return ret; } @@ -498,24 +519,6 @@ void igt_simple_init_parse_opts(int argc, char **argv, extra_opt_handler); } -__attribute__((format(printf, 1, 2))) -static void kmsg(const char *format, ...) -#define KERN_INFO "<5>" -{ - va_list ap; - FILE *file; - - file = fopen("/dev/kmsg", "w"); - if (file == NULL) - return; - - va_start(ap, format); - vfprintf(file, format, ap); - va_end(ap); - - fclose(file); -} - /* * Note: Testcases which use these helpers MUST NOT output anything to stdout * outside of places protected by igt_run_subtest checks - the piglit