From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id E52E96E923 for ; Wed, 15 Apr 2020 08:50:03 +0000 (UTC) From: Petri Latvala Date: Wed, 15 Apr 2020 11:49:55 +0300 Message-Id: <20200415084955.29370-1-petri.latvala@intel.com> MIME-Version: 1.0 Subject: [igt-dev] [PATCH i-g-t v2] runner: Add --version to igt_runner List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" To: igt-dev@lists.freedesktop.org Cc: Tomi Sarvela , Petri Latvala List-ID: To help verify correct deployment, add a --version flag to igt_runner that just prints the IGT-version text, the same tests would print. Note that only igt_runner gained the --version flag. igt_resume and igt_results don't do fancy flag handling, they only accept the directory to operate as their single arg. v2: Depend on version.h (CI) Signed-off-by: Petri Latvala Cc: Tomi Sarvela Cc: Arkadiusz Hiler --- runner/meson.build | 1 + runner/settings.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/runner/meson.build b/runner/meson.build index 7c2e8e0d..c3927af5 100644 --- a/runner/meson.build +++ b/runner/meson.build @@ -4,6 +4,7 @@ runnerlib_sources = [ 'settings.c', 'job_list.c', 'executor.c', 'resultgen.c', + lib_version, ] runner_sources = [ 'runner.c' ] diff --git a/runner/settings.c b/runner/settings.c index 32840307..d18e55d1 100644 --- a/runner/settings.c +++ b/runner/settings.c @@ -1,4 +1,5 @@ #include "settings.h" +#include "version.h" #include #include @@ -11,6 +12,7 @@ #include #include #include +#include #include enum { @@ -21,6 +23,7 @@ enum { OPT_DMESG_WARN_LEVEL, OPT_OVERALL_TIMEOUT, OPT_PER_TEST_TIMEOUT, + OPT_VERSION, OPT_HELP = 'h', OPT_NAME = 'n', OPT_DRY_RUN = 'd', @@ -292,6 +295,17 @@ static bool readable_file(char *filename) return !access(filename, R_OK); } +static void print_version(void) +{ + struct utsname uts; + + uname(&uts); + + printf("IGT-Version: %s-%s (%s) (%s: %s %s)\n", PACKAGE_VERSION, + IGT_GIT_SHA1, TARGET_CPU_PLATFORM, + uts.sysname, uts.release, uts.machine); +} + void init_settings(struct settings *settings) { memset(settings, 0, sizeof(*settings)); @@ -317,6 +331,7 @@ bool parse_options(int argc, char **argv, char *env_test_root; static struct option long_options[] = { + {"version", no_argument, NULL, OPT_VERSION}, {"help", no_argument, NULL, OPT_HELP}, {"name", required_argument, NULL, OPT_NAME}, {"dry-run", no_argument, NULL, OPT_DRY_RUN}, @@ -349,6 +364,9 @@ bool parse_options(int argc, char **argv, while ((c = getopt_long(argc, argv, "hn:dt:x:sl:omb:L", long_options, NULL)) != -1) { switch (c) { + case OPT_VERSION: + print_version(); + goto error; case OPT_HELP: usage(NULL, stdout); goto error; -- 2.20.1 _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev