From: Ben Widawsky Subject: [PATCH] igt_core: Add PCI ID to the test spew Date: Tue, 3 Jun 2014 18:28:16 -0700 Message-ID: <1401845296-12900-1-git-send-email-benjamin.widawsky@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 6A81C6E0B4 for ; Tue, 3 Jun 2014 18:28:18 -0700 (PDT) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Intel GFX Cc: Ben Widawsky , Ben Widawsky List-Id: intel-gfx@lists.freedesktop.org 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 --- 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