Commit Graph

11 Commits

Author SHA1 Message Date
Thomas Haller
a81b604cc1 tests: accept trailing arguments to "tools/run-nm-test.sh"
Previously, the test runner would only accept leading options,
an optional "--" separator, followed by "$TEST" and optional arguments
for the test.

Like

  ./tools/run-nm-test.sh -m src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh

That is annoying, because to toggle an option you have to seek the
curser in the before the test name.

Now, accept a "--test" option, so that the above can be done with trialing
arguments:

  ./tools/run-nm-test.sh -t src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh -m

However, the arguments for the tests still must come last:

  ./tools/run-nm-test.sh -m [--] src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh -p /settings/plugins/ifcfg-rh/bridge/write-master
  ./tools/run-nm-test.sh -t src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh -m [--] -p /settings/plugins/ifcfg-rh/bridge/write-master
2017-03-02 16:08:54 +01:00
Thomas Haller
61f7dd7284 tests: fix "tools/run-nm-test.sh" to build test first
./tools/run-nm-test.sh -m src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh

makes the test before running it. However, that failed if the
test didn't exist already. Reorder the code so that we always
try to make the test before trying to run it.
2017-03-02 16:08:54 +01:00
Thomas Haller
de5ce89494 tests: improve run-nm-test.sh to weak valgrind usage
- also when called from makefile, allow enabling valgrind even if it was not
  enabled via configure option. That is, even if you configured --without-valgrind,
  you can run tests via `NMTST_USE_VALGRIND=1 make check`. Previously, there
  was no way to run on valgrind during `make check` unless you also had
  configured --with-valgrind.
- Use $NMTST_VALGRIND variable to override the valgrind path. This now
  always takes precedence. For `make check`, the path can be determined
  by the configure script.
  If all unspecified, as last fallback "valgrind" is searched in the current
  $PATH.
- Allow to specify the suppressions file via $NMTST_SUPPRESSIONS.
  If unset, fall back to the default. The default during `make check`
  is determined by the configure options. The default for manual
  invocation is our one valgrind.suppressions file.
  To use no suppressions file, set NMTST_SUPPRESSIONS to empty.

Now, regardless of what you enabled during ./configure, you can
overwrite it via:

  $ NMTST_USE_VALGRIND=1 \
    NMTST_VALGRIND=~/bin/valgrind \
    NMTST_SUPPRESSIONS=my-suppressions \
    make check
2016-12-14 14:11:42 +01:00
Thomas Haller
7b78a931df build: generate src/NetworkManager.ver during build
This adds 0.4 seconds to the build time.

You can disable it by setting $NM_BUILD_NO_CREATE_EXPORTS environment
variable. This is useful in the unexpected case that the script
is broken.
Or, if you just want to use a different, non-generated version-script.
Or, if you want to save 0.4 seconds build-time.
2016-11-10 18:30:38 +01:00
Thomas Haller
b058c45d28 tests: fix run-nm-test.sh to use valgrind when --called-from-make
Fixes: dbafd2ce50
2016-11-10 10:06:40 +01:00
Thomas Haller
354fc51bc6 tools: improve handling arguments to run-nm-test.sh
- add _is_true function so that user can set argument
  environment variables to yes|y|1 etc.

- fix NMTST_CHANGE_DIRECTORY
2016-11-01 18:51:30 +01:00
Thomas Haller
a412ee419b tools: improve --make-first option of test runner to handle relative test paths
With --make-first|-m we first call `make` on the test.
However, the make path must be a relative path rooted
in the top directory.

Make sure we `cd` into the parent directory first and pass
the proper make path.

  cd src
  ../tools/run-nm-test.sh -m settings/plugins/ifcfg-rh/tests/test-ifcfg-rh
2016-11-01 18:29:42 +01:00
Thomas Haller
d35a6fe524 tools: add option to test runner to build test before running it
./tools/run-nm-test.sh -m src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh
2016-11-01 16:51:43 +01:00
Thomas Haller
dbafd2ce50 tools: improve controlling whether to run run-nm-test.sh with valgrind
Use new environment variable NMTST_USE_VALGRIND. It works both
from `make check` and during explicit invocation of the test
runner.
2016-11-01 16:46:40 +01:00
Thomas Haller
7aefbcb622 build: merge "libnm/tests/Makefile.am" into toplevel Makefile 2016-10-19 17:16:08 +02:00
Thomas Haller
cd98705d21 tests: combine "run-test-valgrind.sh" and "run-test-dbus-session.sh" in "run-nm-test.sh"
No need to have two test-runners. Combine them, and call tests always
via "tools/run-nm-test.sh".

Yes, this brings an overhead, that we now always invoke the test with
a test wrapper script, also --without-vagrind. Previously, that was only
necessary for libnm tests that require their own D-Bus session.

Later we will do non-recursive Makefiles, thus all tests should have the
same LOG_COMPILER.
2016-10-19 15:26:30 +02:00