[PATCH] igt_core: Add PCI ID to the test spew

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



makes sure the platform match what is expected.

Sample output:
bwidawsk@ironside ~/intel-gfx/intel-gpu-tools (master)$ sudo ./tests/gem_exec_nop
PCI ID: 0x0a16 IGT-Version: 1.6-g21bcc3f (x86_64) (Linux: 3.14.4-1-ARCH x86_64)

Signed-off-by: Ben Widawsky <ben@xxxxxxxxxxxx>
---
 lib/igt_core.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 6e553cf..097ae62 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -254,18 +254,29 @@ static void check_igt_exit(int sig)
 	assert(sig != 0 || igt_exit_called);
 }
 
+#define PCI_ID_PATH "/sys/devices/pci0000:00/0000:00:02.0/device"
 static void print_version(void)
 {
 	struct utsname uts;
+	char pci_id[] = "0x????";
+	FILE *file;
 
 	if (list_subtests)
 		return;
 
 	uname(&uts);
 
-	fprintf(stdout, "IGT-Version: %s-%s (%s) (%s: %s %s)\n", PACKAGE_VERSION,
-		IGT_GIT_SHA1, TARGET_CPU_PLATFORM,
-		uts.sysname, uts.release, uts.machine);
+	file = fopen(PCI_ID_PATH, "r");
+	if (file != NULL) {
+		fgets(pci_id, strlen(pci_id) + 1, file);
+		fclose(file);
+	}
+
+	fprintf(stdout, "PCI ID: %s IGT-Version: %s-%s (%s) (%s: %s %s)\n",
+			pci_id,
+			PACKAGE_VERSION,
+			IGT_GIT_SHA1, TARGET_CPU_PLATFORM,
+			uts.sysname, uts.release, uts.machine);
 }
 
 static void print_usage(const char *command_str, const char *help_str,
-- 
2.0.0

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




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux