From patchwork Wed Jun 4 01:28:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 4291891 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D98979F1D6 for ; Wed, 4 Jun 2014 01:28:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EF6F8201F5 for ; Wed, 4 Jun 2014 01:28:22 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id AABFF201F2 for ; Wed, 4 Jun 2014 01:28:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EA05F6E0B4; Tue, 3 Jun 2014 18:28:19 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org 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) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 03 Jun 2014 18:28:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.98,969,1392192000"; d="scan'208";a="551187530" Received: from ironside.jf.intel.com ([10.7.197.217]) by orsmga002.jf.intel.com with ESMTP; 03 Jun 2014 18:28:17 -0700 From: Ben Widawsky To: Intel GFX Date: Tue, 3 Jun 2014 18:28:16 -0700 Message-Id: <1401845296-12900-1-git-send-email-benjamin.widawsky@intel.com> X-Mailer: git-send-email 2.0.0 Cc: Ben Widawsky , Ben Widawsky Subject: [Intel-gfx] [PATCH] igt_core: Add PCI ID to the test spew X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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,