Skip to contentSkip to conversation

intel-gpu-tools: Version information

PATCH In review Ben Widawsky 3 participants 4 messages Dec 7, 2013 – Dec 10, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 intel-gpu-tools: Version information

Provide two arguments version, and verbose, which allow printing from an arbitrary igt test. It will show system information (from build time, not runtime), as well as the git SHA being used.

This will help reduce errors when people try to reproduce problems.

As an example if I want to verify someone is running the correct version
of a test, I could ask them to do:
bwidawsk@ironside ~/intel-gfx/intel-gpu-tools (master)$ sudo ./tests/gem_exec_nop --verbose gem_exec_nop-git-3c5423b (Linux ironside 3.12.0-1-ARCH #1 SMP PREEMPT
Wed Nov 6 09:06:27 CET 2013 x86_64 GNU/Linux)
Time to exec x 1: 35.000µs (ring=render)
Time to exec x 2: 28.000µs (ring=render)
Time to exec x 4: 20.000µs (ring=render)
Time to exec x 8: 14.625µs (ring=render)
Time to exec x 16: 11.188µs (ring=render)
Time to exec x 32: 11.125µs (ring=render)
Time to exec x 64: 10.328µs (ring=render)
Time to exec x 128: 10.172µs (ring=render)
Time to exec x 256: 10.234µs (ring=render)
Time to exec x 512: 10.232µs (ring=render)
Time to exec x 1024: 10.121µs (ring=render)
Time to exec x 2048: 10.151µs (ring=render)
Time to exec x 4096: 11.474µs (ring=render)
Time to exec x 8192: 9.432µs (ring=render)

Time to exec x 16384:		  6.003µs (ring=render)
Time to exec x 32768:		  5.029µs (ring=render)
Time to exec x 65536:		  4.206µs (ring=render)

Time to exec x 131072: 3.630µs (ring=render)
Subtest render: SUCCESS

--verbose is provided for completeness, but doesn't seem too useful at the moement.

bwidawsk@ironside ~/intel-gfx/intel-gpu-tools (master)$ sudo ./tests/gem_exec_nop --version gem_exec_nop-git-3c5423b (Linux ironside 3.12.0-1-ARCH #1 SMP PREEMPT
Wed Nov 6 09:06:27 CET 2013 x86_64 GNU/Linux)

I've put version.h in the root directory so that any subdir can access it. I've added the tests usage since it's immediately useful, and done easily via Daniels igt infrastructure work.

---
 Makefile.am       | 26 +++++++++++++++++++++++++-
 lib/drmtest.c     | 17 +++++++++++++++++
 tests/Makefile.am |  1 +
 3 files changed, 43 insertions(+), 1 deletion(-)
Makefile.am +25 -1
index d7a479c..cbb9e20 100644
@@ -1,5 +1,5 @@
 # Copyright © 2005 Adam Jackson.
-# Copyright © 2009 Intel Corporation
+# Copyright © 2009,2013 Intel Corporation
 #
 #  Permission is hereby granted, free of charge, to any person obtaining a
 #  copy of this software and associated documentation files (the "Software"),
@@ -37,6 +37,30 @@ endif
 
 MAINTAINERCLEANFILES = ChangeLog INSTALL
 
+.PHONY: version.h.tmp
+version.h.tmp:
+	@touch $@
+	@echo "#define IGT_SYSTEM_INFO \"$(shell uname -a)\"" >> $@
+	@if test -d .git; then \
+		if which git > /dev/null; then git log -n 1 --oneline | \
+			sed 's/^\([^ ]*\) .*/#define IGT_GIT_SHA1 "git-\1"/' \
+			>> $@ ; \
+		fi \
+	else \
+		echo '#define IGT_GIT_SHA1 "NOT-GIT"' >> $@ ; \
+	fi
+
+version.h: version.h.tmp
+	@echo "updating version.h"
+	@if ! cmp -s version.h.tmp version.h; then \
+		mv version.h.tmp version.h ;\
+	else \
+		rm version.h.tmp ;\
+	fi
+
+BUILT_SOURCES = version.h
+CLEANFILES = version.h version.h.tmp
+
 .PHONY: ChangeLog INSTALL
 
 INSTALL:
lib/drmtest.c +17 -0
index 97a4403..a5733a0 100644
@@ -51,6 +51,7 @@
 #include "intel_chipset.h"
 #include "intel_gpu_tools.h"
 #include "igt_debugfs.h"
+#include "../version.h"
 
 /* This file contains a bunch of wrapper functions to directly use gem ioctls.
  * Mostly useful to write kernel tests. */
@@ -798,6 +799,13 @@ static void check_igt_exit(int sig)
 	assert(sig != 0 || igt_exit_called);
 }
 
+
+static void print_version(const char *command_str)
+{
+	fprintf(stdout, "%s-%s (%s) \n", command_str,
+			IGT_GIT_SHA1, IGT_SYSTEM_INFO);
+}
+
 static void print_usage(const char *command_str, const char *help_str,
 			bool output_on_stderr)
 {
@@ -820,6 +828,8 @@ int igt_subtest_init_parse_opts(int argc, char **argv,
 	static struct option long_options[] = {
 		{"list-subtests", 0, 0, 'l'},
 		{"run-subtest", 1, 0, 'r'},
+		{"verbose", 0, 0, 'b'},
+		{"version", 0, 0, 'v'},
 		{"help", 0, 0, 'h'},
 	};
 	const char *command_str;
@@ -866,6 +876,13 @@ int igt_subtest_init_parse_opts(int argc, char **argv,
 			if (!list_subtests)
 				run_single_subtest = strdup(optarg);
 			break;
+		case 'b':
+			print_version(command_str);
+			break;
+		case 'v':
+			print_version(command_str);
+			ret = -1;
+			goto out;
 		case 'h':
 			print_usage(command_str, help_str, false);
 			ret = -1;
tests/Makefile.am +1 -0
index b8cddd5..f4a7d41 100644
@@ -24,6 +24,7 @@ AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) \
 	-I$(srcdir)/.. \
 	-I$(srcdir)/../lib \
 	-include "check-ndebug.h" \
+	-include "$(srcdir)/version.h" \
 	-DIGT_DATADIR=\""$(abs_srcdir)"\" \
 	$(NULL)
 
Signature · 6 lines
1.8.4.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 38 lines · Ben Widawsky

Provide two arguments version, and verbose, which allow printing from an arbitrary igt test. It will show system information (from build time, not runtime), as well as the git SHA being used.

This will help reduce errors when people try to reproduce problems.

As an example if I want to verify someone is running the correct version
of a test, I could ask them to do:
bwidawsk@ironside ~/intel-gfx/intel-gpu-tools (master)$ sudo ./tests/gem_exec_nop --verbose gem_exec_nop-git-3c5423b (Linux ironside 3.12.0-1-ARCH #1 SMP PREEMPT
Wed Nov 6 09:06:27 CET 2013 x86_64 GNU/Linux)

Time to exec x 1:                35.000µs (ring=render)
Time to exec x 2:                28.000µs (ring=render)
Time to exec x 4:                20.000µs (ring=render)
Time to exec x 8:                14.625µs (ring=render)
Time to exec x 16:               11.188µs (ring=render)
Time to exec x 32:               11.125µs (ring=render)
Time to exec x 64:               10.328µs (ring=render)
Time to exec x 128:              10.172µs (ring=render)
Time to exec x 256:              10.234µs (ring=render)
Time to exec x 512:              10.232µs (ring=render)
Time to exec x 1024:             10.121µs (ring=render)
Time to exec x 2048:             10.151µs (ring=render)
Time to exec x 4096:             11.474µs (ring=render)
Time to exec x 8192:              9.432µs (ring=render)
Time to exec x 16384:             6.003µs (ring=render)
Time to exec x 32768:             5.029µs (ring=render)
Time to exec x 65536:             4.206µs (ring=render)
Time to exec x 131072:            3.630µs (ring=render)
Subtest render: SUCCESS

--verbose is provided for completeness, but doesn't seem too useful at the moement.

bwidawsk@ironside ~/intel-gfx/intel-gpu-tools (master)$ sudo ./tests/gem_exec_nop --version gem_exec_nop-git-3c5423b (Linux ironside 3.12.0-1-ARCH #1 SMP PREEMPT
Wed Nov 6 09:06:27 CET 2013 x86_64 GNU/Linux)

Quoted 5 lines

I've put version.h in the root directory so that any subdir can access it. I've added the tests usage since it's immediately useful, and done easily via Daniels igt infrastructure work.

Yeah, this is definitely very useful. But I'd just print it by default so that we don't need to ask for this information. Of course we need to be careful to not print it when listing subtest. Also:
- We don't have any init stuff for simple testcases without subtests, we need to roll out a bit of infrastructure to make that happen.
- Shell script tests might also benefit from this.
- uname information needs to be gathered at runtime, since QA has a special build server.

If you don't mind I'll apply this and then frob it some more. -Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#2 lore raw
Quoted 56 lines · Daniel Vetter
Quoted 38 lines · Ben Widawsky

Provide two arguments version, and verbose, which allow printing from an arbitrary igt test. It will show system information (from build time, not runtime), as well as the git SHA being used.

This will help reduce errors when people try to reproduce problems.

As an example if I want to verify someone is running the correct version
of a test, I could ask them to do:
bwidawsk@ironside ~/intel-gfx/intel-gpu-tools (master)$ sudo ./tests/gem_exec_nop --verbose gem_exec_nop-git-3c5423b (Linux ironside 3.12.0-1-ARCH #1 SMP PREEMPT
Wed Nov 6 09:06:27 CET 2013 x86_64 GNU/Linux)

Time to exec x 1:                35.000µs (ring=render)
Time to exec x 2:                28.000µs (ring=render)
Time to exec x 4:                20.000µs (ring=render)
Time to exec x 8:                14.625µs (ring=render)
Time to exec x 16:               11.188µs (ring=render)
Time to exec x 32:               11.125µs (ring=render)
Time to exec x 64:               10.328µs (ring=render)
Time to exec x 128:              10.172µs (ring=render)
Time to exec x 256:              10.234µs (ring=render)
Time to exec x 512:              10.232µs (ring=render)
Time to exec x 1024:             10.121µs (ring=render)
Time to exec x 2048:             10.151µs (ring=render)
Time to exec x 4096:             11.474µs (ring=render)
Time to exec x 8192:              9.432µs (ring=render)
Time to exec x 16384:             6.003µs (ring=render)
Time to exec x 32768:             5.029µs (ring=render)
Time to exec x 65536:             4.206µs (ring=render)
Time to exec x 131072:            3.630µs (ring=render)
Subtest render: SUCCESS

--verbose is provided for completeness, but doesn't seem too useful at the moement.

bwidawsk@ironside ~/intel-gfx/intel-gpu-tools (master)$ sudo ./tests/gem_exec_nop --version gem_exec_nop-git-3c5423b (Linux ironside 3.12.0-1-ARCH #1 SMP PREEMPT
Wed Nov 6 09:06:27 CET 2013 x86_64 GNU/Linux)

Quoted 5 lines

I've put version.h in the root directory so that any subdir can access it. I've added the tests usage since it's immediately useful, and done easily via Daniels igt infrastructure work.

Yeah, this is definitely very useful. But I'd just print it by default so that we don't need to ask for this information. Of course we need to be careful to not print it when listing subtest. Also:
- We don't have any init stuff for simple testcases without subtests, we need to roll out a bit of infrastructure to make that happen.
- Shell script tests might also benefit from this.
- uname information needs to be gathered at runtime, since QA has a special build server.

Quoted 2 lines

If you don't mind I'll apply this and then frob it some more. -Daniel

Sounds great. I want to test it out on some of the BDW bugs QA is reporting, so ping me when you're done.

Signature · 5 lines
Ben Widawsky, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
Quoted 9 lines · Ben Widawsky
Quoted 9 lines

Yeah, this is definitely very useful. But I'd just print it by default so that we don't need to ask for this information. Of course we need to be careful to not print it when listing subtest. Also:
- We don't have any init stuff for simple testcases without subtests, we need to roll out a bit of infrastructure to make that happen.
- Shell script tests might also benefit from this.
- uname information needs to be gathered at runtime, since QA has a special build server.

Quoted 5 lines
Quoted 2 lines

If you don't mind I'll apply this and then frob it some more. -Daniel

Sounds great. I want to test it out on some of the BDW bugs QA is reporting, so ping me when you're done.

Done, with the exception of replicating the same information for shell scripts. Not sure whether the duplication is worth it. -Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch