From 2a9009583fd498df94a55f21a149e302180f19cc Mon Sep 17 00:00:00 2001 From: Daniel Istrate Date: Mon, 29 Jun 2015 15:18:41 +0300 Subject: oeqa/selftest: Added @testcase decorators to oeselftest testcases. Added decorator to some testcases missing this feature. Signed-off-by: Daniel Istrate Signed-off-by: Ross Burton --- meta/lib/oeqa/selftest/recipetool.py | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'meta/lib/oeqa/selftest/recipetool.py') 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): for errorstr in checkerror: self.assertIn(errorstr, result.output) - + @testcase(1177) def test_recipetool_appendfile_basic(self): # Basic test expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', @@ -79,12 +79,14 @@ class RecipetoolTests(DevtoolBase): _, output = self._try_recipetool_appendfile('base-files', '/etc/motd', self.testfile, '', expectedlines, ['motd']) self.assertNotIn('WARNING: ', output) + @testcase(1183) def test_recipetool_appendfile_invalid(self): # Test some commands that should error self._try_recipetool_appendfile_fail('/etc/passwd', self.testfile, ['ERROR: /etc/passwd cannot be handled by this tool', 'useradd', 'extrausers']) self._try_recipetool_appendfile_fail('/etc/timestamp', self.testfile, ['ERROR: /etc/timestamp cannot be handled by this tool']) self._try_recipetool_appendfile_fail('/dev/console', self.testfile, ['ERROR: /dev/console cannot be handled by this tool']) + @testcase(1176) def test_recipetool_appendfile_alternatives(self): # Now try with a file we know should be an alternative # (this is very much a fake example, but one we know is reliably an alternative) @@ -109,6 +111,7 @@ class RecipetoolTests(DevtoolBase): result = runCmd('diff -q %s %s' % (testfile2, copiedfile), ignore_status=True) self.assertNotEqual(result.status, 0, 'New file should have been copied but was not') + @testcase(1178) def test_recipetool_appendfile_binary(self): # Try appending a binary file # /bin/ls can be a symlink to /usr/bin/ls @@ -117,6 +120,7 @@ class RecipetoolTests(DevtoolBase): self.assertIn('WARNING: ', result.output) self.assertIn('is a binary', result.output) + @testcase(1173) def test_recipetool_appendfile_add(self): corebase = get_bb_var('COREBASE') # Try arbitrary file add to a recipe @@ -146,6 +150,7 @@ class RecipetoolTests(DevtoolBase): '}\n'] self._try_recipetool_appendfile('netbase', '/usr/share/scriptname', testfile2, '-r netbase', expectedlines, ['testfile', testfile2name]) + @testcase(1174) def test_recipetool_appendfile_add_bindir(self): # Try arbitrary file add to a recipe, this time to a location such that should be installed as executable expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', @@ -159,6 +164,7 @@ class RecipetoolTests(DevtoolBase): _, output = self._try_recipetool_appendfile('netbase', '/usr/bin/selftest-recipetool-testbin', self.testfile, '-r netbase', expectedlines, ['testfile']) self.assertNotIn('WARNING: ', output) + @testcase(1175) def test_recipetool_appendfile_add_machine(self): # Try arbitrary file add to a recipe, this time to a location such that should be installed as executable expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', @@ -174,6 +180,7 @@ class RecipetoolTests(DevtoolBase): _, output = self._try_recipetool_appendfile('netbase', '/usr/share/something', self.testfile, '-r netbase -m mymachine', expectedlines, ['mymachine/testfile']) self.assertNotIn('WARNING: ', output) + @testcase(1184) def test_recipetool_appendfile_orig(self): # A file that's in SRC_URI and in do_install with the same name expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', @@ -181,6 +188,7 @@ class RecipetoolTests(DevtoolBase): _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-orig', self.testfile, '', expectedlines, ['selftest-replaceme-orig']) self.assertNotIn('WARNING: ', output) + @testcase(1191) def test_recipetool_appendfile_todir(self): # A file that's in SRC_URI and in do_install with destination directory rather than file expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', @@ -188,6 +196,7 @@ class RecipetoolTests(DevtoolBase): _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-todir', self.testfile, '', expectedlines, ['selftest-replaceme-todir']) self.assertNotIn('WARNING: ', output) + @testcase(1187) def test_recipetool_appendfile_renamed(self): # A file that's in SRC_URI with a different name to the destination file expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', @@ -195,6 +204,7 @@ class RecipetoolTests(DevtoolBase): _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-renamed', self.testfile, '', expectedlines, ['file1']) self.assertNotIn('WARNING: ', output) + @testcase(1190) def test_recipetool_appendfile_subdir(self): # A file that's in SRC_URI in a subdir expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', @@ -208,6 +218,7 @@ class RecipetoolTests(DevtoolBase): _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-subdir', self.testfile, '', expectedlines, ['testfile']) self.assertNotIn('WARNING: ', output) + @testcase(1189) def test_recipetool_appendfile_src_glob(self): # A file that's in SRC_URI as a glob expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', @@ -221,6 +232,7 @@ class RecipetoolTests(DevtoolBase): _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-src-globfile', self.testfile, '', expectedlines, ['testfile']) self.assertNotIn('WARNING: ', output) + @testcase(1181) def test_recipetool_appendfile_inst_glob(self): # A file that's in do_install as a glob expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', @@ -228,6 +240,7 @@ class RecipetoolTests(DevtoolBase): _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-inst-globfile', self.testfile, '', expectedlines, ['selftest-replaceme-inst-globfile']) self.assertNotIn('WARNING: ', output) + @testcase(1182) def test_recipetool_appendfile_inst_todir_glob(self): # A file that's in do_install as a glob with destination as a directory expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', @@ -235,6 +248,7 @@ class RecipetoolTests(DevtoolBase): _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-inst-todir-globfile', self.testfile, '', expectedlines, ['selftest-replaceme-inst-todir-globfile']) self.assertNotIn('WARNING: ', output) + @testcase(1185) def test_recipetool_appendfile_patch(self): # A file that's added by a patch in SRC_URI expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', @@ -253,6 +267,7 @@ class RecipetoolTests(DevtoolBase): else: self.assertTrue(False, 'Patch warning not found in output:\n%s' % output) + @testcase(1188) def test_recipetool_appendfile_script(self): # Now, a file that's in SRC_URI but installed by a script (so no mention in do_install) expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', @@ -266,6 +281,7 @@ class RecipetoolTests(DevtoolBase): _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-scripted', self.testfile, '', expectedlines, ['testfile']) self.assertNotIn('WARNING: ', output) + @testcase(1180) def test_recipetool_appendfile_inst_func(self): # A file that's installed from a function called by do_install expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', @@ -273,6 +289,7 @@ class RecipetoolTests(DevtoolBase): _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-inst-func', self.testfile, '', expectedlines, ['selftest-replaceme-inst-func']) self.assertNotIn('WARNING: ', output) + @testcase(1186) def test_recipetool_appendfile_postinstall(self): # A file that's created by a postinstall script (and explicitly mentioned in it) # First try without specifying recipe @@ -288,6 +305,7 @@ class RecipetoolTests(DevtoolBase): '}\n'] _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-postinst', self.testfile, '-r selftest-recipetool-appendfile', expectedlines, ['testfile']) + @testcase(1179) def test_recipetool_appendfile_extlayer(self): # Try creating a bbappend in a layer that's not in bblayers.conf and has a different structure exttemplayerdir = os.path.join(self.tempdir, 'extlayer') @@ -303,6 +321,7 @@ class RecipetoolTests(DevtoolBase): 'metadata/recipes/recipes-test/selftest-recipetool-appendfile/selftest-recipetool-appendfile/selftest-replaceme-orig'] self.assertEqual(sorted(createdfiles), sorted(expectedfiles)) + @testcase(1192) def test_recipetool_appendfile_wildcard(self): def try_appendfile_wc(options): @@ -327,8 +346,7 @@ class RecipetoolTests(DevtoolBase): filename = try_appendfile_wc('-w') self.assertEqual(filename, recipefn.split('_')[0] + '_%.bbappend') - - + @testcase(1193) def test_recipetool_create(self): # Try adding a recipe tempsrc = os.path.join(self.tempdir, 'srctree') @@ -345,6 +363,7 @@ class RecipetoolTests(DevtoolBase): checkvars['SRC_URI[sha256sum]'] = 'f6ba691f40e30e640efa2752c1f9499a3f9738257660994de70a45fe00d12b64' self._test_recipe_contents(recipefile, checkvars, []) + @testcase(1194) def test_recipetool_create_git(self): # Ensure we have the right data in shlibs/pkgdata bitbake('libpng pango libx11 libxext jpeg') -- cgit 1.2.3-korg