@@ -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,
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@bwidawsk.net> --- lib/igt_core.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)