summaryrefslogtreecommitdiff
path: root/runner
diff options
context:
space:
mode:
authorPetri Latvala <petri.latvala@intel.com>2020-04-15 11:49:55 +0300
committerPetri Latvala <petri.latvala@intel.com>2020-04-17 11:29:25 +0300
commit276b8a3f24837e009ff38512f7eeb07029e52616 (patch)
treef10d8163930ca124b0bb82e531514dcf17a19e59 /runner
parent67b4fecce9dd413cf772ab85ea807cc1ceb8b9f0 (diff)
runner: Add --version to igt_runner
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> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Diffstat (limited to 'runner')
-rw-r--r--runner/meson.build1
-rw-r--r--runner/settings.c18
2 files changed, 19 insertions, 0 deletions
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;