diff options
author | Ross Burton <ross.burton@intel.com> | 2019-10-09 12:16:11 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-10-23 16:30:36 +0100 |
commit | 9b607c58ffa3c8d19e55b5ff8c52e8a6a2f6ae32 (patch) | |
tree | 6a7272f8eb5400db50df8175b128aaccc3619329 /meta/lib/oeqa/selftest/cases/bbtests.py | |
parent | 6f4102f4f63cbd14d9d3df8157020c80fae2cdcc (diff) | |
download | poky-9b607c58ffa3c8d19e55b5ff8c52e8a6a2f6ae32.tar.gz |
oeqa/selftest: use specialist assert* methods
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/bbtests.py')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/bbtests.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/meta/lib/oeqa/selftest/cases/bbtests.py b/meta/lib/oeqa/selftest/cases/bbtests.py index 9461c7ed14..dc423ec439 100644 --- a/meta/lib/oeqa/selftest/cases/bbtests.py +++ b/meta/lib/oeqa/selftest/cases/bbtests.py | |||
@@ -44,7 +44,7 @@ class BitbakeTests(OESelftestTestCase): | |||
44 | find_build_completed = re.search(r"Tasks Summary:.*(\n.*)*NOTE: Test for bb\.event\.BuildCompleted", result.output) | 44 | find_build_completed = re.search(r"Tasks Summary:.*(\n.*)*NOTE: Test for bb\.event\.BuildCompleted", result.output) |
45 | self.assertTrue(find_build_started, msg = "Match failed in:\n%s" % result.output) | 45 | self.assertTrue(find_build_started, msg = "Match failed in:\n%s" % result.output) |
46 | self.assertTrue(find_build_completed, msg = "Match failed in:\n%s" % result.output) | 46 | self.assertTrue(find_build_completed, msg = "Match failed in:\n%s" % result.output) |
47 | self.assertFalse('Test for bb.event.InvalidEvent' in result.output, msg = "\"Test for bb.event.InvalidEvent\" message found during bitbake process. bitbake output: %s" % result.output) | 47 | self.assertNotIn('Test for bb.event.InvalidEvent', result.output) |
48 | 48 | ||
49 | def test_local_sstate(self): | 49 | def test_local_sstate(self): |
50 | bitbake('m4-native') | 50 | bitbake('m4-native') |
@@ -59,7 +59,7 @@ class BitbakeTests(OESelftestTestCase): | |||
59 | 59 | ||
60 | def test_bitbake_invalid_target(self): | 60 | def test_bitbake_invalid_target(self): |
61 | result = bitbake('asdf', ignore_status=True) | 61 | result = bitbake('asdf', ignore_status=True) |
62 | self.assertTrue("ERROR: Nothing PROVIDES 'asdf'" in result.output, msg = "Though no 'asdf' target exists, bitbake didn't output any err. message. bitbake output: %s" % result.output) | 62 | self.assertIn("ERROR: Nothing PROVIDES 'asdf'", result.output) |
63 | 63 | ||
64 | def test_warnings_errors(self): | 64 | def test_warnings_errors(self): |
65 | result = bitbake('-b asdf', ignore_status=True) | 65 | result = bitbake('-b asdf', ignore_status=True) |
@@ -123,7 +123,7 @@ class BitbakeTests(OESelftestTestCase): | |||
123 | for f in ['pn-buildlist', 'task-depends.dot']: | 123 | for f in ['pn-buildlist', 'task-depends.dot']: |
124 | self.addCleanup(os.remove, f) | 124 | self.addCleanup(os.remove, f) |
125 | self.assertTrue('Task dependencies saved to \'task-depends.dot\'' in result.output, msg = "No task dependency \"task-depends.dot\" file was generated for the given task target. bitbake output: %s" % result.output) | 125 | self.assertTrue('Task dependencies saved to \'task-depends.dot\'' in result.output, msg = "No task dependency \"task-depends.dot\" file was generated for the given task target. bitbake output: %s" % result.output) |
126 | self.assertTrue(recipe in ftools.read_file(os.path.join(self.builddir, 'task-depends.dot')), msg = "No \"%s\" dependency found in task-depends.dot file." % recipe) | 126 | self.assertIn(recipe, ftools.read_file(os.path.join(self.builddir, 'task-depends.dot'))) |
127 | 127 | ||
128 | def test_image_manifest(self): | 128 | def test_image_manifest(self): |
129 | bitbake('core-image-minimal') | 129 | bitbake('core-image-minimal') |
@@ -147,8 +147,7 @@ INHERIT_remove = \"report-error\" | |||
147 | bitbake('-ccleanall man-db') | 147 | bitbake('-ccleanall man-db') |
148 | self.delete_recipeinc('man-db') | 148 | self.delete_recipeinc('man-db') |
149 | self.assertEqual(result.status, 1, msg="Command succeded when it should have failed. bitbake output: %s" % result.output) | 149 | self.assertEqual(result.status, 1, msg="Command succeded when it should have failed. bitbake output: %s" % result.output) |
150 | self.assertTrue('Fetcher failure: Unable to find file file://invalid anywhere. The paths that were searched were:' in result.output, msg = "\"invalid\" file \ | 150 | self.assertIn('Fetcher failure: Unable to find file file://invalid anywhere. The paths that were searched were:', result.output) |
151 | doesn't exist, yet no error message encountered. bitbake output: %s" % result.output) | ||
152 | line = self.getline(result, 'Fetcher failure for URL: \'file://invalid\'. Unable to fetch URL from any source.') | 151 | line = self.getline(result, 'Fetcher failure for URL: \'file://invalid\'. Unable to fetch URL from any source.') |
153 | self.assertTrue(line and line.startswith("ERROR:"), msg = "\"invalid\" file \ | 152 | self.assertTrue(line and line.startswith("ERROR:"), msg = "\"invalid\" file \ |
154 | doesn't exist, yet fetcher didn't report any error. bitbake output: %s" % result.output) | 153 | doesn't exist, yet fetcher didn't report any error. bitbake output: %s" % result.output) |
@@ -173,7 +172,7 @@ SSTATE_DIR = \"${TOPDIR}/download-selftest\" | |||
173 | def test_environment(self): | 172 | def test_environment(self): |
174 | self.write_config("TEST_ENV=\"localconf\"") | 173 | self.write_config("TEST_ENV=\"localconf\"") |
175 | result = runCmd('bitbake -e | grep TEST_ENV=') | 174 | result = runCmd('bitbake -e | grep TEST_ENV=') |
176 | self.assertTrue('localconf' in result.output, msg = "bitbake didn't report any value for TEST_ENV variable. To test, run 'bitbake -e | grep TEST_ENV='") | 175 | self.assertIn('localconf', result.output) |
177 | 176 | ||
178 | def test_dry_run(self): | 177 | def test_dry_run(self): |
179 | result = runCmd('bitbake -n m4-native') | 178 | result = runCmd('bitbake -n m4-native') |
@@ -193,10 +192,10 @@ SSTATE_DIR = \"${TOPDIR}/download-selftest\" | |||
193 | self.track_for_cleanup(preconf) | 192 | self.track_for_cleanup(preconf) |
194 | ftools.write_file(preconf ,"TEST_PREFILE=\"prefile\"") | 193 | ftools.write_file(preconf ,"TEST_PREFILE=\"prefile\"") |
195 | result = runCmd('bitbake -r conf/prefile.conf -e | grep TEST_PREFILE=') | 194 | result = runCmd('bitbake -r conf/prefile.conf -e | grep TEST_PREFILE=') |
196 | self.assertTrue('prefile' in result.output, "Preconfigure file \"prefile.conf\"was not taken into consideration. ") | 195 | self.assertIn('prefile', result.output) |
197 | self.write_config("TEST_PREFILE=\"localconf\"") | 196 | self.write_config("TEST_PREFILE=\"localconf\"") |
198 | result = runCmd('bitbake -r conf/prefile.conf -e | grep TEST_PREFILE=') | 197 | result = runCmd('bitbake -r conf/prefile.conf -e | grep TEST_PREFILE=') |
199 | self.assertTrue('localconf' in result.output, "Preconfigure file \"prefile.conf\"was not taken into consideration.") | 198 | self.assertIn('localconf', result.output) |
200 | 199 | ||
201 | def test_postfile(self): | 200 | def test_postfile(self): |
202 | postconf = os.path.join(self.builddir, 'conf/postfile.conf') | 201 | postconf = os.path.join(self.builddir, 'conf/postfile.conf') |
@@ -204,7 +203,7 @@ SSTATE_DIR = \"${TOPDIR}/download-selftest\" | |||
204 | ftools.write_file(postconf , "TEST_POSTFILE=\"postfile\"") | 203 | ftools.write_file(postconf , "TEST_POSTFILE=\"postfile\"") |
205 | self.write_config("TEST_POSTFILE=\"localconf\"") | 204 | self.write_config("TEST_POSTFILE=\"localconf\"") |
206 | result = runCmd('bitbake -R conf/postfile.conf -e | grep TEST_POSTFILE=') | 205 | result = runCmd('bitbake -R conf/postfile.conf -e | grep TEST_POSTFILE=') |
207 | self.assertTrue('postfile' in result.output, "Postconfigure file \"postfile.conf\"was not taken into consideration.") | 206 | self.assertIn('postfile', result.output) |
208 | 207 | ||
209 | def test_checkuri(self): | 208 | def test_checkuri(self): |
210 | result = runCmd('bitbake -c checkuri m4') | 209 | result = runCmd('bitbake -c checkuri m4') |