mirror of
				https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
				synced 2025-11-04 10:34:05 +00:00 
			
		
		
		
	Check phone-image presence for all binary files for the give excused sourcename. Tests improved.
This commit is contained in:
		
							parent
							
								
									26d134e011
								
							
						
					
					
						commit
						cc9097e2ed
					
				
							
								
								
									
										34
									
								
								boottest.py
									
									
									
									
									
								
							
							
						
						
									
										34
									
								
								boottest.py
									
									
									
									
									
								
							@ -13,6 +13,8 @@
 | 
			
		||||
# GNU General Public License for more details.
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
from consts import BINARIES
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class TouchManifest(object):
 | 
			
		||||
    """Parses a corresponding touch image manifest.
 | 
			
		||||
@ -75,7 +77,7 @@ class BootTest(object):
 | 
			
		||||
    def _get_status_label(self, name, version):
 | 
			
		||||
        """Return the current boottest status label."""
 | 
			
		||||
        # XXX cprov 20150120: replace with the test history latest
 | 
			
		||||
        # record label.
 | 
			
		||||
        # record label, or a new job request if it was not found.
 | 
			
		||||
        if name == 'pyqt5':
 | 
			
		||||
            if version == '1.1~beta':
 | 
			
		||||
                return 'PASS'
 | 
			
		||||
@ -93,17 +95,33 @@ class BootTest(object):
 | 
			
		||||
        Annotate skipped packages (currently not in phone image) or add
 | 
			
		||||
        the current testing status (see `_get_status_label`).
 | 
			
		||||
        """
 | 
			
		||||
        if excuse.name not in self.phone_manifest:
 | 
			
		||||
            label = 'SKIPPED'
 | 
			
		||||
        else:
 | 
			
		||||
            label = self._get_status_label(excuse.name, excuse.ver[1])
 | 
			
		||||
        # Discover all binaries for the 'excused' source.
 | 
			
		||||
        unstable_sources = self.britney.sources['unstable']
 | 
			
		||||
        binary_names = [
 | 
			
		||||
            bin.split('/')[0]
 | 
			
		||||
            for bin in unstable_sources[excuse.name][BINARIES]
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
        excuse.addhtml("boottest for %s %s: %s" %
 | 
			
		||||
                       (excuse.name, excuse.ver[1], label))
 | 
			
		||||
        # Process (request or update) boottest attempts for each binary.
 | 
			
		||||
        labels = set()
 | 
			
		||||
        for name in binary_names:
 | 
			
		||||
            if name in self.phone_manifest:
 | 
			
		||||
                label = self._get_status_label(name, excuse.ver[1])
 | 
			
		||||
            else:
 | 
			
		||||
                label = 'SKIPPED'
 | 
			
		||||
            excuse.addhtml("boottest for %s %s: %s" %
 | 
			
		||||
                           (name, excuse.ver[1], label))
 | 
			
		||||
            labels.add(label)
 | 
			
		||||
 | 
			
		||||
        if label in ['PASS', 'SKIPPED']:
 | 
			
		||||
        # If all boottests passed or were skipped, return False. The
 | 
			
		||||
        # excuse is clean and promotion can proceed, according to the
 | 
			
		||||
        # boottest criteria.
 | 
			
		||||
        if labels.issubset(set(['PASS', 'SKIPPED'])):
 | 
			
		||||
            return False
 | 
			
		||||
 | 
			
		||||
        # If one or more boottests are still in-progress or have already
 | 
			
		||||
        # failed, make the excuse as invalid and blocks promotion by
 | 
			
		||||
        # returning True.
 | 
			
		||||
        excuse.addhtml("Not considered")
 | 
			
		||||
        excuse.addreason("boottest")
 | 
			
		||||
        excuse.is_valid = False
 | 
			
		||||
 | 
			
		||||
@ -81,7 +81,7 @@ class TestBoottestEnd2End(TestBase):
 | 
			
		||||
        self.data.add(
 | 
			
		||||
            'green',
 | 
			
		||||
            False,
 | 
			
		||||
            {'Depends': 'libc6 (>= 0.9), libgreen1'})
 | 
			
		||||
            {'Source': 'green', 'Depends': 'libc6 (>= 0.9), libgreen1'})
 | 
			
		||||
        self.create_manifest([
 | 
			
		||||
            'green 1.0',
 | 
			
		||||
            'pyqt5:armhf 1.0',
 | 
			
		||||
@ -108,15 +108,21 @@ class TestBoottestEnd2End(TestBase):
 | 
			
		||||
                self.assertNotRegexpMatches(excuses, re)
 | 
			
		||||
 | 
			
		||||
    def test_runs(self):
 | 
			
		||||
        # `Britney` runs and considers packages for boottesting when
 | 
			
		||||
        # it is enabled in the configuration and 'in progress' tests
 | 
			
		||||
        # blocks package promotion.
 | 
			
		||||
        context = []
 | 
			
		||||
        context.append(
 | 
			
		||||
            ('green', {'Version': '1.1~beta', 'Depends': 'libc6 (>= 0.9)'}))
 | 
			
		||||
        # `Britney` runs and considers binary packages for boottesting
 | 
			
		||||
        # when it is enabled in the configuration, only binaries needed
 | 
			
		||||
        # in the phone image are considered for boottesting.
 | 
			
		||||
        # 'in progress' tests blocks package promotion.
 | 
			
		||||
        context = [
 | 
			
		||||
            ('green', {'Source': 'green', 'Version': '1.1~beta',
 | 
			
		||||
                       'Depends': 'libc6 (>= 0.9)'}),
 | 
			
		||||
            ('libgreen1', {'Source': 'green', 'Version': '1.1~beta',
 | 
			
		||||
                           'Depends': 'libc6 (>= 0.9)'}),
 | 
			
		||||
        ]
 | 
			
		||||
        self.do_test(
 | 
			
		||||
            context,
 | 
			
		||||
            ['<li>boottest for green 1.1~beta: IN PROGRESS',
 | 
			
		||||
            [r'\bgreen\b.*>1</a> to .*>1.1~beta<',
 | 
			
		||||
             '<li>boottest for green 1.1~beta: IN PROGRESS',
 | 
			
		||||
             '<li>boottest for libgreen1 1.1~beta: SKIPPED',
 | 
			
		||||
             '<li>Not considered'])
 | 
			
		||||
 | 
			
		||||
    def test_pass(self):
 | 
			
		||||
@ -125,10 +131,11 @@ class TestBoottestEnd2End(TestBase):
 | 
			
		||||
        # promotion.
 | 
			
		||||
        context = []
 | 
			
		||||
        context.append(
 | 
			
		||||
            ('pyqt5', {'Version': '1.1~beta'}))
 | 
			
		||||
            ('pyqt5', {'Source': 'pyqt5-src', 'Version': '1.1~beta'}))
 | 
			
		||||
        self.do_test(
 | 
			
		||||
            context,
 | 
			
		||||
            ['<li>boottest for pyqt5 1.1~beta: PASS',
 | 
			
		||||
            [r'\bpyqt5-src\b.*\(- to .*>1.1~beta<',
 | 
			
		||||
             '<li>boottest for pyqt5 1.1~beta: PASS',
 | 
			
		||||
             '<li>Valid candidate'])
 | 
			
		||||
 | 
			
		||||
    def test_fail(self):
 | 
			
		||||
@ -137,10 +144,11 @@ class TestBoottestEnd2End(TestBase):
 | 
			
		||||
        # ('Not considered.')
 | 
			
		||||
        context = []
 | 
			
		||||
        context.append(
 | 
			
		||||
            ('pyqt5', {'Version': '1.1'}))
 | 
			
		||||
            ('pyqt5', {'Source': 'pyqt5-src', 'Version': '1.1'}))
 | 
			
		||||
        self.do_test(
 | 
			
		||||
            context,
 | 
			
		||||
            ['<li>boottest for pyqt5 1.1: FAIL',
 | 
			
		||||
            [r'\bpyqt5-src\b.*\(- to .*>1.1<',
 | 
			
		||||
             '<li>boottest for pyqt5 1.1: FAIL',
 | 
			
		||||
             '<li>Not considered'])
 | 
			
		||||
 | 
			
		||||
    def test_skipped(self):
 | 
			
		||||
@ -149,10 +157,12 @@ class TestBoottestEnd2End(TestBase):
 | 
			
		||||
        # promotion.
 | 
			
		||||
        context = []
 | 
			
		||||
        context.append(
 | 
			
		||||
            ('apache2', {'Version': '2.4.8-1ubuntu1'}))
 | 
			
		||||
            ('apache2', {'Source': 'apache2-src',
 | 
			
		||||
                         'Version': '2.4.8-1ubuntu1'}))
 | 
			
		||||
        self.do_test(
 | 
			
		||||
            context,
 | 
			
		||||
            ['<li>boottest for apache2 2.4.8-1ubuntu1: SKIPPED',
 | 
			
		||||
            [r'\bapache2-src\b.*\(- to .*>2.4.8-1ubuntu1<',
 | 
			
		||||
             '<li>boottest for apache2 2.4.8-1ubuntu1: SKIPPED',
 | 
			
		||||
             '<li>Valid candidate'])
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user