From 6c3dd0a3e2910f5a531f554ab2cce67da8b563a9 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 13 Aug 2015 09:36:47 +0200 Subject: [PATCH] Fix KeyError crash for sources which are only in unstable The previous commit introduced a KeyError crash in tests_for_source() for packages which are unbuilt/uninstallable and only present in unstable. Ignore these in tests_for_source() as they can't possibly be a regression for their dependencies, and there is no sensible way to run a test for them. --- autopkgtest.py | 11 ++++++++--- tests/test_autopkgtest.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/autopkgtest.py b/autopkgtest.py index 7a1c37f..c13f9c0 100644 --- a/autopkgtest.py +++ b/autopkgtest.py @@ -174,9 +174,14 @@ class AutoPackageTest(object): # works, then the unstable src does not break the testing # rdep_src and is fine if rdep_src in self.excludes: - rdep_src_info = self.britney.sources['testing'][rdep_src] - self.log_verbose('Reverse dependency %s of %s/%s is unbuilt or uninstallable, running test against testing version %s' % - (rdep_src, src, ver, rdep_src_info[VERSION])) + try: + rdep_src_info = self.britney.sources['testing'][rdep_src] + self.log_verbose('Reverse dependency %s of %s/%s is unbuilt or uninstallable, running test against testing version %s' % + (rdep_src, src, ver, rdep_src_info[VERSION])) + except KeyError: + self.log_verbose('Reverse dependency %s of %s/%s is unbuilt or uninstallable and not present in testing, ignoring' % + (rdep_src, src, ver)) + continue else: rdep_src_info = sources_info[rdep_src] if rdep_src_info[AUTOPKGTEST] or self.has_autodep8(rdep_src_info): diff --git a/tests/test_autopkgtest.py b/tests/test_autopkgtest.py index 47c2412..52622a3 100644 --- a/tests/test_autopkgtest.py +++ b/tests/test_autopkgtest.py @@ -415,6 +415,38 @@ lightgreen 1 i386 green 2 self.assertEqual(self.amqp_requests, set(['debci-series-amd64:lightgreen', 'debci-series-i386:lightgreen'])) + def test_rdepends_unbuilt_unstable_only(self): + '''Unbuilt reverse dependency which is not in testing''' + + self.swift.set_results({'autopkgtest-series': { + 'series/i386/d/darkgreen/20150101_100000@': (0, 'darkgreen 1'), + 'series/amd64/d/darkgreen/20150101_100001@': (0, 'darkgreen 1'), + 'series/i386/l/lightgreen/20150101_100000@': (0, 'lightgreen 1'), + 'series/amd64/l/lightgreen/20150101_100000@': (0, 'lightgreen 1'), + 'series/i386/g/green/20150101_020000@': (0, 'green 1'), + 'series/amd64/g/green/20150101_020000@': (0, 'green 1'), + 'series/i386/g/green/20150101_100200@': (0, 'green 2'), + 'series/amd64/g/green/20150101_100201@': (0, 'green 2'), + }}) + # run britney once to pick up previous results + self.do_test( + [('libgreen1', {'Version': '2', 'Source': 'green', 'Depends': 'libc6'}, 'autopkgtest')], + VALID_CANDIDATE) + os.unlink(self.fake_amqp) + + # add new uninstallable brokengreen; should not run test at all + self.do_test( + [('brokengreen', {'Version': '1', 'Depends': 'libgreen1, nonexisting'}, 'autopkgtest')], + VALID_CANDIDATE, + [r'\bgreen\b.*>1 to .*>2<', + r'\bbrokengreen\b.*- to .*>1<', + r'autopkgtest for green 2: .*amd64.*Pass.*i386.*Pass', + r'autopkgtest for darkgreen 1: .*amd64.*Pass.*i386.*Pass', + 'Not considered', # for brokengreen + r'brokengreen/amd64 unsatisfiable Depends: nonexisting'], + ['autopkgtest for brokengreen']) + self.assertEqual(self.amqp_requests, set()) + def test_hint_force_badtest(self): '''force-badtest hint'''