]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa: Update to handle domain specific references in build logs
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 15 Feb 2016 15:46:46 +0000 (15:46 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 15 Feb 2016 16:28:25 +0000 (16:28 +0000)
With the addition of the task name to recipe output, the sanity tests
need updates where they are looking for specific messages.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/selftest/bbtests.py
meta/lib/oeqa/selftest/buildhistory.py
meta/lib/oeqa/selftest/buildoptions.py

index 94ca79c031db237c7bbd65fe8588c7261ca16240..42ae9d0cc938c27d726d6d3446a7a8466d5520ab 100644 (file)
@@ -8,6 +8,11 @@ from oeqa.utils.decorators import testcase
 
 class BitbakeTests(oeSelfTest):
 
+    def getline(self, res, line):
+        for l in res.output.split('\n'):
+            if line in l:
+                return l
+
     @testcase(789)
     def test_run_bitbake_from_dir_1(self):
         os.chdir(os.path.join(self.builddir, 'conf'))
@@ -63,7 +68,8 @@ class BitbakeTests(oeSelfTest):
         result = bitbake('man -c patch', ignore_status=True)
         self.delete_recipeinc('man')
         bitbake('-cclean man')
-        self.assertTrue("ERROR: Function failed: patch_do_patch" in result.output, msg = "Though no man-1.5h1-make.patch file exists, bitbake didn't output any err. message. bitbake output: %s" % result.output)
+        line = self.getline(result, "Function failed: patch_do_patch")
+        self.assertTrue(line and line.startswith("ERROR:"), msg = "Though no man-1.5h1-make.patch file exists, bitbake didn't output any err. message. bitbake output: %s" % result.output)
 
     @testcase(1354)
     def test_force_task_1(self):
@@ -135,7 +141,8 @@ SSTATE_DIR = \"${TOPDIR}/download-selftest\"
         self.assertEqual(result.status, 1, msg="Command succeded when it should have failed. bitbake output: %s" % result.output)
         self.assertTrue('Fetcher failure: Unable to find file file://invalid anywhere. The paths that were searched were:' in result.output, msg = "\"invalid\" file \
 doesn't exist, yet no error message encountered. bitbake output: %s" % result.output)
-        self.assertTrue('ERROR: Function failed: Fetcher failure for URL: \'file://invalid\'. Unable to fetch URL from any source.' in result.output, msg = "\"invalid\" file \
+        line = self.getline(result, 'Function failed: Fetcher failure for URL: \'file://invalid\'. Unable to fetch URL from any source.')
+        self.assertTrue(line and line.startswith("ERROR:"), msg = "\"invalid\" file \
 doesn't exist, yet fetcher didn't report any error. bitbake output: %s" % result.output)
 
     @testcase(171)
index 38bcd72cb430a22c387d6d558dd6f42b8642db29..674da6205a238cc71dd5ff31a1032d8f6a522a64 100644 (file)
@@ -38,7 +38,7 @@ class BuildhistoryBase(oeSelfTest):
         if expect_error:
             self.assertEqual(result.status, 1, msg="Error expected for global config '%s' and target config '%s'" % (global_config, target_config))
             search_for_error = re.search(error_regex, result.output)
-            self.assertTrue(search_for_error, msg="Could not find desired error in output: %s" % error_regex)
+            self.assertTrue(search_for_error, msg="Could not find desired error in output: %s (%s)" % (error_regex, result.output))
         else:
             self.assertEqual(result.status, 0, msg="Command 'bitbake %s' has failed unexpectedly: %s" % (target, result.output))
 
index 6167fb29e2a851bcdde196b24d6146cee651adbb..602d95f9bd3747587f54a534667165018b8e4c97 100644 (file)
@@ -74,6 +74,10 @@ class DiskMonTest(oeSelfTest):
         self.assertTrue('WARNING: The free space' in res.output, msg = "A warning should have been displayed for disk monitor is set to WARN: %s" %res.output)
 
 class SanityOptionsTest(oeSelfTest):
+    def getline(self, res, line):
+        for l in res.output.split('\n'):
+            if line in l:
+                return l
 
     @testcase(927)
     def test_options_warnqa_errorqa_switch(self):
@@ -85,7 +89,8 @@ class SanityOptionsTest(oeSelfTest):
         self.write_recipeinc('xcursor-transparent-theme', 'PACKAGES += \"${PN}-dbg\"')
         res = bitbake("xcursor-transparent-theme", ignore_status=True)
         self.delete_recipeinc('xcursor-transparent-theme')
-        self.assertTrue("ERROR: QA Issue: xcursor-transparent-theme-dbg is listed in PACKAGES multiple times, this leads to packaging errors." in res.output, msg=res.output)
+        line = self.getline(res, "QA Issue: xcursor-transparent-theme-dbg is listed in PACKAGES multiple times, this leads to packaging errors.")
+        self.assertTrue(line and line.startswith("ERROR:"), msg=res.output)
         self.assertEqual(res.status, 1, msg = "bitbake reported exit code %s. It should have been 1. Bitbake output: %s" % (str(res.status), res.output))
         self.write_recipeinc('xcursor-transparent-theme', 'PACKAGES += \"${PN}-dbg\"')
         self.append_config('ERROR_QA_remove = "packages-list"')
@@ -93,15 +98,18 @@ class SanityOptionsTest(oeSelfTest):
         bitbake("xcursor-transparent-theme -ccleansstate")
         res = bitbake("xcursor-transparent-theme")
         self.delete_recipeinc('xcursor-transparent-theme')
-        self.assertTrue("WARNING: QA Issue: xcursor-transparent-theme-dbg is listed in PACKAGES multiple times, this leads to packaging errors." in res.output, msg=res.output)
+        line = self.getline(res, "QA Issue: xcursor-transparent-theme-dbg is listed in PACKAGES multiple times, this leads to packaging errors.")
+        self.assertTrue(line and line.startswith("WARNING:"), msg=res.output)
 
     @testcase(278)
     def test_sanity_userspace_dependency(self):
         self.write_config('WARN_QA_append = " unsafe-references-in-binaries unsafe-references-in-scripts"')
         bitbake("-ccleansstate gzip nfs-utils")
         res = bitbake("gzip nfs-utils")
-        self.assertTrue("WARNING: QA Issue: gzip" in res.output, "WARNING: QA Issue: gzip message is not present in bitbake's output: %s" % res.output)
-        self.assertTrue("WARNING: QA Issue: nfs-utils" in res.output, "WARNING: QA Issue: nfs-utils message is not present in bitbake's output: %s" % res.output)
+        line = self.getline(res, "QA Issue: gzip")
+        self.assertTrue(line and line.startswith("WARNING:"), "WARNING: QA Issue: gzip message is not present in bitbake's output: %s" % res.output)
+        line = self.getline(res, "QA Issue: nfs-utils")
+        self.assertTrue(line and line.startswith("WARNING:"), "WARNING: QA Issue: nfs-utils message is not present in bitbake's output: %s" % res.output)
 
 class BuildhistoryTests(BuildhistoryBase):
 
@@ -114,7 +122,7 @@ class BuildhistoryTests(BuildhistoryBase):
     def test_buildhistory_buildtime_pr_backwards(self):
         self.add_command_to_tearDown('cleanup-workdir')
         target = 'xcursor-transparent-theme'
-        error = "ERROR: QA Issue: Package version for package %s went backwards which would break package feeds from (.*-r1 to .*-r0)" % target
+        error = "ERROR:.*QA Issue: Package version for package %s went backwards which would break package feeds from (.*-r1.* to .*-r0.*)" % target
         self.run_buildhistory_operation(target, target_config="PR = \"r1\"", change_bh_location=True)
         self.run_buildhistory_operation(target, target_config="PR = \"r0\"", change_bh_location=False, expect_error=True, error_regex=error)