diff options
-rw-r--r-- | Makefile.am | 25 | ||||
-rw-r--r-- | lib/drmtest.c | 13 | ||||
-rw-r--r-- | tests/Makefile.am | 1 |
3 files changed, 38 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am index d7a479c2..431e7b41 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ # Copyright © 2005 Adam Jackson. -# Copyright © 2009 Intel Corporation +# Copyright © 2009,2013 Intel Corporation # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), @@ -37,6 +37,29 @@ endif MAINTAINERCLEANFILES = ChangeLog INSTALL +.PHONY: version.h.tmp +version.h.tmp: + @touch $@ + @if test -d .git; then \ + if which git > /dev/null; then git log -n 1 --oneline | \ + sed 's/^\([^ ]*\) .*/#define IGT_GIT_SHA1 "g\1"/' \ + >> $@ ; \ + fi \ + else \ + echo '#define IGT_GIT_SHA1 "NOT-GIT"' >> $@ ; \ + fi + +version.h: version.h.tmp + @echo "updating version.h" + @if ! cmp -s version.h.tmp version.h; then \ + mv version.h.tmp version.h ;\ + else \ + rm version.h.tmp ;\ + fi + +BUILT_SOURCES = version.h +CLEANFILES = version.h version.h.tmp + .PHONY: ChangeLog INSTALL INSTALL: diff --git a/lib/drmtest.c b/lib/drmtest.c index f2624a10..9efe2bd1 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -51,6 +51,8 @@ #include "intel_chipset.h" #include "intel_gpu_tools.h" #include "igt_debugfs.h" +#include "../version.h" +#include "config.h" /* This file contains a bunch of wrapper functions to directly use gem ioctls. * Mostly useful to write kernel tests. */ @@ -798,6 +800,15 @@ static void check_igt_exit(int sig) assert(sig != 0 || igt_exit_called); } + +static void print_version(void) +{ + if (list_subtests) + return; + + fprintf(stdout, "IGT-Version: %s-%s\n", PACKAGE_VERSION, IGT_GIT_SHA1); +} + static void print_usage(const char *command_str, const char *help_str, bool output_on_stderr) { @@ -893,6 +904,8 @@ int igt_subtest_init_parse_opts(int argc, char **argv, oom_adjust_for_doom(); out: + print_version(); + return ret; } diff --git a/tests/Makefile.am b/tests/Makefile.am index b8cddd56..f4a7d415 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -24,6 +24,7 @@ AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) \ -I$(srcdir)/.. \ -I$(srcdir)/../lib \ -include "check-ndebug.h" \ + -include "$(srcdir)/version.h" \ -DIGT_DATADIR=\""$(abs_srcdir)"\" \ $(NULL) |