summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@ubuntu.com>2011-04-20 01:07:58 +0200
committerMartin Pitt <martin.pitt@ubuntu.com>2011-04-26 11:50:36 +0200
commit7c617ba6f15563c175bfbca71df189778e8ca8fe (patch)
tree4a13e70a4fc1d78224040c4acca537bf47e6e9e4
parente1f4aa38de442682ce122b5d15c6bbad23615ab5 (diff)
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.
-rw-r--r--src/linux/Makefile.am7
-rwxr-xr-xsrc/linux/integration-test5
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')