diff -Nru autopkgtest-4.2.2~ubuntu14.04.1/debian/changelog autopkgtest-4.3~ubuntu14.04.1/debian/changelog --- autopkgtest-4.2.2~ubuntu14.04.1/debian/changelog 2016-12-05 16:48:40.000000000 +0000 +++ autopkgtest-4.3~ubuntu14.04.1/debian/changelog 2017-01-21 09:35:33.000000000 +0000 @@ -1,8 +1,26 @@ -autopkgtest (4.2.2~ubuntu14.04.1) trusty-backports; urgency=medium +autopkgtest (4.3~ubuntu14.04.1) trusty-backports; urgency=medium * No-change backport to trusty - -- Martin Pitt Mon, 05 Dec 2016 17:48:40 +0100 + -- Martin Pitt Sat, 21 Jan 2017 10:35:33 +0100 + +autopkgtest (4.3) unstable; urgency=medium + + [ SZALAY Attila ] + * Respect --shell-on-failure on test dep install failure (Closes: #844255) + + [ Barry Warsaw ] + * Use a test name that won't collide with my $HOME. + * Shorten the name in response to review + * testdesc.py: Feature: test-name=foobar added for better Test-Command names + (Closes: #839253) + * autopkgtest: Support --test-name and deprecate --testname + + [ Paul Gevers ] + * tests: Use valid Debian architecture in ChrootRunner tests + (Closes: #849676) + + -- Martin Pitt Wed, 11 Jan 2017 12:34:09 +0100 autopkgtest (4.2.2) unstable; urgency=medium diff -Nru autopkgtest-4.2.2~ubuntu14.04.1/lib/adt_testbed.py autopkgtest-4.3~ubuntu14.04.1/lib/adt_testbed.py --- autopkgtest-4.2.2~ubuntu14.04.1/lib/adt_testbed.py 2016-11-29 08:11:05.000000000 +0000 +++ autopkgtest-4.3~ubuntu14.04.1/lib/adt_testbed.py 2017-01-11 11:34:09.000000000 +0000 @@ -330,7 +330,7 @@ self._opened(pl) self.modified = False - def install_deps(self, deps_new, recommends): + def install_deps(self, deps_new, recommends, shell_on_failure=False): '''Install dependencies into testbed''' adtlog.debug('install_deps: deps_new=%s, recommends=%s' % (deps_new, recommends)) @@ -338,7 +338,7 @@ self.recommends_installed = recommends if not deps_new: return - self.satisfy_dependencies_string(', '.join(deps_new), 'install-deps', recommends) + self.satisfy_dependencies_string(', '.join(deps_new), 'install-deps', recommends, shell_on_failure=shell_on_failure) def needs_reset(self): # show what caused a reset @@ -555,6 +555,8 @@ self.check_exec(['/bin/sh', '-ec', 'rm /etc/apt/preferences.d/autopkgtest-*-' + pocket]) continue + if shell_on_failure: + self.run_shell() self.badpkg('Test dependencies are unsatisfiable. A common reason is ' 'that your testbed is out of date with respect to the ' 'archive, and you need to use a current testbed or run ' diff -Nru autopkgtest-4.2.2~ubuntu14.04.1/lib/autopkgtest_args.py autopkgtest-4.3~ubuntu14.04.1/lib/autopkgtest_args.py --- autopkgtest-4.2.2~ubuntu14.04.1/lib/autopkgtest_args.py 2016-11-29 08:11:05.000000000 +0000 +++ autopkgtest-4.3~ubuntu14.04.1/lib/autopkgtest_args.py 2017-01-11 11:34:09.000000000 +0000 @@ -202,8 +202,12 @@ g_test.add_argument('--override-control', metavar='PATH', help='run tests from control file/manifest PATH instead ' 'of the source/click package') - g_test.add_argument('--testname', - help='run only given test name in the next package') + # Don't display the deprecated argument name in the --help output. + g_test.add_argument('--testname', help=argparse.SUPPRESS) + g_test.add_argument('--test-name', + dest='testname', + help='run only given test name. ' + 'This replaces --testname, which is deprecated.') g_test.add_argument('-B', '--no-built-binaries', dest='built_binaries', action='store_false', default=True, help='do not build/use binaries from .dsc, git source, or unbuilt tree') @@ -322,6 +326,10 @@ file_parser = ArgumentParser(add_help=False) arglist = file_parser.parse_known_args(arglist)[1] + # deprecation warning + if '--testname' in arglist: + adtlog.warning('--testname is deprecated; use --test-name') + # split off virt-server args try: sep = arglist.index('--') diff -Nru autopkgtest-4.2.2~ubuntu14.04.1/lib/testdesc.py autopkgtest-4.3~ubuntu14.04.1/lib/testdesc.py --- autopkgtest-4.2.2~ubuntu14.04.1/lib/testdesc.py 2016-11-29 08:11:05.000000000 +0000 +++ autopkgtest-4.3~ubuntu14.04.1/lib/testdesc.py 2017-01-11 11:34:09.000000000 +0000 @@ -389,7 +389,25 @@ try: restrictions = record.get('Restrictions', '').replace( ',', ' ').split() - features = record.get('Features', '').replace(',', ' ').split() + + feature_test_name = None + features = [] + record_features = record.get('Features', '').replace( + ',', ' ').split() + for feature in record_features: + details = feature.split('=', 1) + if details[0] != 'test-name': + features.append(feature) + continue + if len(details) != 2: + # No value, i.e. a bare 'test-name' + raise InvalidControl( + '*', 'test-name feature with no argument') + if feature_test_name is not None: + raise InvalidControl( + '*', 'only one test-name feature allowed') + feature_test_name = details[1] + features.append(feature) if 'Tests' in record: test_names = record['Tests'].replace(',', ' ').split() @@ -400,6 +418,9 @@ if 'Test-command' in record: raise InvalidControl('*', 'Only one of "Tests" or ' '"Test-Command" may be given') + if feature_test_name is not None: + raise InvalidControl( + '*', 'test-name feature incompatible with Tests') test_dir = record.get('Tests-directory', 'debian/tests') _debian_check_unknown_fields(test_names[0], record) @@ -414,8 +435,11 @@ record.get('Depends', '@'), srcdir, testbed_arch) - command_counter += 1 - name = 'command%i' % command_counter + if feature_test_name is None: + command_counter += 1 + name = 'command%i' % command_counter + else: + name = feature_test_name _debian_check_unknown_fields(name, record) test = Test(name, None, command, restrictions, features, depends, [], []) diff -Nru autopkgtest-4.2.2~ubuntu14.04.1/runner/adt-run autopkgtest-4.3~ubuntu14.04.1/runner/adt-run --- autopkgtest-4.2.2~ubuntu14.04.1/runner/adt-run 2016-11-29 08:11:05.000000000 +0000 +++ autopkgtest-4.3~ubuntu14.04.1/runner/adt-run 2017-01-11 11:34:09.000000000 +0000 @@ -157,7 +157,7 @@ adtlog.info('test %s: preparing testbed' % t.name) testbed.reset(t.depends, 'needs-recommends' in t.restrictions) binaries.publish() - testbed.install_deps(t.depends, 'needs-recommends' in t.restrictions) + testbed.install_deps(t.depends, 'needs-recommends' in t.restrictions, opts.shell_fail) testbed.run_test(tree, t, opts.env, opts.shell_fail, opts.shell, opts.build_parallel) @@ -620,7 +620,7 @@ (testname, kind, arg)) tests = [t for t in tests if t.name == testname] if not tests: - adtlog.error('%s %s has no test matching --testname %s' % + adtlog.error('%s %s has no test matching --test-name %s' % (kind, arg, testname)) # error code will be set later testname = None diff -Nru autopkgtest-4.2.2~ubuntu14.04.1/runner/autopkgtest autopkgtest-4.3~ubuntu14.04.1/runner/autopkgtest --- autopkgtest-4.2.2~ubuntu14.04.1/runner/autopkgtest 2016-11-29 08:11:05.000000000 +0000 +++ autopkgtest-4.3~ubuntu14.04.1/runner/autopkgtest 2017-01-11 11:34:09.000000000 +0000 @@ -157,7 +157,7 @@ adtlog.info('test %s: preparing testbed' % t.name) testbed.reset(t.depends, 'needs-recommends' in t.restrictions) binaries.publish() - testbed.install_deps(t.depends, 'needs-recommends' in t.restrictions) + testbed.install_deps(t.depends, 'needs-recommends' in t.restrictions, opts.shell_fail) testbed.run_test(tree, t, opts.env, opts.shell_fail, opts.shell, opts.build_parallel) @@ -620,7 +620,7 @@ (testname, kind, arg)) tests = [t for t in tests if t.name == testname] if not tests: - adtlog.error('%s %s has no test matching --testname %s' % + adtlog.error('%s %s has no test matching --test-name %s' % (kind, arg, testname)) # error code will be set later testname = None diff -Nru autopkgtest-4.2.2~ubuntu14.04.1/runner/autopkgtest.1 autopkgtest-4.3~ubuntu14.04.1/runner/autopkgtest.1 --- autopkgtest-4.2.2~ubuntu14.04.1/runner/autopkgtest.1 2016-11-29 08:11:05.000000000 +0000 +++ autopkgtest-4.3~ubuntu14.04.1/runner/autopkgtest.1 2017-01-11 11:34:09.000000000 +0000 @@ -151,8 +151,9 @@ or the Click manifest. .TP -.BI --testname= TEST -Run only the given test name (from test control file). +.BI --test-name= TEST +Run only the given test name (from test control file). This replaces +--testname which is deprecated. .SH LOGGING OPTIONS If you don't specify any option, diff -Nru autopkgtest-4.2.2~ubuntu14.04.1/tests/adt-run autopkgtest-4.3~ubuntu14.04.1/tests/adt-run --- autopkgtest-4.2.2~ubuntu14.04.1/tests/adt-run 2016-11-29 08:11:05.000000000 +0000 +++ autopkgtest-4.3~ubuntu14.04.1/tests/adt-run 2017-01-11 11:34:09.000000000 +0000 @@ -1431,7 +1431,7 @@ with open(p, 'w') as f: f.write('#!/bin/sh\n') if cmd == 'dpkg': - f.write('if [ "$1" = "--print-architecture" ]; then echo megacpu; exit; fi\n') + f.write('if [ "$1" = "--print-architecture" ]; then echo powerpc; exit; fi\n') f.write('echo "fake-%s: $@"\n' % cmd) if cmd == 'apt-get': f.write('if [ "$1" = source ]; then cp -r /aptget-src $4-1; fi\n') diff -Nru autopkgtest-4.2.2~ubuntu14.04.1/tests/autopkgtest autopkgtest-4.3~ubuntu14.04.1/tests/autopkgtest --- autopkgtest-4.2.2~ubuntu14.04.1/tests/autopkgtest 2016-11-29 08:11:05.000000000 +0000 +++ autopkgtest-4.3~ubuntu14.04.1/tests/autopkgtest 2017-01-11 11:34:09.000000000 +0000 @@ -1093,7 +1093,7 @@ 'two': '#!/bin/sh\necho 2_TWO', 'three': '#!/bin/sh\necho 3_THREE'}) - (code, out, err) = self.runtest(['-B', '--testname', 'two', p]) + (code, out, err) = self.runtest(['-B', '--test-name', 'two', p]) self.assertEqual(code, 0, err) self.assertRegex(out, 'two\s+PASS', out) @@ -1112,7 +1112,7 @@ 'two': '#!/bin/sh\necho 2_TWO', 'three': '#!/bin/sh\necho 3_THREE'}) - (code, out, err) = self.runtest(['-B', '--testname', 'four', p]) + (code, out, err) = self.runtest(['-B', '--test-name', 'four', p]) self.assertEqual(code, 8, err) for w in ['one', 'two', 'three']: @@ -1132,7 +1132,7 @@ def test_test_not_found(self): '''Tests: specifies a nonexisting test''' - p = self.build_src('Tests: foo\nDepends:\n', {'bar': '#!/bin/sh -e\nno_such_command'}) + p = self.build_src('Tests: foo\nDepends:\n', {'xxbar': '#!/bin/sh -e\nno_such_command'}) (code, out, err) = self.runtest(['-B', p]) self.assertEqual(code, 12, err) @@ -1140,8 +1140,8 @@ self.assertIn('badpkg: debian/tests/foo does not exist', out) self.assertIn('debian/tests/foo does not exist', err) self.assertNotIn('testbed auxverb failed with', err) - self.assertNotIn('bar', out) - self.assertNotIn('bar', err) + self.assertNotIn('xxbar', out) + self.assertNotIn('xxbar', err) def test_invalid_depends(self): '''Depends: has invalid syntax''' @@ -1496,7 +1496,7 @@ with open(p, 'w') as f: f.write('#!/bin/sh\n') if cmd == 'dpkg': - f.write('if [ "$1" = "--print-architecture" ]; then echo megacpu; exit; fi\n') + f.write('if [ "$1" = "--print-architecture" ]; then echo powerpc; exit; fi\n') f.write('echo "fake-%s: $@"\n' % cmd) if cmd == 'apt-get': f.write('if [ "$1" = source ]; then cp -r /aptget-src $4-1; fi\n') diff -Nru autopkgtest-4.2.2~ubuntu14.04.1/tests/autopkgtest_args autopkgtest-4.3~ubuntu14.04.1/tests/autopkgtest_args --- autopkgtest-4.2.2~ubuntu14.04.1/tests/autopkgtest_args 2016-11-29 08:11:05.000000000 +0000 +++ autopkgtest-4.3~ubuntu14.04.1/tests/autopkgtest_args 2017-01-11 11:34:09.000000000 +0000 @@ -209,10 +209,17 @@ # def test_testname(self): + # --testname is deprecated; use --test-name (args, acts, virt) = self.parse(['--testname', 'foo', 'mypkg']) self.assertEqual(acts, [('apt-source', 'mypkg', False)]) self.assertEqual(args.testname, 'foo') + def test_test_name(self): + # --testname is deprecated; use --test-name + (args, acts, virt) = self.parse(['--test-name', 'foo', 'mypkg']) + self.assertEqual(acts, [('apt-source', 'mypkg', False)]) + self.assertEqual(args.testname, 'foo') + def test_default_options(self): args = self.parse(['mypkg'])[0] self.assertEqual(args.verbosity, 1) @@ -249,7 +256,7 @@ def test_read_file(self): argfile = os.path.join(self.workdir.name, 'myopts') with open(argfile, 'w') as f: - f.write('testsrc_1.dsc\n--testname=foo\n--timeout-copy=5') + f.write('testsrc_1.dsc\n--test-name=foo\n--timeout-copy=5') autopkgtest_args.adtlog.verbosity = 2 (args, acts, virt) = self.parse( @@ -346,7 +353,7 @@ # has description self.assertIn('Test installed bin', out) # has actions - self.assertIn('--testname', out) + self.assertIn('--test-name', out) # has options self.assertIn('--no-built-binaries', out) # has virt server diff -Nru autopkgtest-4.2.2~ubuntu14.04.1/tests/testdesc autopkgtest-4.3~ubuntu14.04.1/tests/testdesc --- autopkgtest-4.2.2~ubuntu14.04.1/tests/testdesc 2016-11-29 08:11:05.000000000 +0000 +++ autopkgtest-4.3~ubuntu14.04.1/tests/testdesc 2017-01-11 11:34:09.000000000 +0000 @@ -242,6 +242,65 @@ 'three (>= 0~) [c64 vax]']) self.assertFalse(skipped) + def test_test_name_feature(self): + '''Features: test-name=foobar''' + + (ts, skipped) = self.call_parse( + 'Test-Command: t1\n' + 'Depends: foo\n' + 'Features: test-name=foobar') + self.assertEqual(len(ts), 1) + self.assertEqual(ts[0].features, ['test-name=foobar']) + self.assertEqual(ts[0].name, 'foobar') + self.assertFalse(skipped) + + def test_test_name_feature_too_many(self, *args): + '''only one test-name= feature is allowed''' + + with self.assertRaises(testdesc.InvalidControl) as cm: + self.call_parse( + 'Test-Command: t1\n' + 'Depends: foo\n' + 'Features: test-name=foo,test-name=bar') + self.assertEqual( + str(cm.exception), + 'InvalidControl test *: only one test-name feature allowed') + + def test_test_name_feature_with_other_features(self): + '''Features: test-name=foobar, blue''' + + (ts, skipped) = self.call_parse( + 'Test-Command: t1\n' + 'Depends: foo\n' + 'Features: test-name=foo,blue') + self.assertEqual(len(ts), 1) + self.assertEqual(ts[0].features, ['test-name=foo', 'blue']) + self.assertFalse(skipped) + + def test_test_name_missing_name(self, *args): + '''Features: test-name''' + + with self.assertRaises(testdesc.InvalidControl) as cm: + self.call_parse( + 'Test-Command: t1\n' + 'Depends: foo\n' + 'Features: test-name') + self.assertEqual( + str(cm.exception), + 'InvalidControl test *: test-name feature with no argument') + + def test_test_name_incompatible_with_tests(self, *args): + '''Tests: with Features: test-name=foo''' + + with self.assertRaises(testdesc.InvalidControl) as cm: + self.call_parse( + 'Tests: t1\n' + 'Depends: foo\n' + 'Features: test-name=foo') + self.assertEqual( + str(cm.exception), + 'InvalidControl test *: test-name feature incompatible with Tests') + def test_known_restrictions(self): '''known restrictions'''