From 7c617ba6f15563c175bfbca71df189778e8ca8fe Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 20 Apr 2011 01:07:58 +0200 Subject: [PATCH] Run Linux integration tests in "make check" If possible, run the tests under dbus-launch to ensure that there is a private D-BUS session bus. This allows the tests to work in e. g. a clean package build environment, and also avoids messing with the real user session bus. --- src/linux/Makefile.am | 7 +++++++ src/linux/integration-test | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/linux/Makefile.am b/src/linux/Makefile.am index 446fc0f..1edc31d 100644 --- a/src/linux/Makefile.am +++ b/src/linux/Makefile.am @@ -49,6 +49,13 @@ EXTRA_DIST = $(libupshared_la_SOURCES) libupshared_la_CFLAGS = \ $(WARNINGFLAGS_C) +if UP_BUILD_TESTS +DBUS_LAUNCH=$(shell which dbus-launch) + +check-local: $(top_builddir)/src/upowerd + env top_builddir=$(top_builddir) $(DBUS_LAUNCH) ./integration-test -v +endif + clean-local : rm -f *~ diff --git a/src/linux/integration-test b/src/linux/integration-test index 3a9997f..c4c8f8d 100755 --- a/src/linux/integration-test +++ b/src/linux/integration-test @@ -40,8 +40,9 @@ class Tests(unittest.TestCase): @classmethod def setUpClass(cls): # run from local build tree if we are in one, otherwise use system instance - if os.access (os.path.join('src', 'upowerd'), os.X_OK): - daemon_path = os.path.join('src', 'upowerd') + builddir = os.getenv('top_builddir', '.') + if os.access (os.path.join(builddir, 'src', 'upowerd'), os.X_OK): + daemon_path = os.path.join(builddir, 'src', 'upowerd') print('Testing binaries from local build tree') else: print('Testing installed system binaries')