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.
This commit is contained in:
Martin Pitt 2011-04-20 01:07:58 +02:00
parent e1f4aa38de
commit 7c617ba6f1
2 changed files with 10 additions and 2 deletions

View file

@ -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 *~

View file

@ -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')