From 49260078e463bb14c90015b2594625f2dbb46038 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 16 Sep 2015 22:59:05 +0200 Subject: [PATCH] autopkgtest: Make Linux -> DKMS triggering arch specific Only trigger DKMS tests for architectures on which the given kernel actually exists. --- autopkgtest.py | 23 +++++++++++++---------- tests/test_autopkgtest.py | 21 ++++++++++++++++++--- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/autopkgtest.py b/autopkgtest.py index 170b7e7..ed3ba08 100644 --- a/autopkgtest.py +++ b/autopkgtest.py @@ -186,7 +186,11 @@ class AutoPackageTest(object): # linux-meta* builds a "dkms" binary as well. With that we ensure that we # don't regress DKMS drivers with new kernel versions. if src.startswith('linux-meta'): - extra_bins.append('dkms') + # does this have any image on this arch? + for b in srcinfo[BINARIES]: + p, a = b.split('/', 1) + if a == arch and '-image' in p: + extra_bins.append('dkms') # plus all direct reverse dependencies of its binaries which have # an autopkgtest @@ -195,7 +199,7 @@ class AutoPackageTest(object): try: rdeps = binaries_info[binary][RDEPENDS] except KeyError: - self.log_verbose('Ignoring nonexistant binary %s (FTBFS/NBS)?' % binary) + self.log_verbose('Ignoring nonexistant binary %s on %s (FTBFS/NBS)?' % (binary, arch)) continue for rdep in rdeps: rdep_src = binaries_info[rdep][SOURCE] @@ -477,7 +481,7 @@ class AutoPackageTest(object): res.update(archinfo.keys()) return res - def _trigsources(verinfo): + def _trigsources(verinfo, arch): '''Calculate the triggers for a given verinfo map verinfo is ver -> arch -> {(triggering-src1, ver1), ...}, i. e. an @@ -488,12 +492,11 @@ class AutoPackageTest(object): kernel_triggers = set() nonkernel_triggers = set() for archinfo in verinfo.values(): - for triggers in archinfo.values(): - for (t, v) in triggers: - if t.startswith('linux-meta'): - kernel_triggers.add(t) - else: - nonkernel_triggers.add(t) + for (t, v) in archinfo[arch]: + if t.startswith('linux-meta'): + kernel_triggers.add(t) + else: + nonkernel_triggers.add(t) return (kernel_triggers, nonkernel_triggers) # build per-queue request strings for new test requests @@ -508,7 +511,7 @@ class AutoPackageTest(object): # run just one test for all triggers; but for proposed # kernels we want to run a separate test for each, so that # the test runs under that particular kernel - kernel_triggers, other_triggers = _trigsources(verinfo) + kernel_triggers, other_triggers = _trigsources(verinfo, arch) for kt in sorted(kernel_triggers): params = {'triggers': [kt]} requests.append((pkg, json.dumps(params))) diff --git a/tests/test_autopkgtest.py b/tests/test_autopkgtest.py index ee17cb2..67f3c7a 100755 --- a/tests/test_autopkgtest.py +++ b/tests/test_autopkgtest.py @@ -405,6 +405,16 @@ lightgreen 1 i386 green 2 }) }) + self.assertEqual( + self.amqp_requests, + set(['debci-series-i386:green {"triggers": ["green"]}', + 'debci-series-amd64:green {"triggers": ["green"]}', + 'debci-series-i386:lightgreen {"triggers": ["green"]}', + 'debci-series-amd64:lightgreen {"triggers": ["green"]}', + 'debci-series-i386:darkgreen {"triggers": ["green"]}', + 'debci-series-amd64:darkgreen {"triggers": ["green"]}', + 'debci-series-amd64:green64 {"triggers": ["green"]}'])) + self.assertIn('green64 1 amd64', self.pending_requests) self.assertNotIn('green64 1 i386', self.pending_requests) @@ -436,6 +446,7 @@ lightgreen 1 i386 green 2 )[0] # all tests ran, there should be no more pending ones + self.assertEqual(self.amqp_requests, set()) self.assertEqual(self.pending_requests, '') # not expecting any failures to retrieve from swift @@ -1157,10 +1168,12 @@ lightgreen 1 i386 green 3 self.do_test( [('linux-image-generic', {'Source': 'linux-meta'}, None), - ('linux-image-grumpy-generic', {'Source': 'linux-meta-lts-grumpy'}, None) + ('linux-image-grumpy-generic', {'Source': 'linux-meta-lts-grumpy'}, None), + ('linux-image-64only', {'Source': 'linux-meta-64only', 'Architecture': 'amd64'}, None), ], {'linux-meta': (False, {'fancy 1': {'amd64': 'RUNNING', 'i386': 'RUNNING'}}), - 'linux-meta-lts-grumpy': (False, {'fancy 1': {'amd64': 'RUNNING', 'i386': 'RUNNING'}}) + 'linux-meta-lts-grumpy': (False, {'fancy 1': {'amd64': 'RUNNING', 'i386': 'RUNNING'}}), + 'linux-meta-64only': (False, {'fancy 1': {'amd64': 'RUNNING'}}), }) # one separate test should be triggered for each kernel @@ -1169,10 +1182,12 @@ lightgreen 1 i386 green 3 set(['debci-series-i386:fancy {"triggers": ["linux-meta"]}', 'debci-series-amd64:fancy {"triggers": ["linux-meta"]}', 'debci-series-i386:fancy {"triggers": ["linux-meta-lts-grumpy"]}', - 'debci-series-amd64:fancy {"triggers": ["linux-meta-lts-grumpy"]}'])) + 'debci-series-amd64:fancy {"triggers": ["linux-meta-lts-grumpy"]}', + 'debci-series-amd64:fancy {"triggers": ["linux-meta-64only"]}'])) # ... and that they get recorded as pending expected_pending = '''fancy 1 amd64 linux-meta 1 +fancy 1 amd64 linux-meta-64only 1 fancy 1 amd64 linux-meta-lts-grumpy 1 fancy 1 i386 linux-meta 1 fancy 1 i386 linux-meta-lts-grumpy 1