Adding patch proposal.
diff -Nru pcp-3.12.0/debian/changelog pcp-3.12.0/debian/changelog --- pcp-3.12.0/debian/changelog 2017-06-30 02:30:27.000000000 +0200 +++ pcp-3.12.0/debian/changelog 2017-08-03 10:37:04.000000000 +0200 @@ -1,3 +1,9 @@ +pcp (3.12.0-1) unstable; urgency=medium + + * Added autopkgtests and d/watch. (closes: #871254) + + -- Dariusz Gadomski <[email protected]> Thu, 03 Aug 2017 10:37:04 +0200 + pcp (3.12.0) unstable; urgency=low * New release (full details in CHANGELOG). diff -Nru pcp-3.12.0/debian/tests/check_cli_tools.py pcp-3.12.0/debian/tests/check_cli_tools.py --- pcp-3.12.0/debian/tests/check_cli_tools.py 1970-01-01 01:00:00.000000000 +0100 +++ pcp-3.12.0/debian/tests/check_cli_tools.py 2017-08-03 10:37:04.000000000 +0200 @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 + + +import unittest +import subprocess + + +class TestCliTools(unittest.TestCase): + def test_pmerr(self): + subprocess.check_call(['pmerr', '-2']); + + def test_pminfo(self): + subprocess.check_call(['pminfo', 'proc.nprocs']) + + def test_pcp(self): + subprocess.check_call(['pcp']) + + def test_pmstat(self): + subprocess.check_call(['pmstat', '-s', '1']) + + def test_pmdate(self): + subprocess.check_call(['pmdate', '-7d', '%d%m%Y']) + + def test_pmprobe(self): + subprocess.check_call(['pmprobe']) + + def test_pmclient(self): + subprocess.check_call(['pmclient', '-s', '1']) + + def test_pmval(self): + subprocess.check_call(['pmval', 'proc.nprocs', '-s', '1']) + + def test_pmcollectl(self): + subprocess.check_call(['pmcollectl', '-c', '1']) + + def test_pmiostat(self): + subprocess.check_call(['pmiostat', '-s', '2']) + +if __name__ == "__main__": + import sys + unittest.main(testRunner=unittest.TextTestRunner(stream=sys.stdout, + verbosity=2)) diff -Nru pcp-3.12.0/debian/tests/check_daemons.py pcp-3.12.0/debian/tests/check_daemons.py --- pcp-3.12.0/debian/tests/check_daemons.py 1970-01-01 01:00:00.000000000 +0100 +++ pcp-3.12.0/debian/tests/check_daemons.py 2017-08-03 10:37:04.000000000 +0200 @@ -0,0 +1,70 @@ +#!/usr/bin/env python3 + + +import subprocess +import unittest + + +SERVICE_PMCD = "pmcd.service" +SERVICE_PMLOGGER = "pmcd.service" + + +PORTS_PMCD = [44321] +PORTS_PMLOGGER = [4330] + + +PROP_ACTIVESTATE = "ActiveState" +PROP_SUBSTATE = "SubState" +STATE_RUNNING = "running" +STATE_ACTIVE = "active" + + +def format_args(service, property): + return ["systemctl", "show", "-p" + property, service] + + +def search_output(output, startsWith): + for line in output.splitlines(): + if line.startswith(startsWith + "="): + return line[(len(startsWith)+1):] + + +def check_port(port): + import socket + s = socket.socket() + address = '127.0.0.1' + try: + s.connect((address, port)) + except: + return False + finally: + s.close() + return True + + + +class TestDaemons(unittest.TestCase): + def check_property(self, service, property, expected): + output = subprocess.check_output( + format_args(service, property)).decode("utf-8") + self.assertEqual(search_output(output, property), expected) + + def test_pmcd(self): + self.check_property(SERVICE_PMCD, PROP_ACTIVESTATE, STATE_ACTIVE) + self.check_property(SERVICE_PMCD, PROP_SUBSTATE, STATE_RUNNING) + + for port in PORTS_PMCD: + self.assertTrue(check_port(port)) + + def test_pmlogger(self): + self.check_property(SERVICE_PMLOGGER, PROP_ACTIVESTATE, STATE_ACTIVE) + self.check_property(SERVICE_PMLOGGER, PROP_SUBSTATE, STATE_RUNNING) + + for port in PORTS_PMLOGGER: + self.assertTrue(check_port(port)) + + +if __name__ == "__main__": + import sys + unittest.main(testRunner=unittest.TextTestRunner(stream=sys.stdout, + verbosity=2)) diff -Nru pcp-3.12.0/debian/tests/control pcp-3.12.0/debian/tests/control --- pcp-3.12.0/debian/tests/control 1970-01-01 01:00:00.000000000 +0100 +++ pcp-3.12.0/debian/tests/control 2017-08-03 10:37:04.000000000 +0200 @@ -0,0 +1,5 @@ +Tests: check_daemons.py +Depends: pcp, dbus + +Tests: check_cli_tools.py +Depends: pcp diff -Nru pcp-3.12.0/debian/watch pcp-3.12.0/debian/watch --- pcp-3.12.0/debian/watch 1970-01-01 01:00:00.000000000 +0100 +++ pcp-3.12.0/debian/watch 2017-08-03 10:37:04.000000000 +0200 @@ -0,0 +1,3 @@ +version=3 +opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/pcp-$1\.tar\.gz/ \ + https://github.com/performancecopilot/pcp/tags .*/v?(\d\S+)\.tar\.gz

