From: Petri Latvala <petri.latvala@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Tomi Sarvela <tomi.p.sarvela@intel.com>,
Petri Latvala <petri.latvala@intel.com>
Subject: [igt-dev] [PATCH i-g-t v2] runner: Add --version to igt_runner
Date: Wed, 15 Apr 2020 11:49:55 +0300 [thread overview]
Message-ID: <20200415084955.29370-1-petri.latvala@intel.com> (raw)
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 <petri.latvala@intel.com>
Cc: Tomi Sarvela <tomi.p.sarvela@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
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 <ctype.h>
#include <errno.h>
@@ -11,6 +12,7 @@
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/utsname.h>
#include <unistd.h>
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
next reply other threads:[~2020-04-15 8:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-15 8:49 Petri Latvala [this message]
2020-04-15 11:01 ` [igt-dev] ✓ Fi.CI.BAT: success for runner: Add --version to igt_runner (rev3) Patchwork
2020-04-16 7:51 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2020-04-16 9:05 ` [igt-dev] [PATCH i-g-t v2] runner: Add --version to igt_runner Arkadiusz Hiler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200415084955.29370-1-petri.latvala@intel.com \
--to=petri.latvala@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=tomi.p.sarvela@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox