diff -Nru bluez-4.101/debian/changelog bluez-4.101/debian/changelog --- bluez-4.101/debian/changelog 2012-07-04 02:53:14.000000000 +0000 +++ bluez-4.101/debian/changelog 2012-07-12 18:53:15.000000000 +0000 @@ -1,3 +1,11 @@ +bluez (4.101-0ubuntu2) quantal; urgency=low + + * debian/control: enable autopkgtest tests; add XS-Testsuite. + * debian/tests/control, debian/tests/bluez_response: add new tests for bluez + adapter and device support. + + -- Mathieu Trudel-Lapierre Thu, 12 Jul 2012 14:53:13 -0400 + bluez (4.101-0ubuntu1) quantal-proposed; urgency=low * New upstream release diff -Nru bluez-4.101/debian/control bluez-4.101/debian/control --- bluez-4.101/debian/control 2012-07-04 02:53:14.000000000 +0000 +++ bluez-4.101/debian/control 2012-07-10 15:57:20.000000000 +0000 @@ -26,6 +26,7 @@ Vcs-Browser: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/trunk Homepage: http://www.bluez.org Standards-Version: 3.9.3 +XS-Testsuite: autopkgtest Package: libbluetooth3 Section: libs diff -Nru bluez-4.101/debian/tests/bluez_response bluez-4.101/debian/tests/bluez_response --- bluez-4.101/debian/tests/bluez_response 1970-01-01 00:00:00.000000000 +0000 +++ bluez-4.101/debian/tests/bluez_response 2012-07-12 18:41:45.000000000 +0000 @@ -0,0 +1,53 @@ +#!/usr/bin/env python3 +import unittest +import subprocess +import sys +import os + +import aptdaemon.test + +class TestBluezResponse(unittest.TestCase): + + devices = {} + + def setUp(self): + # start a local fake system D-BUS + dbus = subprocess.Popen(['dbus-daemon', '--nofork', '--print-address', + '--config-file', + os.path.join(aptdaemon.test.get_tests_dir(), 'dbus.conf')], + stdout=subprocess.PIPE, universal_newlines=True) + dbus_address = dbus.stdout.readline().strip() + os.environ['DBUS_SYSTEM_BUS_ADDRESS'] = dbus_address + + subprocess.call(['bluetoothd']) + p1 = subprocess.Popen(['hciconfig'], + stdout=subprocess.PIPE, + universal_newlines=True) + p2 = subprocess.Popen(['grep', '\(^hci\|BD\ Address\)'], + stdin=p1.stdout, stdout=subprocess.PIPE, + universal_newlines=True) + p1.stdout.close() + hciconf_output = p2.communicate()[0].replace('\t', ' ').split('\n') + + device_id = "" + for line in hciconf_output: + if "hci" in line: + device_id = line.split(':')[0] + elif "BD Address" in line: + self.devices[device_id] = line.split()[2] + + if len(self.devices) < 1: + self.skipTest("No bluetooth devices available for testing") + + def testDevice(self): + for dev in self.devices: + ret = subprocess.call(['bluez-test-device', '-i', dev, 'list']) + self.assertEqual(ret, 0) + + def testAdapter(self): + for dev in self.devices: + output = subprocess.check_output(['bluez-test-adapter', '-i', dev, 'address'], + universal_newlines=True) + self.assertIn(self.devices[dev], output) + +unittest.main(testRunner=unittest.TextTestRunner(stream=sys.stdout, verbosity=2)) diff -Nru bluez-4.101/debian/tests/control bluez-4.101/debian/tests/control --- bluez-4.101/debian/tests/control 1970-01-01 00:00:00.000000000 +0000 +++ bluez-4.101/debian/tests/control 2012-07-12 18:28:54.000000000 +0000 @@ -0,0 +1,3 @@ +Tests: bluez_response +Depends: python3-aptdaemon.test, python, python3, python-gi, python3-gi, python-dbus, python3-dbus, gir1.2-glib-2.0, bluez +Restrictions: needs-root