]> git.ipfire.org Git - thirdparty/systemd.git/commit - Makefile.am
tests: look for tests relative to source dir when running from build dir
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 15 Feb 2017 00:43:51 +0000 (19:43 -0500)
committerMartin Pitt <martin@piware.de>
Thu, 16 Feb 2017 20:36:31 +0000 (21:36 +0100)
commit1f35a3b2a4a6bdc97c0eacfee208e05b2f67f523
treebdb51f8e51ec5a4dc56510f7bccd7f4c556ffa5d
parent94fa1497ba98bb083632bd4d3f6cfcf6db8cff03
tests: look for tests relative to source dir when running from build dir

automake helpfully sets a few variables for during build. When our executable
is in a directory underneath $(abs_top_builddir), we know that we're in the
build environment $(abs_top_srcdir) contains the sources, and test data is
under $(abs_top_srcdir)/test. This remains true no matter where the build
directory is relative to the source directory. It also works if the test
executable is invoked as ./test-whatever or .libs/test-whatever, since the
relative path is not used at all.

When running from outside of the build directory, we should be running from the
installed location and we can look for ../testdata relative to the location of
the exe file.

Of course, $SYSTEMD_TEST_DATA always overrides this logic.
Makefile.am
src/shared/tests.c