diff -Nru autopkgtest-2.12/debian/changelog autopkgtest-2.13/debian/changelog --- autopkgtest-2.12/debian/changelog 2014-03-31 09:45:17.000000000 +0000 +++ autopkgtest-2.13/debian/changelog 2014-04-01 13:43:17.000000000 +0000 @@ -1,3 +1,13 @@ +autopkgtest (2.13) unstable; urgency=medium + + * Split package/version list that got introduced in 2.10: Introduce a new + output file "testbed-packages" with the packages and versions of the + pristine testbed, and filter them out of "-packages", so that + the latter only contains the packages and versions that are specific to + that test. This is generally more useful, and how debci does/wants it. + + -- Martin Pitt Tue, 01 Apr 2014 14:43:12 +0100 + autopkgtest (2.12) unstable; urgency=medium [ Martin Pitt ] diff -Nru autopkgtest-2.12/runner/adt-run autopkgtest-2.13/runner/adt-run --- autopkgtest-2.12/runner/adt-run 2014-03-31 09:45:17.000000000 +0000 +++ autopkgtest-2.13/runner/adt-run 2014-04-01 13:43:17.000000000 +0000 @@ -1185,6 +1185,16 @@ else: error('debian/changelog is invalid, cannot parse version') + # record package versions of pristine testbed + if opts.output_dir: + pkglist = TempTestbedPath(testbed, 'testbed-packages', autoclean=False) + rc = testbed.execute( + 'record-pkgversions-testbed', + ['sh', '-ec', "dpkg-query --show -f '${Package}\\t${Version}\\n' > %s" % pkglist.tb]) + if rc: + bomb('failed to get package list') + pkglist.copyup() + if stanzas == (): report('*', 'SKIP no tests in this package') errorcode |= 8 @@ -1255,7 +1265,7 @@ def run(self, tree): # record installed package versions if opts.output_dir: - pkglist = TempTestbedPath(testbed, self.what + '-packages', autoclean=False) + pkglist = TempTestbedPath(testbed, self.what + '-packages.all', autoclean=False) rc = testbed.execute( 'record-pkgversions-' + self.what, ['sh', '-ec', "dpkg-query --show -f '${Package}\\t${Version}\\n' > %s" % pkglist.tb]) @@ -1263,6 +1273,15 @@ bomb('failed to get package list') pkglist.copyup() + # filter out packages from the base system + with open(pkglist.host[:-4], 'w') as out: + rc = script_out(['join', '-v2', '-t\t', + os.path.join(opts.output_dir, 'testbed-packages'), + pkglist.host], stdout=out, env={})[0] + if rc: + badpkg('failed to call join for test specific package list, code %d' % rc) + os.unlink(pkglist.host) + # ensure our tests are in the testbed tree.copydown() diff -Nru autopkgtest-2.12/tests/adt-run autopkgtest-2.13/tests/adt-run --- autopkgtest-2.12/tests/adt-run 2014-03-31 09:45:17.000000000 +0000 +++ autopkgtest-2.13/tests/adt-run 2014-04-01 13:43:17.000000000 +0000 @@ -480,20 +480,26 @@ contents = f.read() self.assertEqual(contents, 'testpkg 1\n') - # check recorded package list + # check recorded package lists + with open(os.path.join(outdir, 'testbed-packages')) as f: + contents = f.read() + lines = contents.splitlines() + self.assertGreater(len(lines), 10) + self.assertRegex(lines[0], '^[0-9a-z.-]+\t[0-9a-z.~-]+') + self.assertRegex(lines[1], '^[0-9a-z.-]+\t[0-9a-z.~-]+') + self.assertIn('bash\t', contents) + + # test don't pull in any additional dependencies for t in ['sP', 'sF', 'bP']: - with open(os.path.join(outdir, 'ubtree0t-%s-packages' % t)) as f: - lines = f.read().splitlines() - self.assertGreater(len(lines), 10) - self.assertRegex(lines[0], '^[0-9a-z.-]+\t[0-9a-z.~-]+') - self.assertRegex(lines[1], '^[0-9a-z.-]+\t[0-9a-z.~-]+') + self.assertEqual(os.path.getsize(os.path.join( + outdir, 'ubtree0t-%s-packages' % t)), 0) # check for cruft in outdir # --no-built-binaries, we don't expect any debs files = [i for i in os.listdir(outdir) if not fnmatch.fnmatch(i, 'ubtree*-std*') and not fnmatch.fnmatch(i, 'ubtree*-packages')] - self.assertEqual(set(files), set(['log', 'testpkg-version'])) + self.assertEqual(set(files), set(['log', 'testpkg-version', 'testbed-packages'])) def test_timeout(self): '''handling test timeout''' @@ -985,7 +991,7 @@ files = [i for i in os.listdir(outdir) if not fnmatch.fnmatch(i, 'ubtree*-std*') and not fnmatch.fnmatch(i, 'ubtree*-packages')] - self.assertEqual(set(files), set(['log', 'artifacts', 'testpkg-version'])) + self.assertEqual(set(files), set(['log', 'artifacts', 'testpkg-version', 'testbed-packages'])) # check artifact; a2 should overwrite a1's health.txt with open(os.path.join(outdir, 'artifacts', 'health.txt')) as f: @@ -1475,7 +1481,7 @@ def test_tree_output_dir(self): '''source tree, explicit --output-dir''' - p = self.build_src('Tests: ok broken\n', + p = self.build_src('Tests: ok\n\nTests: broken\nDepends: @, aspell-doc', {'ok': '#!/bin/sh\n/usr/bin/test_built', 'broken': '#!/bin/sh\necho kaputt >&2'}) @@ -1519,13 +1525,24 @@ contents = f.read() self.assertEqual(contents, 'testpkg 1\n') + # check recorded package lists + with open(os.path.join(outdir, 'testbed-packages')) as f: + contents = f.read() + lines = contents.splitlines() + self.assertGreater(len(lines), 10) + self.assertRegex(lines[0], '^[0-9a-z.-]+\t[0-9a-z.~-]+') + self.assertRegex(lines[1], '^[0-9a-z.-]+\t[0-9a-z.~-]+') + self.assertIn('bash\t', contents) + # check recorded package list for t in ['ok', 'broken']: with open(os.path.join(outdir, 'ubtree0t-%s-packages' % t)) as f: - lines = f.read().splitlines() - self.assertGreater(len(lines), 10) - self.assertRegex(lines[0], '^[0-9a-z.-]+\t[0-9a-z.~-]+') - self.assertRegex(lines[1], '^[0-9a-z.-]+\t[0-9a-z.~-]+') + contents = f.read() + self.assertIn('testpkg\t1\n', contents) + if t == 'broken': + self.assertIn('aspell-doc\t', contents) + else: + self.assertNotIn('aspell-doc\t', contents) # check binaries bins = os.listdir(os.path.join(outdir, 'binaries')) @@ -1537,7 +1554,7 @@ files = [i for i in os.listdir(outdir) if not fnmatch.fnmatch(i, 'ubtree*-std*') and not fnmatch.fnmatch(i, 'ubtree*-packages')] - self.assertEqual(set(files), set(['log', 'binaries', 'testpkg-version'])) + self.assertEqual(set(files), set(['log', 'binaries', 'testpkg-version', 'testbed-packages'])) def test_user(self): '''--user option'''