summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2019-10-09 12:16:11 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-10-23 16:30:36 +0100
commit9b607c58ffa3c8d19e55b5ff8c52e8a6a2f6ae32 (patch)
tree6a7272f8eb5400db50df8175b128aaccc3619329 /meta/lib
parent6f4102f4f63cbd14d9d3df8157020c80fae2cdcc (diff)
downloadpoky-9b607c58ffa3c8d19e55b5ff8c52e8a6a2f6ae32.tar.gz
oeqa/selftest: use specialist assert* methods
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/selftest/cases/bblayers.py8
-rw-r--r--meta/lib/oeqa/selftest/cases/bbtests.py17
-rw-r--r--meta/lib/oeqa/selftest/cases/imagefeatures.py2
3 files changed, 13 insertions, 14 deletions
diff --git a/meta/lib/oeqa/selftest/cases/bblayers.py b/meta/lib/oeqa/selftest/cases/bblayers.py
index 954488dfd1..f131d9856c 100644
--- a/meta/lib/oeqa/selftest/cases/bblayers.py
+++ b/meta/lib/oeqa/selftest/cases/bblayers.py
@@ -14,21 +14,21 @@ class BitbakeLayers(OESelftestTestCase):
14 14
15 def test_bitbakelayers_showcrossdepends(self): 15 def test_bitbakelayers_showcrossdepends(self):
16 result = runCmd('bitbake-layers show-cross-depends') 16 result = runCmd('bitbake-layers show-cross-depends')
17 self.assertTrue('aspell' in result.output, msg = "No dependencies were shown. bitbake-layers show-cross-depends output: %s" % result.output) 17 self.assertIn('aspell', result.output)
18 18
19 def test_bitbakelayers_showlayers(self): 19 def test_bitbakelayers_showlayers(self):
20 result = runCmd('bitbake-layers show-layers') 20 result = runCmd('bitbake-layers show-layers')
21 self.assertTrue('meta-selftest' in result.output, msg = "No layers were shown. bitbake-layers show-layers output: %s" % result.output) 21 self.assertIn('meta-selftest', result.output)
22 22
23 def test_bitbakelayers_showappends(self): 23 def test_bitbakelayers_showappends(self):
24 recipe = "xcursor-transparent-theme" 24 recipe = "xcursor-transparent-theme"
25 bb_file = self.get_recipe_basename(recipe) 25 bb_file = self.get_recipe_basename(recipe)
26 result = runCmd('bitbake-layers show-appends') 26 result = runCmd('bitbake-layers show-appends')
27 self.assertTrue(bb_file in result.output, msg="%s file was not recognised. bitbake-layers show-appends output: %s" % (bb_file, result.output)) 27 self.assertIn(bb_file, result.output)
28 28
29 def test_bitbakelayers_showoverlayed(self): 29 def test_bitbakelayers_showoverlayed(self):
30 result = runCmd('bitbake-layers show-overlayed') 30 result = runCmd('bitbake-layers show-overlayed')
31 self.assertTrue('aspell' in result.output, msg="aspell overlayed recipe was not recognised bitbake-layers show-overlayed %s" % result.output) 31 self.assertIn('aspell', result.output)
32 32
33 def test_bitbakelayers_flatten(self): 33 def test_bitbakelayers_flatten(self):
34 recipe = "xcursor-transparent-theme" 34 recipe = "xcursor-transparent-theme"
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)
151doesn'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 \
154doesn't exist, yet fetcher didn't report any error. bitbake output: %s" % result.output) 153doesn'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')
diff --git a/meta/lib/oeqa/selftest/cases/imagefeatures.py b/meta/lib/oeqa/selftest/cases/imagefeatures.py
index cf2a42aab5..ef2eefa860 100644
--- a/meta/lib/oeqa/selftest/cases/imagefeatures.py
+++ b/meta/lib/oeqa/selftest/cases/imagefeatures.py
@@ -124,7 +124,7 @@ class ImageFeatures(OESelftestTestCase):
124 124
125 # check if result image is sparse 125 # check if result image is sparse
126 image_stat = os.stat(image_path) 126 image_stat = os.stat(image_path)
127 self.assertTrue(image_stat.st_size > image_stat.st_blocks * 512) 127 self.assertGreater(image_stat.st_size, image_stat.st_blocks * 512)
128 128
129 # check if the resulting gzip is valid 129 # check if the resulting gzip is valid
130 self.assertTrue(runCmd('gzip -t %s' % gzip_path)) 130 self.assertTrue(runCmd('gzip -t %s' % gzip_path))