diff --git a/britney.py b/britney.py index e62dd90..03eef02 100755 --- a/britney.py +++ b/britney.py @@ -1963,10 +1963,16 @@ class Britney(object): for passed, adtsrc, adtver, arch_status in autopkgtest.results( e.name, e.ver[1]): for arch, (status, log_url) in arch_status.items(): - history_url = cloud_url % {'h': srchash(adtsrc), 's': adtsrc, - 'r': self.options.series, 'a': arch} + kwargs = {} + if self.options.adt_ppas: + if log_url.endswith('log.gz'): + kwargs['artifact_url'] = log_url.replace('log.gz', 'artifacts.tar.gz') + else: + kwargs['history_url'] = cloud_url % { + 'h': srchash(adtsrc), 's': adtsrc, + 'r': self.options.series, 'a': arch} e.addtest('autopkgtest', '%s %s' % (adtsrc, adtver), - arch, status, log_url, history_url) + arch, status, log_url, **kwargs) # hints can override failures if not passed: diff --git a/excuse.py b/excuse.py index ab89b0c..49fec56 100644 --- a/excuse.py +++ b/excuse.py @@ -182,9 +182,13 @@ class Excuse(object): for pkg in sorted(self.tests[testtype]): archmsg = [] for arch in sorted(self.tests[testtype][pkg]): - status, log_url, history_url = self.tests[testtype][pkg][arch] - archmsg.append('%s: %s' % - (history_url or log_url, arch, log_url, EXCUSES_LABELS[status])) + status, log_url, history_url, artifact_url = self.tests[testtype][pkg][arch] + label = EXCUSES_LABELS[status] + message = '{arch}' if history_url else '{arch}' + message += ': {label}' + if artifact_url: + message += ' [artifacts]' + archmsg.append(message.format(**locals())) res = res + ("
  • %s for %s: %s
  • \n" % (testtype, pkg, ', '.join(archmsg))) for x in self.htmlline: @@ -215,9 +219,9 @@ class Excuse(object): """"adding reason""" self.reason[reason] = 1 - def addtest(self, type_, package, arch, state, log_url, history_url=None): + def addtest(self, type_, package, arch, state, log_url, history_url=None, artifact_url=None): """Add test result""" - self.tests.setdefault(type_, {}).setdefault(package, {})[arch] = [state, log_url, history_url] + self.tests.setdefault(type_, {}).setdefault(package, {})[arch] = [state, log_url, history_url, artifact_url] # TODO merge with html() def text(self): diff --git a/tests/test_autopkgtest.py b/tests/test_autopkgtest.py index 6ee3e60..2f6eccd 100755 --- a/tests/test_autopkgtest.py +++ b/tests/test_autopkgtest.py @@ -194,10 +194,12 @@ class T(TestBase): {'darkgreen 2': { 'amd64': ['RUNNING-ALWAYSFAIL', 'http://autopkgtest.ubuntu.com/running.shtml', - 'http://autopkgtest.ubuntu.com/packages/d/darkgreen/series/amd64'], + 'http://autopkgtest.ubuntu.com/packages/d/darkgreen/series/amd64', + None], 'i386': ['RUNNING-ALWAYSFAIL', 'http://autopkgtest.ubuntu.com/running.shtml', - 'http://autopkgtest.ubuntu.com/packages/d/darkgreen/series/i386']}}}) + 'http://autopkgtest.ubuntu.com/packages/d/darkgreen/series/i386', + None]}}}) self.assertEqual(self.pending_requests, {'darkgreen/2': {'darkgreen': ['amd64', 'i386']}}) @@ -1563,11 +1565,22 @@ class T(TestBase): else: sys.stdout.write(line) - self.do_test( + exc = self.do_test( [('lightgreen', {'Version': '2'}, 'autopkgtest')], {'lightgreen': (True, {'lightgreen 2': {'amd64': 'RUNNING-ALWAYSFAIL'}})}, {'lightgreen': [('old-version', '1'), ('new-version', '2')]} - ) + )[1] + self.assertEqual(exc['lightgreen']['tests'], {'autopkgtest': + {'lightgreen 2': { + 'amd64': ['RUNNING-ALWAYSFAIL', + 'http://autopkgtest.ubuntu.com/running.shtml', + None, + None], + 'i386': ['RUNNING-ALWAYSFAIL', + 'http://autopkgtest.ubuntu.com/running.shtml', + None, + None]} + }}) for arch in ['i386', 'amd64']: self.assertTrue('debci-series-%s:lightgreen {"triggers": ["lightgreen/2"], "ppas": ["joe/foo", "awesome-developers/staging"]}' % arch in self.amqp_requests or @@ -1580,11 +1593,22 @@ class T(TestBase): 'series/amd64/l/lightgreen/20150101_100101@': (0, 'lightgreen 2', tr('lightgreen/2')), }}) - self.do_test( + exc = self.do_test( [], {'lightgreen': (True, {'lightgreen 2': {'i386': 'PASS', 'amd64': 'PASS'}})}, {'lightgreen': [('old-version', '1'), ('new-version', '2')]} - ) + )[1] + self.assertEqual(exc['lightgreen']['tests'], {'autopkgtest': + {'lightgreen 2': { + 'amd64': ['PASS', + 'http://localhost:18085/autopkgtest-series-awesome-developers-staging/series/amd64/l/lightgreen/20150101_100101@/log.gz', + None, + 'http://localhost:18085/autopkgtest-series-awesome-developers-staging/series/amd64/l/lightgreen/20150101_100101@/artifacts.tar.gz'], + 'i386': ['PASS', + 'http://localhost:18085/autopkgtest-series-awesome-developers-staging/series/i386/l/lightgreen/20150101_100100@/log.gz', + None, + 'http://localhost:18085/autopkgtest-series-awesome-developers-staging/series/i386/l/lightgreen/20150101_100100@/artifacts.tar.gz']} + }}) self.assertEqual(self.amqp_requests, set()) self.assertEqual(self.pending_requests, {})