From c76874fda52fd65f5c1d3ddb029d89c8a4d1053d Mon Sep 17 00:00:00 2001 From: Celso Providelo Date: Fri, 20 Feb 2015 14:12:51 -0200 Subject: [PATCH 1/3] Test ADT & BootTest criteria running simultaneously. Fixed minor issue related to doubling-blocking promotions. --- britney.conf | 2 +- britney.py | 9 +++++---- tests/test_boottest.py | 44 ++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 48 insertions(+), 7 deletions(-) diff --git a/britney.conf b/britney.conf index da4d62c..8d9b285 100644 --- a/britney.conf +++ b/britney.conf @@ -66,7 +66,7 @@ ADT_ENABLE = yes ADT_DEBUG = no ADT_ARCHES = amd64 i386 -BOOTTEST_ENABLE = no +BOOTTEST_ENABLE = yes BOOTTEST_DEBUG = yes BOOTTEST_ARCHES = armhf amd64 BOOTTEST_FETCH = yes diff --git a/britney.py b/britney.py index 22ffbbd..4599011 100755 --- a/britney.py +++ b/britney.py @@ -1973,12 +1973,13 @@ class Britney(object): "%s" % (excuse.name, excuse.ver[1], forces[0].user)) continue - # Block promotion if any boottests attempt has failed or - # still in progress. - if status not in BootTest.VALID_STATUSES: + # Block promotion if the excuse is still valid (adt tests + # passed) but the boottests attempt has failed or still in + # progress. + if excuse.is_valid and status not in BootTest.VALID_STATUSES: + excuse.is_valid = False excuse.addhtml("Not considered") excuse.addreason("boottest") - excuse.is_valid = False upgrade_me.remove(excuse.name) unconsidered.append(excuse.name) diff --git a/tests/test_boottest.py b/tests/test_boottest.py index 77be561..ce1cb09 100644 --- a/tests/test_boottest.py +++ b/tests/test_boottest.py @@ -151,7 +151,8 @@ class TestBoottestEnd2End(TestBase): self.create_manifest([ 'green 1.0', 'pyqt5:armhf 1.0', - 'signon 1.0' + 'signon 1.0', + 'purple 1.1', ]) def create_manifest(self, lines): @@ -165,7 +166,8 @@ class TestBoottestEnd2End(TestBase): """Create a stub version of boottest-britney script.""" script_path = os.path.expanduser( "~/auto-package-testing/jenkins/boottest-britney") - os.makedirs(os.path.dirname(script_path)) + if not os.path.exists(os.path.dirname(script_path)): + os.makedirs(os.path.dirname(script_path)) with open(script_path, 'w') as f: f.write('''#!%(py)s import argparse @@ -178,6 +180,7 @@ green 1.1~beta RUNNING pyqt5-src 1.1~beta PASS pyqt5-src 1.1 FAIL signon 1.1 PASS +purple 1.1 RUNNING """ def request(): @@ -405,6 +408,43 @@ args.func() r'
  • missing build on .*>armhf: pyqt5 \(from .*>1\)', '
  • Not considered']) + def test_with_adt(self): + # Boottest can run simultaneously with autopkgtest (adt). + + # Enable ADT in britney configuration. + with open(self.britney_conf, 'r') as fp: + original_config = fp.read() + new_config = original_config.replace( + 'ADT_ENABLE = no', 'ADT_ENABLE = yes') + with open(self.britney_conf, 'w') as fp: + fp.write(new_config) + + # Create a fake 'adt-britney' that reports a RUNNING job for + # the testing source ('purple_1.1'). + script_path = os.path.expanduser( + "~/auto-package-testing/jenkins/adt-britney") + os.makedirs(os.path.dirname(script_path)) + with open(script_path, 'w') as f: + f.write('''#!/bin/sh -e +mkdir -p ~/proposed-migration/autopkgtest/work +touch ~/proposed-migration/autopkgtest/work/adt.request.series +echo "purple 1.1 RUNNING purple 1.1" >> ~/proposed-migration/autopkgtest/work/adt.result.series''') + os.chmod(script_path, 0o755) + + # Britney blocks testing source promotion while ADT and boottest + # are running. + self.data.add('purple', False, {'Version': '1.0'}) + context = [ + ('purple', {'Version': '1.1'}), + ] + self.do_test( + context, + [r'\bpurple\b.*>1.0<.* to .*>1.1<', + '
  • autopkgtest for purple 1.1: {}'.format( + boottest.BootTest.EXCUSE_LABELS['RUNNING']), + '
  • Boottest result: {}'.format( + boottest.BootTest.EXCUSE_LABELS['RUNNING']), + '
  • Not considered']) if __name__ == '__main__': From ea6493ae71cbcbd2b29b913bc598573e3a670aaf Mon Sep 17 00:00:00 2001 From: Celso Providelo Date: Fri, 20 Feb 2015 14:28:47 -0200 Subject: [PATCH 2/3] Only enable BOOTTEST for testing, so britney.conf is safe on trunk. --- britney.conf | 2 +- tests/test_boottest.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/britney.conf b/britney.conf index 8d9b285..da4d62c 100644 --- a/britney.conf +++ b/britney.conf @@ -66,7 +66,7 @@ ADT_ENABLE = yes ADT_DEBUG = no ADT_ARCHES = amd64 i386 -BOOTTEST_ENABLE = yes +BOOTTEST_ENABLE = no BOOTTEST_DEBUG = yes BOOTTEST_ARCHES = armhf amd64 BOOTTEST_FETCH = yes diff --git a/tests/test_boottest.py b/tests/test_boottest.py index ce1cb09..d001e96 100644 --- a/tests/test_boottest.py +++ b/tests/test_boottest.py @@ -129,6 +129,9 @@ class TestBoottestEnd2End(TestBase): # Disable autopkgtests. new_config = original_config.replace( 'ADT_ENABLE = yes', 'ADT_ENABLE = no') + # Enable boottest. + new_config = new_config.replace( + 'BOOTTEST_ENABLE = no', 'BOOTTEST_ENABLE = yes') # Disable TouchManifest auto-fetching. new_config = new_config.replace( 'BOOTTEST_FETCH = yes', 'BOOTTEST_FETCH = no') From 50e0bc137db3d0c4e5cde1a565b27385226b7947 Mon Sep 17 00:00:00 2001 From: Celso Providelo Date: Fri, 20 Feb 2015 17:02:00 -0200 Subject: [PATCH 3/3] Add 'boottest' excuse failure reason when it has failed even if the previous tests had already failed. --- britney.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/britney.py b/britney.py index 4599011..becd35c 100755 --- a/britney.py +++ b/britney.py @@ -1976,12 +1976,13 @@ class Britney(object): # Block promotion if the excuse is still valid (adt tests # passed) but the boottests attempt has failed or still in # progress. - if excuse.is_valid and status not in BootTest.VALID_STATUSES: - excuse.is_valid = False - excuse.addhtml("Not considered") + if status not in BootTest.VALID_STATUSES: excuse.addreason("boottest") - upgrade_me.remove(excuse.name) - unconsidered.append(excuse.name) + if excuse.is_valid: + excuse.is_valid = False + excuse.addhtml("Not considered") + upgrade_me.remove(excuse.name) + unconsidered.append(excuse.name) # invalidate impossible excuses for e in self.excuses: