From fe5f4c09ac0585296f407163b6080b04c1ed362e Mon Sep 17 00:00:00 2001 From: Celso Providelo Date: Mon, 19 Jan 2015 17:59:19 -0200 Subject: [PATCH] Very basic bootstack testing criteria support. --- boottest.py | 38 ++++++++++++++++++++++ britney.py | 15 +++++++++ britney_boottest.conf | 70 +++++++++++++++++++++++++++++++++++++++++ tests/test_boottest.py | 71 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 194 insertions(+) create mode 100644 boottest.py create mode 100644 britney_boottest.conf create mode 100644 tests/test_boottest.py diff --git a/boottest.py b/boottest.py new file mode 100644 index 0000000..5949594 --- /dev/null +++ b/boottest.py @@ -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 diff --git a/britney.py b/britney.py index cd8e9d7..e879088 100755 --- a/britney.py +++ b/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 diff --git a/britney_boottest.conf b/britney_boottest.conf new file mode 100644 index 0000000..b9a8234 --- /dev/null +++ b/britney_boottest.conf @@ -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 diff --git a/tests/test_boottest.py b/tests/test_boottest.py new file mode 100644 index 0000000..3529ea6 --- /dev/null +++ b/tests/test_boottest.py @@ -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, + ['
  • 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, + ['
  • boottest for apache2 2.4.8-1ubuntu1: SKIPPED']) + + +if __name__ == '__main__': + unittest.main()