summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-15 15:46:46 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-15 16:28:46 +0000
commitd585a716d26c93f97fe0fbf91a32c0ccaf14ec2b (patch)
tree9b43adeec34eed32a590cd0c6d5c93656603dac6 /meta/lib/oeqa/selftest
parent93007499d3fa53b45f26453041cfbfc92e18bdee (diff)
downloadpoky-d585a716d26c93f97fe0fbf91a32c0ccaf14ec2b.tar.gz
oeqa: Update to handle domain specific references in build logs
With the addition of the task name to recipe output, the sanity tests need updates where they are looking for specific messages. (From OE-Core rev: 0f2ef4304e6a6f18b4ed13f59000b4a1daa35f6b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest')
-rw-r--r--meta/lib/oeqa/selftest/bbtests.py11
-rw-r--r--meta/lib/oeqa/selftest/buildhistory.py2
-rw-r--r--meta/lib/oeqa/selftest/buildoptions.py18
3 files changed, 23 insertions, 8 deletions
diff --git a/meta/lib/oeqa/selftest/bbtests.py b/meta/lib/oeqa/selftest/bbtests.py
index 94ca79c031..42ae9d0cc9 100644
--- a/meta/lib/oeqa/selftest/bbtests.py
+++ b/meta/lib/oeqa/selftest/bbtests.py
@@ -8,6 +8,11 @@ from oeqa.utils.decorators import testcase
8 8
9class BitbakeTests(oeSelfTest): 9class BitbakeTests(oeSelfTest):
10 10
11 def getline(self, res, line):
12 for l in res.output.split('\n'):
13 if line in l:
14 return l
15
11 @testcase(789) 16 @testcase(789)
12 def test_run_bitbake_from_dir_1(self): 17 def test_run_bitbake_from_dir_1(self):
13 os.chdir(os.path.join(self.builddir, 'conf')) 18 os.chdir(os.path.join(self.builddir, 'conf'))
@@ -63,7 +68,8 @@ class BitbakeTests(oeSelfTest):
63 result = bitbake('man -c patch', ignore_status=True) 68 result = bitbake('man -c patch', ignore_status=True)
64 self.delete_recipeinc('man') 69 self.delete_recipeinc('man')
65 bitbake('-cclean man') 70 bitbake('-cclean man')
66 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) 71 line = self.getline(result, "Function failed: patch_do_patch")
72 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)
67 73
68 @testcase(1354) 74 @testcase(1354)
69 def test_force_task_1(self): 75 def test_force_task_1(self):
@@ -135,7 +141,8 @@ SSTATE_DIR = \"${TOPDIR}/download-selftest\"
135 self.assertEqual(result.status, 1, msg="Command succeded when it should have failed. bitbake output: %s" % result.output) 141 self.assertEqual(result.status, 1, msg="Command succeded when it should have failed. bitbake output: %s" % result.output)
136 self.assertTrue('Fetcher failure: Unable to find file file://invalid anywhere. The paths that were searched were:' in result.output, msg = "\"invalid\" file \ 142 self.assertTrue('Fetcher failure: Unable to find file file://invalid anywhere. The paths that were searched were:' in result.output, msg = "\"invalid\" file \
137doesn't exist, yet no error message encountered. bitbake output: %s" % result.output) 143doesn't exist, yet no error message encountered. bitbake output: %s" % result.output)
138 self.assertTrue('ERROR: Function failed: Fetcher failure for URL: \'file://invalid\'. Unable to fetch URL from any source.' in result.output, msg = "\"invalid\" file \ 144 line = self.getline(result, 'Function failed: Fetcher failure for URL: \'file://invalid\'. Unable to fetch URL from any source.')
145 self.assertTrue(line and line.startswith("ERROR:"), msg = "\"invalid\" file \
139doesn't exist, yet fetcher didn't report any error. bitbake output: %s" % result.output) 146doesn't exist, yet fetcher didn't report any error. bitbake output: %s" % result.output)
140 147
141 @testcase(171) 148 @testcase(171)
diff --git a/meta/lib/oeqa/selftest/buildhistory.py b/meta/lib/oeqa/selftest/buildhistory.py
index 38bcd72cb4..674da6205a 100644
--- a/meta/lib/oeqa/selftest/buildhistory.py
+++ b/meta/lib/oeqa/selftest/buildhistory.py
@@ -38,7 +38,7 @@ class BuildhistoryBase(oeSelfTest):
38 if expect_error: 38 if expect_error:
39 self.assertEqual(result.status, 1, msg="Error expected for global config '%s' and target config '%s'" % (global_config, target_config)) 39 self.assertEqual(result.status, 1, msg="Error expected for global config '%s' and target config '%s'" % (global_config, target_config))
40 search_for_error = re.search(error_regex, result.output) 40 search_for_error = re.search(error_regex, result.output)
41 self.assertTrue(search_for_error, msg="Could not find desired error in output: %s" % error_regex) 41 self.assertTrue(search_for_error, msg="Could not find desired error in output: %s (%s)" % (error_regex, result.output))
42 else: 42 else:
43 self.assertEqual(result.status, 0, msg="Command 'bitbake %s' has failed unexpectedly: %s" % (target, result.output)) 43 self.assertEqual(result.status, 0, msg="Command 'bitbake %s' has failed unexpectedly: %s" % (target, result.output))
44 44
diff --git a/meta/lib/oeqa/selftest/buildoptions.py b/meta/lib/oeqa/selftest/buildoptions.py
index 6167fb29e2..602d95f9bd 100644
--- a/meta/lib/oeqa/selftest/buildoptions.py
+++ b/meta/lib/oeqa/selftest/buildoptions.py
@@ -74,6 +74,10 @@ class DiskMonTest(oeSelfTest):
74 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) 74 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)
75 75
76class SanityOptionsTest(oeSelfTest): 76class SanityOptionsTest(oeSelfTest):
77 def getline(self, res, line):
78 for l in res.output.split('\n'):
79 if line in l:
80 return l
77 81
78 @testcase(927) 82 @testcase(927)
79 def test_options_warnqa_errorqa_switch(self): 83 def test_options_warnqa_errorqa_switch(self):
@@ -85,7 +89,8 @@ class SanityOptionsTest(oeSelfTest):
85 self.write_recipeinc('xcursor-transparent-theme', 'PACKAGES += \"${PN}-dbg\"') 89 self.write_recipeinc('xcursor-transparent-theme', 'PACKAGES += \"${PN}-dbg\"')
86 res = bitbake("xcursor-transparent-theme", ignore_status=True) 90 res = bitbake("xcursor-transparent-theme", ignore_status=True)
87 self.delete_recipeinc('xcursor-transparent-theme') 91 self.delete_recipeinc('xcursor-transparent-theme')
88 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) 92 line = self.getline(res, "QA Issue: xcursor-transparent-theme-dbg is listed in PACKAGES multiple times, this leads to packaging errors.")
93 self.assertTrue(line and line.startswith("ERROR:"), msg=res.output)
89 self.assertEqual(res.status, 1, msg = "bitbake reported exit code %s. It should have been 1. Bitbake output: %s" % (str(res.status), res.output)) 94 self.assertEqual(res.status, 1, msg = "bitbake reported exit code %s. It should have been 1. Bitbake output: %s" % (str(res.status), res.output))
90 self.write_recipeinc('xcursor-transparent-theme', 'PACKAGES += \"${PN}-dbg\"') 95 self.write_recipeinc('xcursor-transparent-theme', 'PACKAGES += \"${PN}-dbg\"')
91 self.append_config('ERROR_QA_remove = "packages-list"') 96 self.append_config('ERROR_QA_remove = "packages-list"')
@@ -93,15 +98,18 @@ class SanityOptionsTest(oeSelfTest):
93 bitbake("xcursor-transparent-theme -ccleansstate") 98 bitbake("xcursor-transparent-theme -ccleansstate")
94 res = bitbake("xcursor-transparent-theme") 99 res = bitbake("xcursor-transparent-theme")
95 self.delete_recipeinc('xcursor-transparent-theme') 100 self.delete_recipeinc('xcursor-transparent-theme')
96 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) 101 line = self.getline(res, "QA Issue: xcursor-transparent-theme-dbg is listed in PACKAGES multiple times, this leads to packaging errors.")
102 self.assertTrue(line and line.startswith("WARNING:"), msg=res.output)
97 103
98 @testcase(278) 104 @testcase(278)
99 def test_sanity_userspace_dependency(self): 105 def test_sanity_userspace_dependency(self):
100 self.write_config('WARN_QA_append = " unsafe-references-in-binaries unsafe-references-in-scripts"') 106 self.write_config('WARN_QA_append = " unsafe-references-in-binaries unsafe-references-in-scripts"')
101 bitbake("-ccleansstate gzip nfs-utils") 107 bitbake("-ccleansstate gzip nfs-utils")
102 res = bitbake("gzip nfs-utils") 108 res = bitbake("gzip nfs-utils")
103 self.assertTrue("WARNING: QA Issue: gzip" in res.output, "WARNING: QA Issue: gzip message is not present in bitbake's output: %s" % res.output) 109 line = self.getline(res, "QA Issue: gzip")
104 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) 110 self.assertTrue(line and line.startswith("WARNING:"), "WARNING: QA Issue: gzip message is not present in bitbake's output: %s" % res.output)
111 line = self.getline(res, "QA Issue: nfs-utils")
112 self.assertTrue(line and line.startswith("WARNING:"), "WARNING: QA Issue: nfs-utils message is not present in bitbake's output: %s" % res.output)
105 113
106class BuildhistoryTests(BuildhistoryBase): 114class BuildhistoryTests(BuildhistoryBase):
107 115
@@ -114,7 +122,7 @@ class BuildhistoryTests(BuildhistoryBase):
114 def test_buildhistory_buildtime_pr_backwards(self): 122 def test_buildhistory_buildtime_pr_backwards(self):
115 self.add_command_to_tearDown('cleanup-workdir') 123 self.add_command_to_tearDown('cleanup-workdir')
116 target = 'xcursor-transparent-theme' 124 target = 'xcursor-transparent-theme'
117 error = "ERROR: QA Issue: Package version for package %s went backwards which would break package feeds from (.*-r1 to .*-r0)" % target 125 error = "ERROR:.*QA Issue: Package version for package %s went backwards which would break package feeds from (.*-r1.* to .*-r0.*)" % target
118 self.run_buildhistory_operation(target, target_config="PR = \"r1\"", change_bh_location=True) 126 self.run_buildhistory_operation(target, target_config="PR = \"r1\"", change_bh_location=True)
119 self.run_buildhistory_operation(target, target_config="PR = \"r0\"", change_bh_location=False, expect_error=True, error_regex=error) 127 self.run_buildhistory_operation(target, target_config="PR = \"r0\"", change_bh_location=False, expect_error=True, error_regex=error)
120 128