mirror of
				https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
				synced 2025-11-04 10:34:05 +00:00 
			
		
		
		
	Very basic bootstack testing criteria support.
This commit is contained in:
		
							parent
							
								
									46281510e3
								
							
						
					
					
						commit
						fe5f4c09ac
					
				
							
								
								
									
										38
									
								
								boottest.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								boottest.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,38 @@
 | 
			
		||||
# -*- coding: utf-8 -*-
 | 
			
		||||
 | 
			
		||||
# Copyright (C) 2015 Canonical Ltd.
 | 
			
		||||
 | 
			
		||||
# This program is free software; you can redistribute it and/or modify
 | 
			
		||||
# it under the terms of the GNU General Public License as published by
 | 
			
		||||
# the Free Software Foundation; either version 2 of the License, or
 | 
			
		||||
# (at your option) any later version.
 | 
			
		||||
 | 
			
		||||
# This program is distributed in the hope that it will be useful,
 | 
			
		||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
# GNU General Public License for more details.
 | 
			
		||||
from __future__ import print_function
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class BootTest(object):
 | 
			
		||||
    """Boottest criteria for Britney.
 | 
			
		||||
 | 
			
		||||
    TBD!
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
    def __init__(self, britney, distribution, series, debug=False):
 | 
			
		||||
        self.britney = britney
 | 
			
		||||
        self.distribution = distribution
 | 
			
		||||
        self.series = series
 | 
			
		||||
        self.debug = debug
 | 
			
		||||
 | 
			
		||||
    def check(self, excuse):
 | 
			
		||||
        """Check and update given 'excuse' and return its label."""
 | 
			
		||||
        label = 'IN PROGRESS'
 | 
			
		||||
        # XXX cprov 20150120: replace with a phone image manifest/content
 | 
			
		||||
        # check.
 | 
			
		||||
        if excuse.name == 'apache2':
 | 
			
		||||
            label = 'SKIPPED'
 | 
			
		||||
            excuse.is_valid = False
 | 
			
		||||
 | 
			
		||||
        return label
 | 
			
		||||
							
								
								
									
										15
									
								
								britney.py
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								britney.py
									
									
									
									
									
								
							@ -226,6 +226,8 @@ from consts import (VERSION, SECTION, BINARIES, MAINTAINER, FAKESRC,
 | 
			
		||||
                   SOURCE, SOURCEVER, ARCHITECTURE, DEPENDS, CONFLICTS,
 | 
			
		||||
                   PROVIDES, RDEPENDS, RCONFLICTS, MULTIARCH, ESSENTIAL)
 | 
			
		||||
from autopkgtest import AutoPackageTest, ADT_PASS, ADT_EXCUSES_LABELS
 | 
			
		||||
from boottest import BootTest
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
__author__ = 'Fabio Tranchitella and the Debian Release Team'
 | 
			
		||||
__version__ = '2.0'
 | 
			
		||||
@ -1883,6 +1885,19 @@ class Britney(object):
 | 
			
		||||
                        e.addreason("autopkgtest")
 | 
			
		||||
                        e.is_valid = False
 | 
			
		||||
 | 
			
		||||
        if (getattr(self.options, "boottest_enable", "no") == "yes" and
 | 
			
		||||
            self.options.series):
 | 
			
		||||
            # trigger autopkgtests for valid candidates
 | 
			
		||||
            boottest_debug = getattr(
 | 
			
		||||
                self.options, "boottest_debug", "no") == "yes"
 | 
			
		||||
            boottest = BootTest(
 | 
			
		||||
                self, self.options.distribution, self.options.series,
 | 
			
		||||
                debug=boottest_debug)
 | 
			
		||||
            for e in self.excuses:
 | 
			
		||||
                boottest_label = boottest.check(e)
 | 
			
		||||
                e.addhtml("boottest for %s %s: %s" %
 | 
			
		||||
                          (e.name, e.ver[1], boottest_label))
 | 
			
		||||
 | 
			
		||||
        # invalidate impossible excuses
 | 
			
		||||
        for e in self.excuses:
 | 
			
		||||
            # parts[0] == package name
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										70
									
								
								britney_boottest.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								britney_boottest.conf
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,70 @@
 | 
			
		||||
# Configuration file for britney
 | 
			
		||||
 | 
			
		||||
# Paths for control files
 | 
			
		||||
TESTING           = data/%(SERIES)
 | 
			
		||||
UNSTABLE          = data/%(SERIES)-proposed
 | 
			
		||||
PARTIAL_UNSTABLE  = yes
 | 
			
		||||
 | 
			
		||||
# Output
 | 
			
		||||
NONINST_STATUS    = data/%(SERIES)/non-installable-status
 | 
			
		||||
EXCUSES_OUTPUT    = output/%(SERIES)/excuses.html
 | 
			
		||||
EXCUSES_YAML_OUTPUT = output/%(SERIES)/excuses.yaml
 | 
			
		||||
UPGRADE_OUTPUT    = output/%(SERIES)/output.txt
 | 
			
		||||
HEIDI_OUTPUT      = output/%(SERIES)/HeidiResult
 | 
			
		||||
 | 
			
		||||
# List of release architectures
 | 
			
		||||
ARCHITECTURES     = amd64 arm64 armhf i386 powerpc ppc64el
 | 
			
		||||
 | 
			
		||||
# if you're not in this list, arch: all packages are allowed to break on you
 | 
			
		||||
NOBREAKALL_ARCHES = amd64
 | 
			
		||||
 | 
			
		||||
# if you're in this list, your packages may not stay in sync with the source
 | 
			
		||||
OUTOFSYNC_ARCHES  =
 | 
			
		||||
 | 
			
		||||
# if you're in this list, your uninstallability count may increase
 | 
			
		||||
BREAK_ARCHES      =
 | 
			
		||||
 | 
			
		||||
# if you're in this list, you are a new architecture
 | 
			
		||||
NEW_ARCHES        =
 | 
			
		||||
 | 
			
		||||
# priorities and delays
 | 
			
		||||
MINDAYS_LOW       = 0
 | 
			
		||||
MINDAYS_MEDIUM    = 0
 | 
			
		||||
MINDAYS_HIGH      = 0
 | 
			
		||||
MINDAYS_CRITICAL  = 0
 | 
			
		||||
MINDAYS_EMERGENCY = 0
 | 
			
		||||
DEFAULT_URGENCY   = medium
 | 
			
		||||
 | 
			
		||||
# hint permissions
 | 
			
		||||
HINTS_CJWATSON    = ALL
 | 
			
		||||
HINTS_ADCONRAD    = ALL
 | 
			
		||||
HINTS_KITTERMAN   = ALL
 | 
			
		||||
HINTS_LANEY       = ALL
 | 
			
		||||
HINTS_JRIDDELL    = ALL
 | 
			
		||||
HINTS_STEFANOR    = ALL
 | 
			
		||||
HINTS_STGRABER    = ALL
 | 
			
		||||
HINTS_VORLON      = ALL
 | 
			
		||||
HINTS_FREEZE      = block block-all
 | 
			
		||||
 | 
			
		||||
HINTS_UBUNTU-TOUCH/DIDROCKS     = block unblock
 | 
			
		||||
HINTS_UBUNTU-TOUCH/EV           = block unblock
 | 
			
		||||
HINTS_UBUNTU-TOUCH/KEN-VANDINE  = block unblock
 | 
			
		||||
HINTS_UBUNTU-TOUCH/LOOL         = block unblock
 | 
			
		||||
HINTS_UBUNTU-TOUCH/MATHIEU-TL   = block unblock
 | 
			
		||||
HINTS_UBUNTU-TOUCH/OGRA         = block unblock
 | 
			
		||||
 | 
			
		||||
# support for old libraries in testing (smooth update)
 | 
			
		||||
# use ALL to enable smooth updates for all the sections
 | 
			
		||||
#
 | 
			
		||||
# naming a non-existent section will effectively disable new smooth
 | 
			
		||||
# updates but still allow removals to occur
 | 
			
		||||
SMOOTH_UPDATES    = badgers
 | 
			
		||||
 | 
			
		||||
REMOVE_OBSOLETE   = no
 | 
			
		||||
 | 
			
		||||
ADT_ENABLE        = no
 | 
			
		||||
ADT_DEBUG         = no
 | 
			
		||||
ADT_ARCHES        = amd64 i386
 | 
			
		||||
 | 
			
		||||
BOOTTEST_ENABLE   = yes
 | 
			
		||||
BOOTTEST_DEBUG    = yes
 | 
			
		||||
							
								
								
									
										71
									
								
								tests/test_boottest.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								tests/test_boottest.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,71 @@
 | 
			
		||||
#!/usr/bin/python
 | 
			
		||||
# (C) 2014 Canonical Ltd.
 | 
			
		||||
#
 | 
			
		||||
# This program is free software; you can redistribute it and/or modify
 | 
			
		||||
# it under the terms of the GNU General Public License as published by
 | 
			
		||||
# the Free Software Foundation; either version 2 of the License, or
 | 
			
		||||
# (at your option) any later version.
 | 
			
		||||
 | 
			
		||||
import os
 | 
			
		||||
import sys
 | 
			
		||||
import unittest
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 | 
			
		||||
sys.path.insert(0, PROJECT_DIR)
 | 
			
		||||
 | 
			
		||||
from tests import TestBase
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class TestBoottest(TestBase):
 | 
			
		||||
 | 
			
		||||
    def setUp(self):
 | 
			
		||||
        super(TestBoottest, self).setUp()
 | 
			
		||||
        self.britney_conf = os.path.join(
 | 
			
		||||
            PROJECT_DIR, 'britney_boottest.conf')
 | 
			
		||||
        self.data.add('libc6', False)
 | 
			
		||||
        self.data.add(
 | 
			
		||||
            'libgreen1',
 | 
			
		||||
            False,
 | 
			
		||||
            {'Source': 'green', 'Depends': 'libc6 (>= 0.9)'})
 | 
			
		||||
        self.data.add(
 | 
			
		||||
            'green',
 | 
			
		||||
            False,
 | 
			
		||||
            {'Depends': 'libc6 (>= 0.9), libgreen1'})
 | 
			
		||||
 | 
			
		||||
    def do_test(self, context, expect=None, no_expect=None):
 | 
			
		||||
        """Process the given package context and assert britney results."""
 | 
			
		||||
        for (pkg, fields) in context:
 | 
			
		||||
            self.data.add(pkg, True, fields)
 | 
			
		||||
        (excuses, out) = self.run_britney()
 | 
			
		||||
        #print('-------\nexcuses: %s\n-----' % excuses)
 | 
			
		||||
        if expect:
 | 
			
		||||
            for re in expect:
 | 
			
		||||
                self.assertRegexpMatches(excuses, re)
 | 
			
		||||
        if no_expect:
 | 
			
		||||
            for re in no_expect:
 | 
			
		||||
                self.assertNotRegexpMatches(excuses, re)
 | 
			
		||||
 | 
			
		||||
    def test_runs(self):
 | 
			
		||||
        # `Britney` runs and considers packages for boottesting when
 | 
			
		||||
        # it is enabled in the configuration.
 | 
			
		||||
        context = []
 | 
			
		||||
        context.append(
 | 
			
		||||
            ('green', {'Version': '1.1~beta', 'Depends': 'libc6 (>= 0.9)'}))
 | 
			
		||||
        self.do_test(
 | 
			
		||||
            context,
 | 
			
		||||
            ['<li>boottest for green 1.1~beta: IN PROGRESS'])
 | 
			
		||||
 | 
			
		||||
    def test_skipped(self):
 | 
			
		||||
        # `Britney` updates boottesting information in excuses when the
 | 
			
		||||
        # package was skipped.
 | 
			
		||||
        context = []
 | 
			
		||||
        context.append(
 | 
			
		||||
            ('apache2', {'Version': '2.4.8-1ubuntu1'}))
 | 
			
		||||
        self.do_test(
 | 
			
		||||
            context,
 | 
			
		||||
            ['<li>boottest for apache2 2.4.8-1ubuntu1: SKIPPED'])
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
    unittest.main()
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user