[oe-commits] [openembedded-core] 21/21: oeqa/selftest/recipetool.py: Use regex to match warning line

git at git.openembedded.org git at git.openembedded.org
Wed Jun 1 12:08:50 UTC 2016


rpurdie pushed a commit to branch python3
in repository openembedded-core.

commit 58cbceaa504ded3893245ff03351b4345166d133
Author: Leonardo Sandoval <leonardo.sandoval.gonzalez at linux.intel.com>
AuthorDate: Tue May 31 09:24:03 2016 -0500

    oeqa/selftest/recipetool.py: Use regex to match warning line
    
    We are observing cases (see below) where the 'WARNING:' prefix is not at the
    beginning of a line, so instead of expecting it in the beginning, match it with
    a regex.
    
        ======================================================================
        FAIL: test_recipetool_appendfile_patch (oeqa.selftest.recipetool.RecipetoolTests)
        ----------------------------------------------------------------------
        Traceback (most recent call last):
          File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-oe-selftest/build/meta/lib/oeqa/utils/decorators.py", line 109, in wrapped_f
            return func(*args, **kwargs)
          File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-oe-selftest/build/meta/lib/oeqa/selftest/recipetool.py", line 285, in test_recipetool_appendfile_patch
            self.fail('Patch warning not found in output:\n%s' % output)
        AssertionError: Patch warning not found in output:
        Parsing recipes..WARNING: File /etc/selftest-replaceme-patched is added by the patch /home/pokybuild/yocto-autobuilder/yocto-worker/nightly-oe-selftest/build/meta-selftest/recipes-test/recipetool/files/add-file.patch - you may need to remove or replace this patch in order to replace the file.
        NOTE: Writing append file /tmp/recipetoolqaug0kdb4x/recipes-test/recipetool/selftest-recipetool-appendfile.bbappend
        NOTE: Copying /tmp/recipetoolqagci9tita/testfile to /tmp/recipetoolqaug0kdb4x/recipes-test/recipetool/selftest-recipetool-appendfile/testfile
        done.
    
    Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez at linux.intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/lib/oeqa/selftest/recipetool.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/selftest/recipetool.py b/meta/lib/oeqa/selftest/recipetool.py
index a93d18e..7c60699 100644
--- a/meta/lib/oeqa/selftest/recipetool.py
+++ b/meta/lib/oeqa/selftest/recipetool.py
@@ -2,6 +2,7 @@ import os
 import logging
 import tempfile
 import urllib.parse
+import re
 
 from oeqa.utils.commands import runCmd, bitbake, get_bb_var, create_temp_layer
 from oeqa.utils.decorators import testcase
@@ -278,8 +279,9 @@ class RecipetoolTests(RecipetoolBase):
                          '}\n']
         _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/etc/selftest-replaceme-patched', self.testfile, '', expectedlines, ['testfile'])
         for line in output.splitlines():
-            if line.startswith('WARNING: '):
-                self.assertIn('add-file.patch', line, 'Unexpected warning found in output:\n%s' % line)
+            # match the line containing the warning and the patch
+            match = re.match("(WARNING:).*(add-file.patch)", line)
+            if match:
                 break
         else:
             self.fail('Patch warning not found in output:\n%s' % output)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list