]> git.ipfire.org Git - thirdparty/systemd.git/commit
test: use ${builddir}/systemd-runtest.env to set $SYSTEMD_TEST_DATA
authorFilipe Brandenburger <filbranden@google.com>
Wed, 12 Sep 2018 06:55:02 +0000 (23:55 -0700)
committerFilipe Brandenburger <filbranden@google.com>
Wed, 12 Sep 2018 16:49:03 +0000 (09:49 -0700)
commite2d413707fc68ed033a83e10a055ca638a1e1e18
treea58e24cbbe43ea9e22c4dce0835b179f763f617b
parent55890a40c3ec0c061c04d1395a38c26313132d12
test: use ${builddir}/systemd-runtest.env to set $SYSTEMD_TEST_DATA

This simplifies get_testdata_dir() to simply checking for an environment
variable, with an additional function to locate a systemd-runtest.env file in
the same directory as the test binary and reading environment variable
assignments from that file if it exists.

This makes it possible to:
- Run `ninja test` from the build dir and have it use ${srcdir}/test for
  test unit definitions.
- Run a test directly, such as `build/test-execute` and have it locate
  them correctly.
- Run installed tests (from systemd-tests package) and locate the test
  units in the installed location (/usr/lib/systemd/tests/testdata), in
  which case the absence of the systemd-runtest.env file will have
  get_testdata_dir() use the installed location hardcoded into the
  binaries.

Explicit setting of $SYSTEMD_TEST_DATA still overrides the contents of
systemd-runtest.env.
meson.build
src/shared/tests.c