mirror of
https://gitlab.com/mishakmak/pam-fprint-grosshack.git
synced 2026-04-08 20:03:34 +02:00
tests: Add dbus-monitor'ing to PAM tests
Should prove useful debugging the PAM module if we need it.
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
SUBDIRS = services
|
SUBDIRS = services
|
||||||
|
|
||||||
TESTS_ENVIRONMENT = export TOPSRCDIR=$(abs_top_srcdir); export LD_PRELOAD=libpam_wrapper.so; export PAM_WRAPPER_SERVICE_DIR=$(abs_top_builddir)/tests/pam/services; export PAM_WRAPPER=1; export PYTHON=@PYTHON@;
|
TESTS_ENVIRONMENT = export TOPBUILDDIR=$(abs_top_builddir); export TOPSRCDIR=$(abs_top_srcdir); export LD_PRELOAD=libpam_wrapper.so; export PAM_WRAPPER_SERVICE_DIR=$(abs_top_builddir)/tests/pam/services; export PAM_WRAPPER=1; export PYTHON=@PYTHON@;
|
||||||
TESTS = test_pam_fprintd.py
|
TESTS = test_pam_fprintd.py
|
||||||
|
|
||||||
EXTRA_DIST = $(TESTS)
|
EXTRA_DIST = $(TESTS)
|
||||||
|
|||||||
@ -33,9 +33,31 @@ PAM_USER_UNKNOWN = 10
|
|||||||
class TestPamFprintd(dbusmock.DBusTestCase):
|
class TestPamFprintd(dbusmock.DBusTestCase):
|
||||||
'''Test pam_fprintd'''
|
'''Test pam_fprintd'''
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def start_monitor(klass):
|
||||||
|
'''Start dbus-monitor'''
|
||||||
|
|
||||||
|
workdir = os.environ['TOPBUILDDIR'] + '/tests/pam/'
|
||||||
|
klass.monitor_log = open(os.path.join(workdir, 'dbus-monitor.log'), 'wb', buffering=0)
|
||||||
|
klass.monitor = subprocess.Popen(['dbus-monitor', '--monitor', '--system'],
|
||||||
|
stdout=klass.monitor_log,
|
||||||
|
stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def stop_monitor(klass):
|
||||||
|
'''Stop dbus-monitor'''
|
||||||
|
|
||||||
|
assert klass.monitor
|
||||||
|
klass.monitor.terminate()
|
||||||
|
klass.monitor.wait()
|
||||||
|
|
||||||
|
klass.monitor_log.flush()
|
||||||
|
klass.monitor_log.close()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(klass):
|
def setUpClass(klass):
|
||||||
klass.start_system_bus()
|
klass.start_system_bus()
|
||||||
|
klass.start_monitor()
|
||||||
klass.dbus_con = klass.get_dbus(True)
|
klass.dbus_con = klass.get_dbus(True)
|
||||||
|
|
||||||
template_path = './'
|
template_path = './'
|
||||||
@ -44,6 +66,10 @@ class TestPamFprintd(dbusmock.DBusTestCase):
|
|||||||
klass.template_name = template_path + 'dbusmock/fprintd.py'
|
klass.template_name = template_path + 'dbusmock/fprintd.py'
|
||||||
print ('Using template from %s' % klass.template_name)
|
print ('Using template from %s' % klass.template_name)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def tearDownClass(klass):
|
||||||
|
klass.stop_monitor()
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
(self.p_mock, self.obj_fprintd_manager) = self.spawn_server_template(
|
(self.p_mock, self.obj_fprintd_manager) = self.spawn_server_template(
|
||||||
self.template_name, {}, stdout=subprocess.PIPE)
|
self.template_name, {}, stdout=subprocess.PIPE)
|
||||||
|
|||||||
Reference in New Issue
Block a user