diff options
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oeqa/selftest/bbtests.py | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/meta/lib/oeqa/selftest/bbtests.py b/meta/lib/oeqa/selftest/bbtests.py index 7df6b2f1c5..3d6860f652 100644 --- a/meta/lib/oeqa/selftest/bbtests.py +++ b/meta/lib/oeqa/selftest/bbtests.py | |||
@@ -14,14 +14,14 @@ class BitbakeTests(oeSelfTest): | |||
14 | @testcase(789) | 14 | @testcase(789) |
15 | def test_run_bitbake_from_dir_1(self): | 15 | def test_run_bitbake_from_dir_1(self): |
16 | os.chdir(os.path.join(self.builddir, 'conf')) | 16 | os.chdir(os.path.join(self.builddir, 'conf')) |
17 | bitbake('-e') | 17 | self.assertEqual(bitbake('-e').status, 0, msg = "bitbake couldn't run from \"conf\" dir") |
18 | 18 | ||
19 | @testcase(790) | 19 | @testcase(790) |
20 | def test_run_bitbake_from_dir_2(self): | 20 | def test_run_bitbake_from_dir_2(self): |
21 | my_env = os.environ.copy() | 21 | my_env = os.environ.copy() |
22 | my_env['BBPATH'] = my_env['BUILDDIR'] | 22 | my_env['BBPATH'] = my_env['BUILDDIR'] |
23 | os.chdir(os.path.dirname(os.environ['BUILDDIR'])) | 23 | os.chdir(os.path.dirname(os.environ['BUILDDIR'])) |
24 | bitbake('-e', env=my_env) | 24 | self.assertEqual(bitbake('-e', env=my_env).status, 0, msg = "bitbake couldn't run from builddir") |
25 | 25 | ||
26 | @testcase(806) | 26 | @testcase(806) |
27 | def test_event_handler(self): | 27 | def test_event_handler(self): |
@@ -31,7 +31,7 @@ class BitbakeTests(oeSelfTest): | |||
31 | find_build_completed = re.search("Tasks Summary:.*(\n.*)*NOTE: Test for bb\.event\.BuildCompleted", result.output) | 31 | find_build_completed = re.search("Tasks Summary:.*(\n.*)*NOTE: Test for bb\.event\.BuildCompleted", result.output) |
32 | self.assertTrue(find_build_started, msg = "Match failed in:\n%s" % result.output) | 32 | self.assertTrue(find_build_started, msg = "Match failed in:\n%s" % result.output) |
33 | self.assertTrue(find_build_completed, msg = "Match failed in:\n%s" % result.output) | 33 | self.assertTrue(find_build_completed, msg = "Match failed in:\n%s" % result.output) |
34 | self.assertFalse('Test for bb.event.InvalidEvent' in result.output) | 34 | 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) |
35 | 35 | ||
36 | @testcase(103) | 36 | @testcase(103) |
37 | def test_local_sstate(self): | 37 | def test_local_sstate(self): |
@@ -40,17 +40,17 @@ class BitbakeTests(oeSelfTest): | |||
40 | bitbake('m4-native -cclean') | 40 | bitbake('m4-native -cclean') |
41 | result = bitbake('m4-native') | 41 | result = bitbake('m4-native') |
42 | find_setscene = re.search("m4-native.*do_.*_setscene", result.output) | 42 | find_setscene = re.search("m4-native.*do_.*_setscene", result.output) |
43 | self.assertTrue(find_setscene) | 43 | self.assertTrue(find_setscene, msg = "No \"m4-native.*do_.*_setscene\" message found during bitbake m4-native. bitbake output: %s" % result.output ) |
44 | 44 | ||
45 | @testcase(105) | 45 | @testcase(105) |
46 | def test_bitbake_invalid_recipe(self): | 46 | def test_bitbake_invalid_recipe(self): |
47 | result = bitbake('-b asdf', ignore_status=True) | 47 | result = bitbake('-b asdf', ignore_status=True) |
48 | self.assertTrue("ERROR: Unable to find any recipe file matching 'asdf'" in result.output) | 48 | self.assertTrue("ERROR: Unable to find any recipe file matching 'asdf'" in result.output, msg = "Though asdf recipe doesn't exist, bitbake didn't output any err. message. bitbake output: %s" % result.output) |
49 | 49 | ||
50 | @testcase(107) | 50 | @testcase(107) |
51 | def test_bitbake_invalid_target(self): | 51 | def test_bitbake_invalid_target(self): |
52 | result = bitbake('asdf', ignore_status=True) | 52 | result = bitbake('asdf', ignore_status=True) |
53 | self.assertTrue("ERROR: Nothing PROVIDES 'asdf'" in result.output) | 53 | 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) |
54 | 54 | ||
55 | @testcase(106) | 55 | @testcase(106) |
56 | def test_warnings_errors(self): | 56 | def test_warnings_errors(self): |
@@ -66,7 +66,7 @@ class BitbakeTests(oeSelfTest): | |||
66 | result = bitbake('man -c patch', ignore_status=True) | 66 | result = bitbake('man -c patch', ignore_status=True) |
67 | self.delete_recipeinc('man') | 67 | self.delete_recipeinc('man') |
68 | bitbake('-cclean man') | 68 | bitbake('-cclean man') |
69 | self.assertTrue("ERROR: Function failed: patch_do_patch" in result.output) | 69 | 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) |
70 | 70 | ||
71 | @testcase(163) | 71 | @testcase(163) |
72 | def test_force_task(self): | 72 | def test_force_task(self): |
@@ -76,15 +76,15 @@ class BitbakeTests(oeSelfTest): | |||
76 | look_for_tasks = ['do_compile', 'do_install', 'do_populate_sysroot'] | 76 | look_for_tasks = ['do_compile', 'do_install', 'do_populate_sysroot'] |
77 | for task in look_for_tasks: | 77 | for task in look_for_tasks: |
78 | find_task = re.search("m4-native.*%s" % task, result.output) | 78 | find_task = re.search("m4-native.*%s" % task, result.output) |
79 | self.assertTrue(find_task) | 79 | self.assertTrue(find_task, msg = "Couldn't find %s task. bitbake output %s" % (task, result.output)) |
80 | 80 | ||
81 | @testcase(167) | 81 | @testcase(167) |
82 | def test_bitbake_g(self): | 82 | def test_bitbake_g(self): |
83 | result = bitbake('-g core-image-full-cmdline') | 83 | result = bitbake('-g core-image-full-cmdline') |
84 | self.assertTrue('NOTE: PN build list saved to \'pn-buildlist\'' in result.output) | ||
85 | self.assertTrue('openssh' in ftools.read_file(os.path.join(self.builddir, 'pn-buildlist'))) | ||
86 | for f in ['pn-buildlist', 'pn-depends.dot', 'package-depends.dot', 'task-depends.dot']: | 84 | for f in ['pn-buildlist', 'pn-depends.dot', 'package-depends.dot', 'task-depends.dot']: |
87 | os.remove(f) | 85 | self.addCleanup(os.remove, f) |
86 | self.assertTrue('NOTE: PN build list saved to \'pn-buildlist\'' in result.output, msg = "No dependency \"pn-buildlist\" file was generated for the given task target. bitbake output: %s" % result.output) | ||
87 | self.assertTrue('openssh' in ftools.read_file(os.path.join(self.builddir, 'pn-buildlist')), msg = "No \"openssh\" dependency found in pn-buildlist file.") | ||
88 | 88 | ||
89 | @testcase(899) | 89 | @testcase(899) |
90 | def test_image_manifest(self): | 90 | def test_image_manifest(self): |
@@ -92,7 +92,7 @@ class BitbakeTests(oeSelfTest): | |||
92 | deploydir = get_bb_var("DEPLOY_DIR_IMAGE", target="core-image-minimal") | 92 | deploydir = get_bb_var("DEPLOY_DIR_IMAGE", target="core-image-minimal") |
93 | imagename = get_bb_var("IMAGE_LINK_NAME", target="core-image-minimal") | 93 | imagename = get_bb_var("IMAGE_LINK_NAME", target="core-image-minimal") |
94 | manifest = os.path.join(deploydir, imagename + ".manifest") | 94 | manifest = os.path.join(deploydir, imagename + ".manifest") |
95 | self.assertTrue(os.path.islink(manifest), msg="No manifest file created for image") | 95 | self.assertTrue(os.path.islink(manifest), msg="No manifest file created for image. It should have been created in %s" % manifest) |
96 | 96 | ||
97 | @testcase(168) | 97 | @testcase(168) |
98 | def test_invalid_recipe_src_uri(self): | 98 | def test_invalid_recipe_src_uri(self): |
@@ -105,9 +105,11 @@ SSTATE_DIR = \"${TOPDIR}/download-selftest\" | |||
105 | result = bitbake('-c fetch man', ignore_status=True) | 105 | result = bitbake('-c fetch man', ignore_status=True) |
106 | bitbake('-ccleanall man') | 106 | bitbake('-ccleanall man') |
107 | self.delete_recipeinc('man') | 107 | self.delete_recipeinc('man') |
108 | self.assertEqual(result.status, 1, msg='Command succeded when it should have failed') | 108 | self.assertEqual(result.status, 1, msg="Command succeded when it should have failed. bitbake output: %s" % result.output) |
109 | self.assertTrue('Fetcher failure: Unable to find file file://invalid anywhere. The paths that were searched were:' in result.output) | 109 | self.assertTrue('Fetcher failure: Unable to find file file://invalid anywhere. The paths that were searched were:' in result.output, msg = "\"invalid\" file \ |
110 | self.assertTrue('ERROR: Function failed: Fetcher failure for URL: \'file://invalid\'. Unable to fetch URL from any source.' in result.output) | 110 | doesn't exist, yet no error message encountered. bitbake output: %s" % result.output) |
111 | self.assertTrue('ERROR: Function failed: Fetcher failure for URL: \'file://invalid\'. Unable to fetch URL from any source.' in result.output, msg = "\"invalid\" file \ | ||
112 | doesn't exist, yet fetcher didn't report any error. bitbake output: %s" % result.output) | ||
111 | 113 | ||
112 | @testcase(171) | 114 | @testcase(171) |
113 | def test_rename_downloaded_file(self): | 115 | def test_rename_downloaded_file(self): |
@@ -119,33 +121,33 @@ SSTATE_DIR = \"${TOPDIR}/download-selftest\" | |||
119 | bitbake('-ccleanall aspell') | 121 | bitbake('-ccleanall aspell') |
120 | result = bitbake('-c fetch aspell', ignore_status=True) | 122 | result = bitbake('-c fetch aspell', ignore_status=True) |
121 | self.delete_recipeinc('aspell') | 123 | self.delete_recipeinc('aspell') |
122 | self.assertEqual(result.status, 0) | 124 | self.addCleanup(bitbake, '-ccleanall aspell') |
123 | self.assertTrue(os.path.isfile(os.path.join(get_bb_var("DL_DIR"), 'test-aspell.tar.gz'))) | 125 | self.assertEqual(result.status, 0, msg = "Couldn't fetch aspell. %s" % result.output) |
124 | self.assertTrue(os.path.isfile(os.path.join(get_bb_var("DL_DIR"), 'test-aspell.tar.gz.done'))) | 126 | self.assertTrue(os.path.isfile(os.path.join(get_bb_var("DL_DIR"), 'test-aspell.tar.gz')), msg = "File rename failed. No corresponding test-aspell.tar.gz file found under %s" % str(get_bb_var("DL_DIR"))) |
125 | bitbake('-ccleanall aspell') | 127 | self.assertTrue(os.path.isfile(os.path.join(get_bb_var("DL_DIR"), 'test-aspell.tar.gz.done')), "File rename failed. No corresponding test-aspell.tar.gz.done file found under %s" % str(get_bb_var("DL_DIR"))) |
126 | 128 | ||
127 | @testcase(1028) | 129 | @testcase(1028) |
128 | def test_environment(self): | 130 | def test_environment(self): |
129 | self.append_config("TEST_ENV=\"localconf\"") | 131 | self.append_config("TEST_ENV=\"localconf\"") |
130 | self.addCleanup(self.remove_config, "TEST_ENV=\"localconf\"") | 132 | self.addCleanup(self.remove_config, "TEST_ENV=\"localconf\"") |
131 | result = runCmd('bitbake -e | grep TEST_ENV=') | 133 | result = runCmd('bitbake -e | grep TEST_ENV=') |
132 | self.assertTrue('localconf' in result.output) | 134 | 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='") |
133 | 135 | ||
134 | @testcase(1029) | 136 | @testcase(1029) |
135 | def test_dry_run(self): | 137 | def test_dry_run(self): |
136 | result = runCmd('bitbake -n m4-native') | 138 | result = runCmd('bitbake -n m4-native') |
137 | self.assertEqual(0, result.status) | 139 | self.assertEqual(0, result.status, "bitbake dry run didn't run as expected. %s" % result.output) |
138 | 140 | ||
139 | @testcase(1030) | 141 | @testcase(1030) |
140 | def test_just_parse(self): | 142 | def test_just_parse(self): |
141 | result = runCmd('bitbake -p') | 143 | result = runCmd('bitbake -p') |
142 | self.assertEqual(0, result.status) | 144 | self.assertEqual(0, result.status, "errors encountered when parsing recipes. %s" % result.output) |
143 | 145 | ||
144 | @testcase(1031) | 146 | @testcase(1031) |
145 | def test_version(self): | 147 | def test_version(self): |
146 | result = runCmd('bitbake -s | grep wget') | 148 | result = runCmd('bitbake -s | grep wget') |
147 | find = re.search("wget *:([0-9a-zA-Z\.\-]+)", result.output) | 149 | find = re.search("wget *:([0-9a-zA-Z\.\-]+)", result.output) |
148 | self.assertTrue(find) | 150 | self.assertTrue(find, "No version returned for searched recipe. bitbake output: %s" % result.output) |
149 | 151 | ||
150 | @testcase(1032) | 152 | @testcase(1032) |
151 | def test_prefile(self): | 153 | def test_prefile(self): |
@@ -153,11 +155,11 @@ SSTATE_DIR = \"${TOPDIR}/download-selftest\" | |||
153 | self.track_for_cleanup(preconf) | 155 | self.track_for_cleanup(preconf) |
154 | ftools.write_file(preconf ,"TEST_PREFILE=\"prefile\"") | 156 | ftools.write_file(preconf ,"TEST_PREFILE=\"prefile\"") |
155 | result = runCmd('bitbake -r conf/prefile.conf -e | grep TEST_PREFILE=') | 157 | result = runCmd('bitbake -r conf/prefile.conf -e | grep TEST_PREFILE=') |
156 | self.assertTrue('prefile' in result.output) | 158 | self.assertTrue('prefile' in result.output, "Preconfigure file \"prefile.conf\"was not taken into consideration. ") |
157 | self.append_config("TEST_PREFILE=\"localconf\"") | 159 | self.append_config("TEST_PREFILE=\"localconf\"") |
158 | self.addCleanup(self.remove_config, "TEST_PREFILE=\"localconf\"") | 160 | self.addCleanup(self.remove_config, "TEST_PREFILE=\"localconf\"") |
159 | result = runCmd('bitbake -r conf/prefile.conf -e | grep TEST_PREFILE=') | 161 | result = runCmd('bitbake -r conf/prefile.conf -e | grep TEST_PREFILE=') |
160 | self.assertTrue('localconf' in result.output) | 162 | self.assertTrue('localconf' in result.output, "Preconfigure file \"prefile.conf\"was not taken into consideration.") |
161 | 163 | ||
162 | @testcase(1033) | 164 | @testcase(1033) |
163 | def test_postfile(self): | 165 | def test_postfile(self): |
@@ -167,12 +169,12 @@ SSTATE_DIR = \"${TOPDIR}/download-selftest\" | |||
167 | self.append_config("TEST_POSTFILE=\"localconf\"") | 169 | self.append_config("TEST_POSTFILE=\"localconf\"") |
168 | self.addCleanup(self.remove_config, "TEST_POSTFILE=\"localconf\"") | 170 | self.addCleanup(self.remove_config, "TEST_POSTFILE=\"localconf\"") |
169 | result = runCmd('bitbake -R conf/postfile.conf -e | grep TEST_POSTFILE=') | 171 | result = runCmd('bitbake -R conf/postfile.conf -e | grep TEST_POSTFILE=') |
170 | self.assertTrue('postfile' in result.output) | 172 | self.assertTrue('postfile' in result.output, "Postconfigure file \"postfile.conf\"was not taken into consideration.") |
171 | 173 | ||
172 | @testcase(1034) | 174 | @testcase(1034) |
173 | def test_checkuri(self): | 175 | def test_checkuri(self): |
174 | result = runCmd('bitbake -c checkuri m4') | 176 | result = runCmd('bitbake -c checkuri m4') |
175 | self.assertEqual(0, result.status) | 177 | self.assertEqual(0, result.status, msg = "\"checkuri\" task was not executed. bitbake output: %s" % result.output) |
176 | 178 | ||
177 | @testcase(1035) | 179 | @testcase(1035) |
178 | def test_continue(self): | 180 | def test_continue(self): |
@@ -185,7 +187,7 @@ SSTATE_DIR = \"${TOPDIR}/download-selftest\" | |||
185 | errorpos = result.output.find('ERROR: Function failed: do_fail_task') | 187 | errorpos = result.output.find('ERROR: Function failed: do_fail_task') |
186 | manver = re.search("NOTE: recipe xcursor-transparent-theme-(.*?): task do_unpack: Started", result.output) | 188 | manver = re.search("NOTE: recipe xcursor-transparent-theme-(.*?): task do_unpack: Started", result.output) |
187 | continuepos = result.output.find('NOTE: recipe xcursor-transparent-theme-%s: task do_unpack: Started' % manver.group(1)) | 189 | continuepos = result.output.find('NOTE: recipe xcursor-transparent-theme-%s: task do_unpack: Started' % manver.group(1)) |
188 | self.assertLess(errorpos,continuepos) | 190 | self.assertLess(errorpos,continuepos, msg = "bitbake didn't pass do_fail_task. bitbake output: %s" % result.output) |
189 | 191 | ||
190 | @testcase(1119) | 192 | @testcase(1119) |
191 | def test_non_gplv3(self): | 193 | def test_non_gplv3(self): |