[Intel-gfx] [PATCH 6/6] lib: Add a --igt-debug command line option

Damien Lespiau damien.lespiau at intel.com
Wed May 28 20:24:04 CEST 2014


Sometimes it's practical to be able to set the logging level to debug
from the command line arguments.

Signed-off-by: Damien Lespiau <damien.lespiau at intel.com>
---
 lib/igt_core.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 6e553cf..9d59ab4 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -274,6 +274,7 @@ static void print_usage(const char *command_str, const char *help_str,
 	FILE *f = output_on_stderr ? stderr : stdout;
 
 	fprintf(f, "Usage: %s [OPTIONS]\n"
+		   "  --igt-debug\n"
 		   "  --list-subtests\n"
 		   "  --run-subtest <pattern>\n", command_str);
 	if (help_str)
@@ -317,6 +318,7 @@ int igt_subtest_init_parse_opts(int argc, char **argv,
 {
 	int c, option_index = 0;
 	static struct option long_options[] = {
+		{"igt-debug", 0, 0, 'd'},
 		{"list-subtests", 0, 0, 'l'},
 		{"run-subtest", 1, 0, 'r'},
 		{"help", 0, 0, 'h'},
@@ -357,6 +359,9 @@ int igt_subtest_init_parse_opts(int argc, char **argv,
 	while ((c = getopt_long(argc, argv, short_opts, combined_opts,
 			       &option_index)) != -1) {
 		switch(c) {
+		case 'd':
+			setenv("IGT_LOG_LEVEL", "debug", 1);
+			break;
 		case 'l':
 			if (!run_single_subtest)
 				list_subtests = true;
-- 
1.8.3.1




More information about the Intel-gfx mailing list