diff options
author | Daniel Istrate <daniel.alexandrux.istrate@intel.com> | 2015-06-29 15:18:41 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-07-08 00:01:19 +0100 |
commit | ffa54b94b636a24aa5264916d2b1abfcf029f7ae (patch) | |
tree | 1d8ec88873ceaf27a0c6bb1045c6d0ee8f7887ea /meta/lib/oeqa/selftest/recipetool.py | |
parent | 9f91aa697fb2cf5314aa4a99b2abbf0229cb1ea2 (diff) | |
download | poky-ffa54b94b636a24aa5264916d2b1abfcf029f7ae.tar.gz |
oeqa/selftest: Added @testcase decorators to oeselftest testcases.
Added decorator to some testcases missing this feature.
(From OE-Core rev: 2a9009583fd498df94a55f21a149e302180f19cc)
Signed-off-by: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest/recipetool.py')
-rw-r--r-- | meta/lib/oeqa/selftest/recipetool.py | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/meta/lib/oeqa/selftest/recipetool.py b/meta/lib/oeqa/selftest/recipetool.py index b3ca171698..08ff4f14e0 100644 --- a/meta/lib/oeqa/selftest/recipetool.py +++ b/meta/lib/oeqa/selftest/recipetool.py | |||
@@ -71,7 +71,7 @@ class RecipetoolTests(DevtoolBase): | |||
71 | for errorstr in checkerror: | 71 | for errorstr in checkerror: |
72 | self.assertIn(errorstr, result.output) | 72 | self.assertIn(errorstr, result.output) |
73 | 73 | ||
74 | 74 | @testcase(1177) | |
75 | def test_recipetool_appendfile_basic(self): | 75 | def test_recipetool_appendfile_basic(self): |
76 | # Basic test | 76 | # Basic test |
77 | expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', | 77 | expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', |
@@ -79,12 +79,14 @@ class RecipetoolTests(DevtoolBase): | |||
79 | _, output = self._try_recipetool_appendfile('base-files', '/etc/motd', self.testfile, '', expectedlines, ['motd']) | 79 | _, output = self._try_recipetool_appendfile('base-files', '/etc/motd', self.testfile, '', expectedlines, ['motd']) |
80 | self.assertNotIn('WARNING: ', output) | 80 | self.assertNotIn('WARNING: ', output) |
81 | 81 | ||
82 | @testcase(1183) | ||
82 | def test_recipetool_appendfile_invalid(self): | 83 | def test_recipetool_appendfile_invalid(self): |
83 | # Test some commands that should error | 84 | # Test some commands that should error |
84 | self._try_recipetool_appendfile_fail('/etc/passwd', self.testfile, ['ERROR: /etc/passwd cannot be handled by this tool', 'useradd', 'extrausers']) | 85 | self._try_recipetool_appendfile_fail('/etc/passwd', self.testfile, ['ERROR: /etc/passwd cannot be handled by this tool', 'useradd', 'extrausers']) |
85 | self._try_recipetool_appendfile_fail('/etc/timestamp', self.testfile, ['ERROR: /etc/timestamp cannot be handled by this tool']) | 86 | self._try_recipetool_appendfile_fail('/etc/timestamp', self.testfile, ['ERROR: /etc/timestamp cannot be handled by this tool']) |
86 | self._try_recipetool_appendfile_fail('/dev/console', self.testfile, ['ERROR: /dev/console cannot be handled by this tool']) | 87 | self._try_recipetool_appendfile_fail('/dev/console', self.testfile, ['ERROR: /dev/console cannot be handled by this tool']) |
87 | 88 | ||
89 | @testcase(1176) | ||
88 | def test_recipetool_appendfile_alternatives(self): | 90 | def test_recipetool_appendfile_alternatives(self): |
89 | # Now try with a file we know should be an alternative | 91 | # Now try with a file we know should be an alternative |
90 | # (this is very much a fake example, but one we know is reliably an alternative) | 92 | # (this is very much a fake example, but one we know is reliably an alternative) |
@@ -109,6 +111,7 @@ class RecipetoolTests(DevtoolBase): | |||
109 | result = runCmd('diff -q %s %s' % (testfile2, copiedfile), ignore_status=True) | 111 | result = runCmd('diff -q %s %s' % (testfile2, copiedfile), ignore_status=True) |
110 | self.assertNotEqual(result.status, 0, 'New file should have been copied but was not') | 112 | self.assertNotEqual(result.status, 0, 'New file should have been copied but was not') |
111 | 113 | ||
114 | @testcase(1178) | ||
112 | def test_recipetool_appendfile_binary(self): | 115 | def test_recipetool_appendfile_binary(self): |
113 | # Try appending a binary file | 116 | # Try appending a binary file |
114 | # /bin/ls can be a symlink to /usr/bin/ls | 117 | # /bin/ls can be a symlink to /usr/bin/ls |
@@ -117,6 +120,7 @@ class RecipetoolTests(DevtoolBase): | |||
117 | self.assertIn('WARNING: ', result.output) | 120 | self.assertIn('WARNING: ', result.output) |
118 | self.assertIn('is a binary', result.output) | 121 | self.assertIn('is a binary', result.output) |
119 | 122 | ||
123 | @testcase(1173) | ||
120 | def test_recipetool_appendfile_add(self): | 124 | def test_recipetool_appendfile_add(self): |
121 | corebase = get_bb_var('COREBASE') | 125 | corebase = get_bb_var('COREBASE') |
122 | # Try arbitrary file add to a recipe | 126 | # Try arbitrary file add to a recipe |
@@ -146,6 +150,7 @@ class RecipetoolTests(DevtoolBase): | |||
146 | '}\n'] | 150 | '}\n'] |
147 | self._try_recipetool_appendfile('netbase', '/usr/share/scriptname', testfile2, '-r netbase', expectedlines, ['testfile', testfile2name]) | 151 | self._try_recipetool_appendfile('netbase', '/usr/share/scriptname', testfile2, '-r netbase', expectedlines, ['testfile', testfile2name]) |
148 | 152 | ||
153 | @testcase(1174) | ||
149 | def test_recipetool_appendfile_add_bindir(self): | 154 | def test_recipetool_appendfile_add_bindir(self): |
150 | # Try arbitrary file add to a recipe, this time to a location such that should be installed as executable | 155 | # Try arbitrary file add to a recipe, this time to a location such that should be installed as executable |
151 | expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', | 156 | expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', |
@@ -159,6 +164,7 @@ class RecipetoolTests(DevtoolBase): | |||
159 | _, output = self._try_recipetool_appendfile('netbase', '/usr/bin/selftest-recipetool-testbin', self.testfile, '-r netbase', expectedlines, ['testfile']) | 164 | _, output = self._try_recipetool_appendfile('netbase', '/usr/bin/selftest-recipetool-testbin', self.testfile, '-r netbase', expectedlines, ['testfile']) |
160 | self.assertNotIn('WARNING: ', output) | 165 | self.assertNotIn('WARNING: ', output) |
161 | 166 | ||
167 | @testcase(1175) | ||
162 | def test_recipetool_appendfile_add_machine(self): | 168 | def test_recipetool_appendfile_add_machine(self): |
163 | # Try arbitrary file add to a recipe, this time to a location such that should be installed as executable | 169 | # Try arbitrary file add to a recipe, this time to a location such that should be installed as executable |
164 | expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', | 170 | expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', |
@@ -174,6 +180,7 @@ class RecipetoolTests(DevtoolBase): | |||
174 | _, output = self._try_recipetool_appendfile('netbase', '/usr/share/something', self.testfile, '-r netbase -m mymachine', expectedlines, ['mymachine/testfile']) | 180 | _, output = self._try_recipetool_appendfile('netbase', '/usr/share/something', self.testfile, '-r netbase -m mymachine', expectedlines, ['mymachine/testfile']) |
175 | self.assertNotIn('WARNING: ', output) | 181 | self.assertNotIn('WARNING: ', output) |
176 | 182 | ||
183 | @testcase(1184) | ||
177 | def test_recipetool_appendfile_orig(self): | 184 | def test_recipetool_appendfile_orig(self): |
178 | # A file that's in SRC_URI and in do_install with the same name | 185 | # A file that's in SRC_URI and in do_install with the same name |
179 | expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', | 186 | expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', |
@@ -181,6 +188,7 @@ class RecipetoolTests(DevtoolBase): | |||
181 | _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-orig', self.testfile, '', expectedlines, ['selftest-replaceme-orig']) | 188 | _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-orig', self.testfile, '', expectedlines, ['selftest-replaceme-orig']) |
182 | self.assertNotIn('WARNING: ', output) | 189 | self.assertNotIn('WARNING: ', output) |
183 | 190 | ||
191 | @testcase(1191) | ||
184 | def test_recipetool_appendfile_todir(self): | 192 | def test_recipetool_appendfile_todir(self): |
185 | # A file that's in SRC_URI and in do_install with destination directory rather than file | 193 | # A file that's in SRC_URI and in do_install with destination directory rather than file |
186 | expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', | 194 | expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', |
@@ -188,6 +196,7 @@ class RecipetoolTests(DevtoolBase): | |||
188 | _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-todir', self.testfile, '', expectedlines, ['selftest-replaceme-todir']) | 196 | _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-todir', self.testfile, '', expectedlines, ['selftest-replaceme-todir']) |
189 | self.assertNotIn('WARNING: ', output) | 197 | self.assertNotIn('WARNING: ', output) |
190 | 198 | ||
199 | @testcase(1187) | ||
191 | def test_recipetool_appendfile_renamed(self): | 200 | def test_recipetool_appendfile_renamed(self): |
192 | # A file that's in SRC_URI with a different name to the destination file | 201 | # A file that's in SRC_URI with a different name to the destination file |
193 | expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', | 202 | expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', |
@@ -195,6 +204,7 @@ class RecipetoolTests(DevtoolBase): | |||
195 | _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-renamed', self.testfile, '', expectedlines, ['file1']) | 204 | _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-renamed', self.testfile, '', expectedlines, ['file1']) |
196 | self.assertNotIn('WARNING: ', output) | 205 | self.assertNotIn('WARNING: ', output) |
197 | 206 | ||
207 | @testcase(1190) | ||
198 | def test_recipetool_appendfile_subdir(self): | 208 | def test_recipetool_appendfile_subdir(self): |
199 | # A file that's in SRC_URI in a subdir | 209 | # A file that's in SRC_URI in a subdir |
200 | expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', | 210 | expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', |
@@ -208,6 +218,7 @@ class RecipetoolTests(DevtoolBase): | |||
208 | _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-subdir', self.testfile, '', expectedlines, ['testfile']) | 218 | _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-subdir', self.testfile, '', expectedlines, ['testfile']) |
209 | self.assertNotIn('WARNING: ', output) | 219 | self.assertNotIn('WARNING: ', output) |
210 | 220 | ||
221 | @testcase(1189) | ||
211 | def test_recipetool_appendfile_src_glob(self): | 222 | def test_recipetool_appendfile_src_glob(self): |
212 | # A file that's in SRC_URI as a glob | 223 | # A file that's in SRC_URI as a glob |
213 | expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', | 224 | expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', |
@@ -221,6 +232,7 @@ class RecipetoolTests(DevtoolBase): | |||
221 | _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-src-globfile', self.testfile, '', expectedlines, ['testfile']) | 232 | _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-src-globfile', self.testfile, '', expectedlines, ['testfile']) |
222 | self.assertNotIn('WARNING: ', output) | 233 | self.assertNotIn('WARNING: ', output) |
223 | 234 | ||
235 | @testcase(1181) | ||
224 | def test_recipetool_appendfile_inst_glob(self): | 236 | def test_recipetool_appendfile_inst_glob(self): |
225 | # A file that's in do_install as a glob | 237 | # A file that's in do_install as a glob |
226 | expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', | 238 | expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', |
@@ -228,6 +240,7 @@ class RecipetoolTests(DevtoolBase): | |||
228 | _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-inst-globfile', self.testfile, '', expectedlines, ['selftest-replaceme-inst-globfile']) | 240 | _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-inst-globfile', self.testfile, '', expectedlines, ['selftest-replaceme-inst-globfile']) |
229 | self.assertNotIn('WARNING: ', output) | 241 | self.assertNotIn('WARNING: ', output) |
230 | 242 | ||
243 | @testcase(1182) | ||
231 | def test_recipetool_appendfile_inst_todir_glob(self): | 244 | def test_recipetool_appendfile_inst_todir_glob(self): |
232 | # A file that's in do_install as a glob with destination as a directory | 245 | # A file that's in do_install as a glob with destination as a directory |
233 | expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', | 246 | expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', |
@@ -235,6 +248,7 @@ class RecipetoolTests(DevtoolBase): | |||
235 | _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-inst-todir-globfile', self.testfile, '', expectedlines, ['selftest-replaceme-inst-todir-globfile']) | 248 | _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-inst-todir-globfile', self.testfile, '', expectedlines, ['selftest-replaceme-inst-todir-globfile']) |
236 | self.assertNotIn('WARNING: ', output) | 249 | self.assertNotIn('WARNING: ', output) |
237 | 250 | ||
251 | @testcase(1185) | ||
238 | def test_recipetool_appendfile_patch(self): | 252 | def test_recipetool_appendfile_patch(self): |
239 | # A file that's added by a patch in SRC_URI | 253 | # A file that's added by a patch in SRC_URI |
240 | expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', | 254 | expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', |
@@ -253,6 +267,7 @@ class RecipetoolTests(DevtoolBase): | |||
253 | else: | 267 | else: |
254 | self.assertTrue(False, 'Patch warning not found in output:\n%s' % output) | 268 | self.assertTrue(False, 'Patch warning not found in output:\n%s' % output) |
255 | 269 | ||
270 | @testcase(1188) | ||
256 | def test_recipetool_appendfile_script(self): | 271 | def test_recipetool_appendfile_script(self): |
257 | # Now, a file that's in SRC_URI but installed by a script (so no mention in do_install) | 272 | # Now, a file that's in SRC_URI but installed by a script (so no mention in do_install) |
258 | expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', | 273 | expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', |
@@ -266,6 +281,7 @@ class RecipetoolTests(DevtoolBase): | |||
266 | _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-scripted', self.testfile, '', expectedlines, ['testfile']) | 281 | _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-scripted', self.testfile, '', expectedlines, ['testfile']) |
267 | self.assertNotIn('WARNING: ', output) | 282 | self.assertNotIn('WARNING: ', output) |
268 | 283 | ||
284 | @testcase(1180) | ||
269 | def test_recipetool_appendfile_inst_func(self): | 285 | def test_recipetool_appendfile_inst_func(self): |
270 | # A file that's installed from a function called by do_install | 286 | # A file that's installed from a function called by do_install |
271 | expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', | 287 | expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', |
@@ -273,6 +289,7 @@ class RecipetoolTests(DevtoolBase): | |||
273 | _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-inst-func', self.testfile, '', expectedlines, ['selftest-replaceme-inst-func']) | 289 | _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-inst-func', self.testfile, '', expectedlines, ['selftest-replaceme-inst-func']) |
274 | self.assertNotIn('WARNING: ', output) | 290 | self.assertNotIn('WARNING: ', output) |
275 | 291 | ||
292 | @testcase(1186) | ||
276 | def test_recipetool_appendfile_postinstall(self): | 293 | def test_recipetool_appendfile_postinstall(self): |
277 | # A file that's created by a postinstall script (and explicitly mentioned in it) | 294 | # A file that's created by a postinstall script (and explicitly mentioned in it) |
278 | # First try without specifying recipe | 295 | # First try without specifying recipe |
@@ -288,6 +305,7 @@ class RecipetoolTests(DevtoolBase): | |||
288 | '}\n'] | 305 | '}\n'] |
289 | _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-postinst', self.testfile, '-r selftest-recipetool-appendfile', expectedlines, ['testfile']) | 306 | _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-postinst', self.testfile, '-r selftest-recipetool-appendfile', expectedlines, ['testfile']) |
290 | 307 | ||
308 | @testcase(1179) | ||
291 | def test_recipetool_appendfile_extlayer(self): | 309 | def test_recipetool_appendfile_extlayer(self): |
292 | # Try creating a bbappend in a layer that's not in bblayers.conf and has a different structure | 310 | # Try creating a bbappend in a layer that's not in bblayers.conf and has a different structure |
293 | exttemplayerdir = os.path.join(self.tempdir, 'extlayer') | 311 | exttemplayerdir = os.path.join(self.tempdir, 'extlayer') |
@@ -303,6 +321,7 @@ class RecipetoolTests(DevtoolBase): | |||
303 | 'metadata/recipes/recipes-test/selftest-recipetool-appendfile/selftest-recipetool-appendfile/selftest-replaceme-orig'] | 321 | 'metadata/recipes/recipes-test/selftest-recipetool-appendfile/selftest-recipetool-appendfile/selftest-replaceme-orig'] |
304 | self.assertEqual(sorted(createdfiles), sorted(expectedfiles)) | 322 | self.assertEqual(sorted(createdfiles), sorted(expectedfiles)) |
305 | 323 | ||
324 | @testcase(1192) | ||
306 | def test_recipetool_appendfile_wildcard(self): | 325 | def test_recipetool_appendfile_wildcard(self): |
307 | 326 | ||
308 | def try_appendfile_wc(options): | 327 | def try_appendfile_wc(options): |
@@ -327,8 +346,7 @@ class RecipetoolTests(DevtoolBase): | |||
327 | filename = try_appendfile_wc('-w') | 346 | filename = try_appendfile_wc('-w') |
328 | self.assertEqual(filename, recipefn.split('_')[0] + '_%.bbappend') | 347 | self.assertEqual(filename, recipefn.split('_')[0] + '_%.bbappend') |
329 | 348 | ||
330 | 349 | @testcase(1193) | |
331 | |||
332 | def test_recipetool_create(self): | 350 | def test_recipetool_create(self): |
333 | # Try adding a recipe | 351 | # Try adding a recipe |
334 | tempsrc = os.path.join(self.tempdir, 'srctree') | 352 | tempsrc = os.path.join(self.tempdir, 'srctree') |
@@ -345,6 +363,7 @@ class RecipetoolTests(DevtoolBase): | |||
345 | checkvars['SRC_URI[sha256sum]'] = 'f6ba691f40e30e640efa2752c1f9499a3f9738257660994de70a45fe00d12b64' | 363 | checkvars['SRC_URI[sha256sum]'] = 'f6ba691f40e30e640efa2752c1f9499a3f9738257660994de70a45fe00d12b64' |
346 | self._test_recipe_contents(recipefile, checkvars, []) | 364 | self._test_recipe_contents(recipefile, checkvars, []) |
347 | 365 | ||
366 | @testcase(1194) | ||
348 | def test_recipetool_create_git(self): | 367 | def test_recipetool_create_git(self): |
349 | # Ensure we have the right data in shlibs/pkgdata | 368 | # Ensure we have the right data in shlibs/pkgdata |
350 | bitbake('libpng pango libx11 libxext jpeg') | 369 | bitbake('libpng pango libx11 libxext jpeg') |