From 622115a2fb34a4ef4888534402eb34f8457c12e6 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 21 Sep 2015 16:27:49 +0200 Subject: [PATCH] Autopkgtest: Fix updating results with explicit triggers When fetching a result with explicit triggers, always update self.results, not just when we have a pending trigger for it. Otherwise satisfied_triggers will be empty after reading the first result, and we clobber test results for all triggers with the latest result. --- autopkgtest.py | 2 +- tests/test_autopkgtest.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/autopkgtest.py b/autopkgtest.py index 64c0550..f764e9a 100644 --- a/autopkgtest.py +++ b/autopkgtest.py @@ -429,11 +429,11 @@ class AutoPackageTest(object): # preferred (and robust) way of matching results to pending # requests for result_trigger in result_triggers: + satisfied_triggers.add(result_trigger) try: request_map[src][pending_ver][arch].remove(result_trigger) self.log_verbose('-> matches pending request %s/%s/%s for trigger %s' % (src, pending_ver, arch, str(result_trigger))) - satisfied_triggers.add(result_trigger) except (KeyError, ValueError): self.log_verbose('-> does not match any pending request for %s/%s/%s' % (src, pending_ver, arch)) diff --git a/tests/test_autopkgtest.py b/tests/test_autopkgtest.py index aee3afe..f43e8dc 100755 --- a/tests/test_autopkgtest.py +++ b/tests/test_autopkgtest.py @@ -1271,6 +1271,38 @@ fancy 1 i386 linux-meta-lts-grumpy 1 self.assertEqual(self.pending_requests, 'fancy 1 amd64 linux-meta-lts-grumpy 1\n') + def test_dkms_results_per_kernel_old_results(self): + '''DKMS results get mapped to the triggering kernel version, old results''' + + self.data.add('dkms', False, {}) + self.data.add('fancy-dkms', False, {'Source': 'fancy', 'Depends': 'dkms (>= 1)'}) + + # works against linux-meta and -64only, fails against grumpy i386, no + # result yet for grumpy amd64 + self.swift.set_results({'autopkgtest-series': { + # old results without trigger info + 'series/i386/f/fancy/20140101_100101@': (0, 'fancy 1', {}), + 'series/amd64/f/fancy/20140101_100101@': (8, 'fancy 1', {}), + # current results with triggers + 'series/i386/f/fancy/20150101_100101@': (0, 'fancy 1', {'custom_environment': ['ADT_TEST_TRIGGERS=linux-meta/1']}), + 'series/amd64/f/fancy/20150101_100101@': (0, 'fancy 1', {'custom_environment': ['ADT_TEST_TRIGGERS=linux-meta/1']}), + 'series/amd64/f/fancy/20150101_100201@': (0, 'fancy 1', {'custom_environment': ['ADT_TEST_TRIGGERS=linux-meta-64only/1']}), + 'series/i386/f/fancy/20150101_100301@': (4, 'fancy 1', {'custom_environment': ['ADT_TEST_TRIGGERS=linux-meta-lts-grumpy/1']}), + }}) + + self.do_test( + [('linux-image-generic', {'Source': 'linux-meta'}, None), + ('linux-image-grumpy-generic', {'Source': 'linux-meta-lts-grumpy'}, None), + ('linux-image-64only', {'Source': 'linux-meta-64only', 'Architecture': 'amd64'}, None), + ], + {'linux-meta': (True, {'fancy 1': {'amd64': 'PASS', 'i386': 'PASS'}}), + # we don't have an explicit result for amd64, so the old one counts + 'linux-meta-lts-grumpy': (False, {'fancy 1': {'amd64': 'REGRESSION', 'i386': 'REGRESSION'}}), + 'linux-meta-64only': (True, {'fancy 1': {'amd64': 'PASS'}}), + }) + + self.assertEqual(self.pending_requests, '') + def test_kernel_triggers_lxc(self): '''LXC test gets triggered by kernel uploads'''