summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/bbtests.py
diff options
context:
space:
mode:
authorLucian Musat <georgex.l.musat@intel.com>2014-07-09 11:36:47 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-07-10 17:38:35 +0100
commitd8364371b2987d1396cfb85658565096ff72a2cd (patch)
tree3b4d13b34f9486fde32e42bdf7ce20d4066f4a4d /meta/lib/oeqa/selftest/bbtests.py
parent79dae067d99393967c1d565dc7ca2081c966a558 (diff)
downloadpoky-d8364371b2987d1396cfb85658565096ff72a2cd.tar.gz
oeqs/selftest: Added test case decorators for the rest of selftest testcases except toaster
(From OE-Core rev: 3c820db4624a062644a26de1866123a10a78a006) Signed-off-by: Lucian Musat <georgex.l.musat@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest/bbtests.py')
-rw-r--r--meta/lib/oeqa/selftest/bbtests.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/bbtests.py b/meta/lib/oeqa/selftest/bbtests.py
index d730bfd755..e765e366c1 100644
--- a/meta/lib/oeqa/selftest/bbtests.py
+++ b/meta/lib/oeqa/selftest/bbtests.py
@@ -7,19 +7,23 @@ import shutil
7import oeqa.utils.ftools as ftools 7import oeqa.utils.ftools as ftools
8from oeqa.selftest.base import oeSelfTest 8from oeqa.selftest.base import oeSelfTest
9from oeqa.utils.commands import runCmd, bitbake, get_bb_var 9from oeqa.utils.commands import runCmd, bitbake, get_bb_var
10from oeqa.utils.decorators import testcase
10 11
11class BitbakeTests(oeSelfTest): 12class BitbakeTests(oeSelfTest):
12 13
14 @testcase(789)
13 def test_run_bitbake_from_dir_1(self): 15 def test_run_bitbake_from_dir_1(self):
14 os.chdir(os.path.join(self.builddir, 'conf')) 16 os.chdir(os.path.join(self.builddir, 'conf'))
15 bitbake('-e') 17 bitbake('-e')
16 18
19 @testcase(790)
17 def test_run_bitbake_from_dir_2(self): 20 def test_run_bitbake_from_dir_2(self):
18 my_env = os.environ.copy() 21 my_env = os.environ.copy()
19 my_env['BBPATH'] = my_env['BUILDDIR'] 22 my_env['BBPATH'] = my_env['BUILDDIR']
20 os.chdir(os.path.dirname(os.environ['BUILDDIR'])) 23 os.chdir(os.path.dirname(os.environ['BUILDDIR']))
21 bitbake('-e', env=my_env) 24 bitbake('-e', env=my_env)
22 25
26 @testcase(806)
23 def test_event_handler(self): 27 def test_event_handler(self):
24 self.write_config("INHERIT += \"test_events\"") 28 self.write_config("INHERIT += \"test_events\"")
25 result = bitbake('m4-native') 29 result = bitbake('m4-native')
@@ -29,6 +33,7 @@ class BitbakeTests(oeSelfTest):
29 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)
30 self.assertFalse('Test for bb.event.InvalidEvent' in result.output) 34 self.assertFalse('Test for bb.event.InvalidEvent' in result.output)
31 35
36 @testcase(103)
32 def test_local_sstate(self): 37 def test_local_sstate(self):
33 bitbake('m4-native -ccleansstate') 38 bitbake('m4-native -ccleansstate')
34 bitbake('m4-native') 39 bitbake('m4-native')
@@ -37,14 +42,17 @@ class BitbakeTests(oeSelfTest):
37 find_setscene = re.search("m4-native.*do_.*_setscene", result.output) 42 find_setscene = re.search("m4-native.*do_.*_setscene", result.output)
38 self.assertTrue(find_setscene) 43 self.assertTrue(find_setscene)
39 44
45 @testcase(105)
40 def test_bitbake_invalid_recipe(self): 46 def test_bitbake_invalid_recipe(self):
41 result = bitbake('-b asdf', ignore_status=True) 47 result = bitbake('-b asdf', ignore_status=True)
42 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)
43 49
50 @testcase(107)
44 def test_bitbake_invalid_target(self): 51 def test_bitbake_invalid_target(self):
45 result = bitbake('asdf', ignore_status=True) 52 result = bitbake('asdf', ignore_status=True)
46 self.assertTrue("ERROR: Nothing PROVIDES 'asdf'" in result.output) 53 self.assertTrue("ERROR: Nothing PROVIDES 'asdf'" in result.output)
47 54
55 @testcase(106)
48 def test_warnings_errors(self): 56 def test_warnings_errors(self):
49 result = bitbake('-b asdf', ignore_status=True) 57 result = bitbake('-b asdf', ignore_status=True)
50 find_warnings = re.search("Summary: There w.{2,3}? [1-9][0-9]* WARNING messages* shown", result.output) 58 find_warnings = re.search("Summary: There w.{2,3}? [1-9][0-9]* WARNING messages* shown", result.output)
@@ -52,6 +60,7 @@ class BitbakeTests(oeSelfTest):
52 self.assertTrue(find_warnings, msg="Did not find the mumber of warnings at the end of the build:\n" + result.output) 60 self.assertTrue(find_warnings, msg="Did not find the mumber of warnings at the end of the build:\n" + result.output)
53 self.assertTrue(find_errors, msg="Did not find the mumber of errors at the end of the build:\n" + result.output) 61 self.assertTrue(find_errors, msg="Did not find the mumber of errors at the end of the build:\n" + result.output)
54 62
63 @testcase(108)
55 def test_invalid_patch(self): 64 def test_invalid_patch(self):
56 self.write_recipeinc('man', 'SRC_URI += "file://man-1.5h1-make.patch"') 65 self.write_recipeinc('man', 'SRC_URI += "file://man-1.5h1-make.patch"')
57 result = bitbake('man -c patch', ignore_status=True) 66 result = bitbake('man -c patch', ignore_status=True)
@@ -59,6 +68,7 @@ class BitbakeTests(oeSelfTest):
59 bitbake('-cclean man') 68 bitbake('-cclean man')
60 self.assertTrue("ERROR: Function failed: patch_do_patch" in result.output) 69 self.assertTrue("ERROR: Function failed: patch_do_patch" in result.output)
61 70
71 @testcase(163)
62 def test_force_task(self): 72 def test_force_task(self):
63 bitbake('m4-native') 73 bitbake('m4-native')
64 result = bitbake('-C compile m4-native') 74 result = bitbake('-C compile m4-native')
@@ -67,6 +77,7 @@ class BitbakeTests(oeSelfTest):
67 find_task = re.search("m4-native.*%s" % task, result.output) 77 find_task = re.search("m4-native.*%s" % task, result.output)
68 self.assertTrue(find_task) 78 self.assertTrue(find_task)
69 79
80 @testcase(167)
70 def test_bitbake_g(self): 81 def test_bitbake_g(self):
71 result = bitbake('-g core-image-full-cmdline') 82 result = bitbake('-g core-image-full-cmdline')
72 self.assertTrue('NOTE: PN build list saved to \'pn-buildlist\'' in result.output) 83 self.assertTrue('NOTE: PN build list saved to \'pn-buildlist\'' in result.output)
@@ -74,6 +85,7 @@ class BitbakeTests(oeSelfTest):
74 for f in ['pn-buildlist', 'pn-depends.dot', 'package-depends.dot', 'task-depends.dot']: 85 for f in ['pn-buildlist', 'pn-depends.dot', 'package-depends.dot', 'task-depends.dot']:
75 os.remove(f) 86 os.remove(f)
76 87
88 @testcase(899)
77 def test_image_manifest(self): 89 def test_image_manifest(self):
78 bitbake('core-image-minimal') 90 bitbake('core-image-minimal')
79 deploydir = get_bb_var("DEPLOY_DIR_IMAGE", target="core-image-minimal") 91 deploydir = get_bb_var("DEPLOY_DIR_IMAGE", target="core-image-minimal")
@@ -81,6 +93,7 @@ class BitbakeTests(oeSelfTest):
81 manifest = os.path.join(deploydir, imagename + ".manifest") 93 manifest = os.path.join(deploydir, imagename + ".manifest")
82 self.assertTrue(os.path.islink(manifest), msg="No manifest file created for image") 94 self.assertTrue(os.path.islink(manifest), msg="No manifest file created for image")
83 95
96 @testcase(168)
84 def test_invalid_recipe_src_uri(self): 97 def test_invalid_recipe_src_uri(self):
85 data = 'SRC_URI = "file://invalid"' 98 data = 'SRC_URI = "file://invalid"'
86 self.write_recipeinc('man', data) 99 self.write_recipeinc('man', data)
@@ -92,6 +105,7 @@ class BitbakeTests(oeSelfTest):
92 self.assertTrue('ERROR: Fetcher failure: Unable to find file file://invalid anywhere. The paths that were searched were:' in result.output) 105 self.assertTrue('ERROR: Fetcher failure: Unable to find file file://invalid anywhere. The paths that were searched were:' in result.output)
93 self.assertTrue('ERROR: Function failed: Fetcher failure for URL: \'file://invalid\'. Unable to fetch URL from any source.' in result.output) 106 self.assertTrue('ERROR: Function failed: Fetcher failure for URL: \'file://invalid\'. Unable to fetch URL from any source.' in result.output)
94 107
108 @testcase(171)
95 def test_rename_downloaded_file(self): 109 def test_rename_downloaded_file(self):
96 data = 'SRC_URI_append = ";downloadfilename=test-aspell.tar.gz"' 110 data = 'SRC_URI_append = ";downloadfilename=test-aspell.tar.gz"'
97 self.write_recipeinc('aspell', data) 111 self.write_recipeinc('aspell', data)
@@ -103,25 +117,30 @@ class BitbakeTests(oeSelfTest):
103 self.assertTrue(os.path.isfile(os.path.join(get_bb_var("DL_DIR"), 'test-aspell.tar.gz.done'))) 117 self.assertTrue(os.path.isfile(os.path.join(get_bb_var("DL_DIR"), 'test-aspell.tar.gz.done')))
104 bitbake('-ccleanall aspell') 118 bitbake('-ccleanall aspell')
105 119
120 @testcase(1028)
106 def test_environment(self): 121 def test_environment(self):
107 self.append_config("TEST_ENV=\"localconf\"") 122 self.append_config("TEST_ENV=\"localconf\"")
108 result = runCmd('bitbake -e | grep TEST_ENV=') 123 result = runCmd('bitbake -e | grep TEST_ENV=')
109 self.assertTrue('localconf' in result.output) 124 self.assertTrue('localconf' in result.output)
110 self.remove_config("TEST_ENV=\"localconf\"") 125 self.remove_config("TEST_ENV=\"localconf\"")
111 126
127 @testcase(1029)
112 def test_dry_run(self): 128 def test_dry_run(self):
113 result = runCmd('bitbake -n m4-native') 129 result = runCmd('bitbake -n m4-native')
114 self.assertEqual(0, result.status) 130 self.assertEqual(0, result.status)
115 131
132 @testcase(1030)
116 def test_just_parse(self): 133 def test_just_parse(self):
117 result = runCmd('bitbake -p') 134 result = runCmd('bitbake -p')
118 self.assertEqual(0, result.status) 135 self.assertEqual(0, result.status)
119 136
137 @testcase(1031)
120 def test_version(self): 138 def test_version(self):
121 result = runCmd('bitbake -s | grep wget') 139 result = runCmd('bitbake -s | grep wget')
122 find = re.search("wget *:([0-9a-zA-Z\.\-]+)", result.output) 140 find = re.search("wget *:([0-9a-zA-Z\.\-]+)", result.output)
123 self.assertTrue(find) 141 self.assertTrue(find)
124 142
143 @testcase(1032)
125 def test_prefile(self): 144 def test_prefile(self):
126 preconf = os.path.join(self.builddir, 'conf/prefile.conf') 145 preconf = os.path.join(self.builddir, 'conf/prefile.conf')
127 self.track_for_cleanup(preconf) 146 self.track_for_cleanup(preconf)
@@ -133,6 +152,7 @@ class BitbakeTests(oeSelfTest):
133 self.assertTrue('localconf' in result.output) 152 self.assertTrue('localconf' in result.output)
134 self.remove_config("TEST_PREFILE=\"localconf\"") 153 self.remove_config("TEST_PREFILE=\"localconf\"")
135 154
155 @testcase(1033)
136 def test_postfile(self): 156 def test_postfile(self):
137 postconf = os.path.join(self.builddir, 'conf/postfile.conf') 157 postconf = os.path.join(self.builddir, 'conf/postfile.conf')
138 self.track_for_cleanup(postconf) 158 self.track_for_cleanup(postconf)
@@ -142,10 +162,12 @@ class BitbakeTests(oeSelfTest):
142 self.assertTrue('postfile' in result.output) 162 self.assertTrue('postfile' in result.output)
143 self.remove_config("TEST_POSTFILE=\"localconf\"") 163 self.remove_config("TEST_POSTFILE=\"localconf\"")
144 164
165 @testcase(1034)
145 def test_checkuri(self): 166 def test_checkuri(self):
146 result = runCmd('bitbake -c checkuri m4') 167 result = runCmd('bitbake -c checkuri m4')
147 self.assertEqual(0, result.status) 168 self.assertEqual(0, result.status)
148 169
170 @testcase(1035)
149 def test_continue(self): 171 def test_continue(self):
150 self.write_recipeinc('man',"\ndo_fail_task () {\nexit 1 \n}\n\naddtask do_fail_task before do_fetch\n" ) 172 self.write_recipeinc('man',"\ndo_fail_task () {\nexit 1 \n}\n\naddtask do_fail_task before do_fetch\n" )
151 runCmd('bitbake -c cleanall man xcursor-transparent-theme') 173 runCmd('bitbake -c cleanall man xcursor-transparent-theme')