[gnome-continuous-yocto/gnomeostree-3.28-rocko: 5642/8267] yocto-compat-layer: better handling of per-machine world build breakage



commit 68079d0f873b1aaf747828a6d464157384dd00b9
Author: Patrick Ohly <patrick ohly intel com>
Date:   Wed Apr 12 17:44:26 2017 +0200

    yocto-compat-layer: better handling of per-machine world build breakage
    
    It is fairly common that BSP layers enable recipes when choosing
    machines from that layer without checking whether the recipe actually
    builds in the current distro. That breaks "bitbake world", retrieving
    signatures and thus the test_machine_signatures test.
    
    It's better to let that test continue with the signatures that can be
    retrieved and report the broken world build separately. Right now, the
    new test_machine_world iterates over all machines. More elegant and
    useful in combination with a (currently missing) selection of which
    tests to run would be to generate one test instance per machine. But that
    is not straightforward and has to wait.
    
    The "-k" argument alone was not enough to proceed despite failures,
    because bitbake then still returns a non-zero exit code. The existance
    of the output file is taken as sign that the bitbake execution managed
    was not fatally broken.
    
    (From OE-Core rev: 02f5d7836b726e40fef82b50b8145acc839b360b)
    
    Signed-off-by: Patrick Ohly <patrick ohly intel com>
    Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>

 scripts/lib/compatlayer/__init__.py  |   16 ++++++++++++++--
 scripts/lib/compatlayer/cases/bsp.py |   26 ++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 2 deletions(-)
---
diff --git a/scripts/lib/compatlayer/__init__.py b/scripts/lib/compatlayer/__init__.py
index 0d6f4e9..e35f8c0 100644
--- a/scripts/lib/compatlayer/__init__.py
+++ b/scripts/lib/compatlayer/__init__.py
@@ -233,9 +233,21 @@ def get_signatures(builddir, failsafe=False, machine=None):
     if failsafe:
         cmd += '-k '
     cmd += '-S none world'
-    check_command('Generating signatures failed. This might be due to some parse error and/or general layer 
incompatibilities.',
-                  cmd)
     sigs_file = os.path.join(builddir, 'locked-sigs.inc')
+    if os.path.exists(sigs_file):
+        os.unlink(sigs_file)
+    try:
+        check_command('Generating signatures failed. This might be due to some parse error and/or general 
layer incompatibilities.',
+                      cmd)
+    except RuntimeError as ex:
+        if failsafe and os.path.exists(sigs_file):
+            # Ignore the error here. Most likely some recipes active
+            # in a world build lack some dependencies. There is a
+            # separate test_machine_world_build which exposes the
+            # failure.
+            pass
+        else:
+            raise
 
     sig_regex = re.compile("^(?P<task>.*:.*):(?P<hash>.*) .$")
     tune_regex = re.compile("(^|\s)SIGGEN_LOCKEDSIGS_t-(?P<tune>\S*)\s*=\s*")
diff --git a/scripts/lib/compatlayer/cases/bsp.py b/scripts/lib/compatlayer/cases/bsp.py
index 9025675..43efae4 100644
--- a/scripts/lib/compatlayer/cases/bsp.py
+++ b/scripts/lib/compatlayer/cases/bsp.py
@@ -25,6 +25,32 @@ class BSPCompatLayer(OECompatLayerTestCase):
                 msg="Layer %s modified machine %s -> %s" % \
                     (self.tc.layer['name'], self.td['bbvars']['MACHINE'], machine))
 
+
+    def test_machine_world(self):
+        '''
+        "bitbake world" is expected to work regardless which machine is selected.
+        BSP layers sometimes break that by enabling a recipe for a certain machine
+        without checking whether that recipe actually can be built in the current
+        distro configuration (for example, OpenGL might not enabled).
+
+        This test iterates over all machines. It would be nicer to instantiate
+        it once per machine. It merely checks for errors during parse
+        time. It does not actually attempt to build anything.
+        '''
+
+        if not self.td['machines']:
+            self.skipTest('No machines set with --machines.')
+        msg = []
+        for machine in self.td['machines']:
+            # In contrast to test_machine_signatures() below, errors are fatal here.
+            try:
+                get_signatures(self.td['builddir'], failsafe=False, machine=machine)
+            except RuntimeError as ex:
+                msg.append(str(ex))
+        if msg:
+            msg.insert(0, 'The following machines broke a world build:')
+            self.fail('\n'.join(msg))
+
     def test_machine_signatures(self):
         '''
         Selecting a machine may only affect the signature of tasks that are specific


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]