diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2015-05-29 16:03:41 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-10-01 07:43:31 +0100 |
commit | afb01421e2a93f3fa1e67236e49d6ea3f22e925e (patch) | |
tree | 3ed2259a70c7864a7396ef38c6e97632b5f6b739 /meta/lib/oeqa/selftest | |
parent | 31c3078a6374fb8fb4f6fc6a6d261b6322f17c7f (diff) | |
download | poky-afb01421e2a93f3fa1e67236e49d6ea3f22e925e.tar.gz |
oe-selftest: devtool: add setup() method
In order to remove some code duplication. The method currently only
does checking of workspace dir.
(From OE-Core rev: 5d7cd3dc9e497bb3c2aba4cf2af3e3ee84dd7a2f)
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest')
-rw-r--r-- | meta/lib/oeqa/selftest/devtool.py | 124 |
1 files changed, 45 insertions, 79 deletions
diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py index 3a8168c2d5..23aa85a498 100644 --- a/meta/lib/oeqa/selftest/devtool.py +++ b/meta/lib/oeqa/selftest/devtool.py | |||
@@ -84,11 +84,17 @@ class DevtoolBase(oeSelfTest): | |||
84 | 84 | ||
85 | class DevtoolTests(DevtoolBase): | 85 | class DevtoolTests(DevtoolBase): |
86 | 86 | ||
87 | def setUp(self): | ||
88 | """Test case setup function""" | ||
89 | super(DevtoolTests, self).setUp() | ||
90 | self.workspacedir = os.path.join(self.builddir, 'workspace') | ||
91 | self.assertTrue(not os.path.exists(self.workspacedir), | ||
92 | 'This test cannot be run with a workspace directory ' | ||
93 | 'under the build directory') | ||
94 | |||
87 | @testcase(1158) | 95 | @testcase(1158) |
88 | def test_create_workspace(self): | 96 | def test_create_workspace(self): |
89 | # Check preconditions | 97 | # Check preconditions |
90 | workspacedir = os.path.join(self.builddir, 'workspace') | ||
91 | self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory') | ||
92 | result = runCmd('bitbake-layers show-layers') | 98 | result = runCmd('bitbake-layers show-layers') |
93 | self.assertTrue('/workspace' not in result.output, 'This test cannot be run with a workspace layer in bblayers.conf') | 99 | self.assertTrue('/workspace' not in result.output, 'This test cannot be run with a workspace layer in bblayers.conf') |
94 | # Try creating a workspace layer with a specific path | 100 | # Try creating a workspace layer with a specific path |
@@ -99,19 +105,16 @@ class DevtoolTests(DevtoolBase): | |||
99 | result = runCmd('bitbake-layers show-layers') | 105 | result = runCmd('bitbake-layers show-layers') |
100 | self.assertIn(tempdir, result.output) | 106 | self.assertIn(tempdir, result.output) |
101 | # Try creating a workspace layer with the default path | 107 | # Try creating a workspace layer with the default path |
102 | self.track_for_cleanup(workspacedir) | 108 | self.track_for_cleanup(self.workspacedir) |
103 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | 109 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') |
104 | result = runCmd('devtool create-workspace') | 110 | result = runCmd('devtool create-workspace') |
105 | self.assertTrue(os.path.isfile(os.path.join(workspacedir, 'conf', 'layer.conf')), msg = "No workspace created. devtool output: %s " % result.output) | 111 | self.assertTrue(os.path.isfile(os.path.join(self.workspacedir, 'conf', 'layer.conf')), msg = "No workspace created. devtool output: %s " % result.output) |
106 | result = runCmd('bitbake-layers show-layers') | 112 | result = runCmd('bitbake-layers show-layers') |
107 | self.assertNotIn(tempdir, result.output) | 113 | self.assertNotIn(tempdir, result.output) |
108 | self.assertIn(workspacedir, result.output) | 114 | self.assertIn(self.workspacedir, result.output) |
109 | 115 | ||
110 | @testcase(1159) | 116 | @testcase(1159) |
111 | def test_devtool_add(self): | 117 | def test_devtool_add(self): |
112 | # Check preconditions | ||
113 | workspacedir = os.path.join(self.builddir, 'workspace') | ||
114 | self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory') | ||
115 | # Fetch source | 118 | # Fetch source |
116 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | 119 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') |
117 | self.track_for_cleanup(tempdir) | 120 | self.track_for_cleanup(tempdir) |
@@ -121,11 +124,11 @@ class DevtoolTests(DevtoolBase): | |||
121 | srcdir = os.path.join(tempdir, 'pv-1.5.3') | 124 | srcdir = os.path.join(tempdir, 'pv-1.5.3') |
122 | self.assertTrue(os.path.isfile(os.path.join(srcdir, 'configure')), 'Unable to find configure script in source directory') | 125 | self.assertTrue(os.path.isfile(os.path.join(srcdir, 'configure')), 'Unable to find configure script in source directory') |
123 | # Test devtool add | 126 | # Test devtool add |
124 | self.track_for_cleanup(workspacedir) | 127 | self.track_for_cleanup(self.workspacedir) |
125 | self.add_command_to_tearDown('bitbake -c cleansstate pv') | 128 | self.add_command_to_tearDown('bitbake -c cleansstate pv') |
126 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | 129 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') |
127 | result = runCmd('devtool add pv %s' % srcdir) | 130 | result = runCmd('devtool add pv %s' % srcdir) |
128 | self.assertTrue(os.path.exists(os.path.join(workspacedir, 'conf', 'layer.conf')), 'Workspace directory not created') | 131 | self.assertTrue(os.path.exists(os.path.join(self.workspacedir, 'conf', 'layer.conf')), 'Workspace directory not created') |
129 | # Test devtool status | 132 | # Test devtool status |
130 | result = runCmd('devtool status') | 133 | result = runCmd('devtool status') |
131 | self.assertIn('pv', result.output) | 134 | self.assertIn('pv', result.output) |
@@ -144,9 +147,6 @@ class DevtoolTests(DevtoolBase): | |||
144 | 147 | ||
145 | @testcase(1162) | 148 | @testcase(1162) |
146 | def test_devtool_add_library(self): | 149 | def test_devtool_add_library(self): |
147 | # Check preconditions | ||
148 | workspacedir = os.path.join(self.builddir, 'workspace') | ||
149 | self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory') | ||
150 | # We don't have the ability to pick up this dependency automatically yet... | 150 | # We don't have the ability to pick up this dependency automatically yet... |
151 | bitbake('libusb1') | 151 | bitbake('libusb1') |
152 | # Fetch source | 152 | # Fetch source |
@@ -158,10 +158,10 @@ class DevtoolTests(DevtoolBase): | |||
158 | srcdir = os.path.join(tempdir, 'libftdi1-1.1') | 158 | srcdir = os.path.join(tempdir, 'libftdi1-1.1') |
159 | self.assertTrue(os.path.isfile(os.path.join(srcdir, 'CMakeLists.txt')), 'Unable to find CMakeLists.txt in source directory') | 159 | self.assertTrue(os.path.isfile(os.path.join(srcdir, 'CMakeLists.txt')), 'Unable to find CMakeLists.txt in source directory') |
160 | # Test devtool add (and use -V so we test that too) | 160 | # Test devtool add (and use -V so we test that too) |
161 | self.track_for_cleanup(workspacedir) | 161 | self.track_for_cleanup(self.workspacedir) |
162 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | 162 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') |
163 | result = runCmd('devtool add libftdi %s -V 1.1' % srcdir) | 163 | result = runCmd('devtool add libftdi %s -V 1.1' % srcdir) |
164 | self.assertTrue(os.path.exists(os.path.join(workspacedir, 'conf', 'layer.conf')), 'Workspace directory not created') | 164 | self.assertTrue(os.path.exists(os.path.join(self.workspacedir, 'conf', 'layer.conf')), 'Workspace directory not created') |
165 | # Test devtool status | 165 | # Test devtool status |
166 | result = runCmd('devtool status') | 166 | result = runCmd('devtool status') |
167 | self.assertIn('libftdi', result.output) | 167 | self.assertIn('libftdi', result.output) |
@@ -185,9 +185,6 @@ class DevtoolTests(DevtoolBase): | |||
185 | 185 | ||
186 | @testcase(1160) | 186 | @testcase(1160) |
187 | def test_devtool_add_fetch(self): | 187 | def test_devtool_add_fetch(self): |
188 | # Check preconditions | ||
189 | workspacedir = os.path.join(self.builddir, 'workspace') | ||
190 | self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory') | ||
191 | # Fetch source | 188 | # Fetch source |
192 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | 189 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') |
193 | self.track_for_cleanup(tempdir) | 190 | self.track_for_cleanup(tempdir) |
@@ -196,11 +193,11 @@ class DevtoolTests(DevtoolBase): | |||
196 | testrecipe = 'python-markupsafe' | 193 | testrecipe = 'python-markupsafe' |
197 | srcdir = os.path.join(tempdir, testrecipe) | 194 | srcdir = os.path.join(tempdir, testrecipe) |
198 | # Test devtool add | 195 | # Test devtool add |
199 | self.track_for_cleanup(workspacedir) | 196 | self.track_for_cleanup(self.workspacedir) |
200 | self.add_command_to_tearDown('bitbake -c cleansstate %s' % testrecipe) | 197 | self.add_command_to_tearDown('bitbake -c cleansstate %s' % testrecipe) |
201 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | 198 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') |
202 | result = runCmd('devtool add %s %s -f %s' % (testrecipe, srcdir, url)) | 199 | result = runCmd('devtool add %s %s -f %s' % (testrecipe, srcdir, url)) |
203 | self.assertTrue(os.path.exists(os.path.join(workspacedir, 'conf', 'layer.conf')), 'Workspace directory not created. %s' % result.output) | 200 | self.assertTrue(os.path.exists(os.path.join(self.workspacedir, 'conf', 'layer.conf')), 'Workspace directory not created. %s' % result.output) |
204 | self.assertTrue(os.path.isfile(os.path.join(srcdir, 'setup.py')), 'Unable to find setup.py in source directory') | 201 | self.assertTrue(os.path.isfile(os.path.join(srcdir, 'setup.py')), 'Unable to find setup.py in source directory') |
205 | # Test devtool status | 202 | # Test devtool status |
206 | result = runCmd('devtool status') | 203 | result = runCmd('devtool status') |
@@ -232,9 +229,6 @@ class DevtoolTests(DevtoolBase): | |||
232 | 229 | ||
233 | @testcase(1161) | 230 | @testcase(1161) |
234 | def test_devtool_add_fetch_git(self): | 231 | def test_devtool_add_fetch_git(self): |
235 | # Check preconditions | ||
236 | workspacedir = os.path.join(self.builddir, 'workspace') | ||
237 | self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory') | ||
238 | # Fetch source | 232 | # Fetch source |
239 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | 233 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') |
240 | self.track_for_cleanup(tempdir) | 234 | self.track_for_cleanup(tempdir) |
@@ -243,11 +237,11 @@ class DevtoolTests(DevtoolBase): | |||
243 | testrecipe = 'libmatchbox2' | 237 | testrecipe = 'libmatchbox2' |
244 | srcdir = os.path.join(tempdir, testrecipe) | 238 | srcdir = os.path.join(tempdir, testrecipe) |
245 | # Test devtool add | 239 | # Test devtool add |
246 | self.track_for_cleanup(workspacedir) | 240 | self.track_for_cleanup(self.workspacedir) |
247 | self.add_command_to_tearDown('bitbake -c cleansstate %s' % testrecipe) | 241 | self.add_command_to_tearDown('bitbake -c cleansstate %s' % testrecipe) |
248 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | 242 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') |
249 | result = runCmd('devtool add %s %s -f %s' % (testrecipe, srcdir, url)) | 243 | result = runCmd('devtool add %s %s -f %s' % (testrecipe, srcdir, url)) |
250 | self.assertTrue(os.path.exists(os.path.join(workspacedir, 'conf', 'layer.conf')), 'Workspace directory not created: %s' % result.output) | 244 | self.assertTrue(os.path.exists(os.path.join(self.workspacedir, 'conf', 'layer.conf')), 'Workspace directory not created: %s' % result.output) |
251 | self.assertTrue(os.path.isfile(os.path.join(srcdir, 'configure.ac')), 'Unable to find configure.ac in source directory') | 245 | self.assertTrue(os.path.isfile(os.path.join(srcdir, 'configure.ac')), 'Unable to find configure.ac in source directory') |
252 | # Test devtool status | 246 | # Test devtool status |
253 | result = runCmd('devtool status') | 247 | result = runCmd('devtool status') |
@@ -284,22 +278,19 @@ class DevtoolTests(DevtoolBase): | |||
284 | 278 | ||
285 | @testcase(1164) | 279 | @testcase(1164) |
286 | def test_devtool_modify(self): | 280 | def test_devtool_modify(self): |
287 | # Check preconditions | ||
288 | workspacedir = os.path.join(self.builddir, 'workspace') | ||
289 | self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory') | ||
290 | # Clean up anything in the workdir/sysroot/sstate cache | 281 | # Clean up anything in the workdir/sysroot/sstate cache |
291 | bitbake('mdadm -c cleansstate') | 282 | bitbake('mdadm -c cleansstate') |
292 | # Try modifying a recipe | 283 | # Try modifying a recipe |
293 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | 284 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') |
294 | self.track_for_cleanup(tempdir) | 285 | self.track_for_cleanup(tempdir) |
295 | self.track_for_cleanup(workspacedir) | 286 | self.track_for_cleanup(self.workspacedir) |
296 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | 287 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') |
297 | self.add_command_to_tearDown('bitbake -c clean mdadm') | 288 | self.add_command_to_tearDown('bitbake -c clean mdadm') |
298 | result = runCmd('devtool modify mdadm -x %s' % tempdir) | 289 | result = runCmd('devtool modify mdadm -x %s' % tempdir) |
299 | self.assertTrue(os.path.exists(os.path.join(tempdir, 'Makefile')), 'Extracted source could not be found') | 290 | self.assertTrue(os.path.exists(os.path.join(tempdir, 'Makefile')), 'Extracted source could not be found') |
300 | self.assertTrue(os.path.isdir(os.path.join(tempdir, '.git')), 'git repository for external source tree not found') | 291 | self.assertTrue(os.path.isdir(os.path.join(tempdir, '.git')), 'git repository for external source tree not found') |
301 | self.assertTrue(os.path.exists(os.path.join(workspacedir, 'conf', 'layer.conf')), 'Workspace directory not created') | 292 | self.assertTrue(os.path.exists(os.path.join(self.workspacedir, 'conf', 'layer.conf')), 'Workspace directory not created') |
302 | matches = glob.glob(os.path.join(workspacedir, 'appends', 'mdadm_*.bbappend')) | 293 | matches = glob.glob(os.path.join(self.workspacedir, 'appends', 'mdadm_*.bbappend')) |
303 | self.assertTrue(matches, 'bbappend not created %s' % result.output) | 294 | self.assertTrue(matches, 'bbappend not created %s' % result.output) |
304 | # Test devtool status | 295 | # Test devtool status |
305 | result = runCmd('devtool status') | 296 | result = runCmd('devtool status') |
@@ -336,13 +327,10 @@ class DevtoolTests(DevtoolBase): | |||
336 | 327 | ||
337 | @testcase(1166) | 328 | @testcase(1166) |
338 | def test_devtool_modify_invalid(self): | 329 | def test_devtool_modify_invalid(self): |
339 | # Check preconditions | ||
340 | workspacedir = os.path.join(self.builddir, 'workspace') | ||
341 | self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory') | ||
342 | # Try modifying some recipes | 330 | # Try modifying some recipes |
343 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | 331 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') |
344 | self.track_for_cleanup(tempdir) | 332 | self.track_for_cleanup(tempdir) |
345 | self.track_for_cleanup(workspacedir) | 333 | self.track_for_cleanup(self.workspacedir) |
346 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | 334 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') |
347 | 335 | ||
348 | testrecipes = 'perf kernel-devsrc package-index core-image-minimal meta-toolchain packagegroup-core-sdk meta-ide-support'.split() | 336 | testrecipes = 'perf kernel-devsrc package-index core-image-minimal meta-toolchain packagegroup-core-sdk meta-ide-support'.split() |
@@ -369,12 +357,11 @@ class DevtoolTests(DevtoolBase): | |||
369 | 357 | ||
370 | def test_devtool_modify_native(self): | 358 | def test_devtool_modify_native(self): |
371 | # Check preconditions | 359 | # Check preconditions |
372 | workspacedir = os.path.join(self.builddir, 'workspace') | 360 | self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory') |
373 | self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory') | ||
374 | # Try modifying some recipes | 361 | # Try modifying some recipes |
375 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | 362 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') |
376 | self.track_for_cleanup(tempdir) | 363 | self.track_for_cleanup(tempdir) |
377 | self.track_for_cleanup(workspacedir) | 364 | self.track_for_cleanup(self.workspacedir) |
378 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | 365 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') |
379 | 366 | ||
380 | bbclassextended = False | 367 | bbclassextended = False |
@@ -400,8 +387,6 @@ class DevtoolTests(DevtoolBase): | |||
400 | @testcase(1165) | 387 | @testcase(1165) |
401 | def test_devtool_modify_git(self): | 388 | def test_devtool_modify_git(self): |
402 | # Check preconditions | 389 | # Check preconditions |
403 | workspacedir = os.path.join(self.builddir, 'workspace') | ||
404 | self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory') | ||
405 | testrecipe = 'mkelfimage' | 390 | testrecipe = 'mkelfimage' |
406 | src_uri = get_bb_var('SRC_URI', testrecipe) | 391 | src_uri = get_bb_var('SRC_URI', testrecipe) |
407 | self.assertIn('git://', src_uri, 'This test expects the %s recipe to be a git recipe' % testrecipe) | 392 | self.assertIn('git://', src_uri, 'This test expects the %s recipe to be a git recipe' % testrecipe) |
@@ -410,14 +395,14 @@ class DevtoolTests(DevtoolBase): | |||
410 | # Try modifying a recipe | 395 | # Try modifying a recipe |
411 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | 396 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') |
412 | self.track_for_cleanup(tempdir) | 397 | self.track_for_cleanup(tempdir) |
413 | self.track_for_cleanup(workspacedir) | 398 | self.track_for_cleanup(self.workspacedir) |
414 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | 399 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') |
415 | self.add_command_to_tearDown('bitbake -c clean %s' % testrecipe) | 400 | self.add_command_to_tearDown('bitbake -c clean %s' % testrecipe) |
416 | result = runCmd('devtool modify %s -x %s' % (testrecipe, tempdir)) | 401 | result = runCmd('devtool modify %s -x %s' % (testrecipe, tempdir)) |
417 | self.assertTrue(os.path.exists(os.path.join(tempdir, 'Makefile')), 'Extracted source could not be found') | 402 | self.assertTrue(os.path.exists(os.path.join(tempdir, 'Makefile')), 'Extracted source could not be found') |
418 | self.assertTrue(os.path.isdir(os.path.join(tempdir, '.git')), 'git repository for external source tree not found') | 403 | self.assertTrue(os.path.isdir(os.path.join(tempdir, '.git')), 'git repository for external source tree not found') |
419 | self.assertTrue(os.path.exists(os.path.join(workspacedir, 'conf', 'layer.conf')), 'Workspace directory not created. devtool output: %s' % result.output) | 404 | self.assertTrue(os.path.exists(os.path.join(self.workspacedir, 'conf', 'layer.conf')), 'Workspace directory not created. devtool output: %s' % result.output) |
420 | matches = glob.glob(os.path.join(workspacedir, 'appends', 'mkelfimage_*.bbappend')) | 405 | matches = glob.glob(os.path.join(self.workspacedir, 'appends', 'mkelfimage_*.bbappend')) |
421 | self.assertTrue(matches, 'bbappend not created') | 406 | self.assertTrue(matches, 'bbappend not created') |
422 | # Test devtool status | 407 | # Test devtool status |
423 | result = runCmd('devtool status') | 408 | result = runCmd('devtool status') |
@@ -434,8 +419,6 @@ class DevtoolTests(DevtoolBase): | |||
434 | @testcase(1167) | 419 | @testcase(1167) |
435 | def test_devtool_modify_localfiles(self): | 420 | def test_devtool_modify_localfiles(self): |
436 | # Check preconditions | 421 | # Check preconditions |
437 | workspacedir = os.path.join(self.builddir, 'workspace') | ||
438 | self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory') | ||
439 | testrecipe = 'lighttpd' | 422 | testrecipe = 'lighttpd' |
440 | src_uri = (get_bb_var('SRC_URI', testrecipe) or '').split() | 423 | src_uri = (get_bb_var('SRC_URI', testrecipe) or '').split() |
441 | foundlocal = False | 424 | foundlocal = False |
@@ -449,13 +432,13 @@ class DevtoolTests(DevtoolBase): | |||
449 | # Try modifying a recipe | 432 | # Try modifying a recipe |
450 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | 433 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') |
451 | self.track_for_cleanup(tempdir) | 434 | self.track_for_cleanup(tempdir) |
452 | self.track_for_cleanup(workspacedir) | 435 | self.track_for_cleanup(self.workspacedir) |
453 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | 436 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') |
454 | self.add_command_to_tearDown('bitbake -c clean %s' % testrecipe) | 437 | self.add_command_to_tearDown('bitbake -c clean %s' % testrecipe) |
455 | result = runCmd('devtool modify %s -x %s' % (testrecipe, tempdir)) | 438 | result = runCmd('devtool modify %s -x %s' % (testrecipe, tempdir)) |
456 | self.assertTrue(os.path.exists(os.path.join(tempdir, 'configure.ac')), 'Extracted source could not be found') | 439 | self.assertTrue(os.path.exists(os.path.join(tempdir, 'configure.ac')), 'Extracted source could not be found') |
457 | self.assertTrue(os.path.exists(os.path.join(workspacedir, 'conf', 'layer.conf')), 'Workspace directory not created') | 440 | self.assertTrue(os.path.exists(os.path.join(self.workspacedir, 'conf', 'layer.conf')), 'Workspace directory not created') |
458 | matches = glob.glob(os.path.join(workspacedir, 'appends', '%s_*.bbappend' % testrecipe)) | 441 | matches = glob.glob(os.path.join(self.workspacedir, 'appends', '%s_*.bbappend' % testrecipe)) |
459 | self.assertTrue(matches, 'bbappend not created') | 442 | self.assertTrue(matches, 'bbappend not created') |
460 | # Test devtool status | 443 | # Test devtool status |
461 | result = runCmd('devtool status') | 444 | result = runCmd('devtool status') |
@@ -467,8 +450,6 @@ class DevtoolTests(DevtoolBase): | |||
467 | @testcase(1169) | 450 | @testcase(1169) |
468 | def test_devtool_update_recipe(self): | 451 | def test_devtool_update_recipe(self): |
469 | # Check preconditions | 452 | # Check preconditions |
470 | workspacedir = os.path.join(self.builddir, 'workspace') | ||
471 | self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory') | ||
472 | testrecipe = 'minicom' | 453 | testrecipe = 'minicom' |
473 | recipefile = get_bb_var('FILE', testrecipe) | 454 | recipefile = get_bb_var('FILE', testrecipe) |
474 | src_uri = get_bb_var('SRC_URI', testrecipe) | 455 | src_uri = get_bb_var('SRC_URI', testrecipe) |
@@ -478,7 +459,7 @@ class DevtoolTests(DevtoolBase): | |||
478 | # First, modify a recipe | 459 | # First, modify a recipe |
479 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | 460 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') |
480 | self.track_for_cleanup(tempdir) | 461 | self.track_for_cleanup(tempdir) |
481 | self.track_for_cleanup(workspacedir) | 462 | self.track_for_cleanup(self.workspacedir) |
482 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | 463 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') |
483 | # (don't bother with cleaning the recipe on teardown, we won't be building it) | 464 | # (don't bother with cleaning the recipe on teardown, we won't be building it) |
484 | result = runCmd('devtool modify %s -x %s' % (testrecipe, tempdir)) | 465 | result = runCmd('devtool modify %s -x %s' % (testrecipe, tempdir)) |
@@ -514,8 +495,6 @@ class DevtoolTests(DevtoolBase): | |||
514 | @testcase(1172) | 495 | @testcase(1172) |
515 | def test_devtool_update_recipe_git(self): | 496 | def test_devtool_update_recipe_git(self): |
516 | # Check preconditions | 497 | # Check preconditions |
517 | workspacedir = os.path.join(self.builddir, 'workspace') | ||
518 | self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory') | ||
519 | testrecipe = 'mtd-utils' | 498 | testrecipe = 'mtd-utils' |
520 | recipefile = get_bb_var('FILE', testrecipe) | 499 | recipefile = get_bb_var('FILE', testrecipe) |
521 | src_uri = get_bb_var('SRC_URI', testrecipe) | 500 | src_uri = get_bb_var('SRC_URI', testrecipe) |
@@ -530,7 +509,7 @@ class DevtoolTests(DevtoolBase): | |||
530 | # First, modify a recipe | 509 | # First, modify a recipe |
531 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | 510 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') |
532 | self.track_for_cleanup(tempdir) | 511 | self.track_for_cleanup(tempdir) |
533 | self.track_for_cleanup(workspacedir) | 512 | self.track_for_cleanup(self.workspacedir) |
534 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | 513 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') |
535 | # (don't bother with cleaning the recipe on teardown, we won't be building it) | 514 | # (don't bother with cleaning the recipe on teardown, we won't be building it) |
536 | result = runCmd('devtool modify %s -x %s' % (testrecipe, tempdir)) | 515 | result = runCmd('devtool modify %s -x %s' % (testrecipe, tempdir)) |
@@ -609,8 +588,6 @@ class DevtoolTests(DevtoolBase): | |||
609 | @testcase(1170) | 588 | @testcase(1170) |
610 | def test_devtool_update_recipe_append(self): | 589 | def test_devtool_update_recipe_append(self): |
611 | # Check preconditions | 590 | # Check preconditions |
612 | workspacedir = os.path.join(self.builddir, 'workspace') | ||
613 | self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory') | ||
614 | testrecipe = 'mdadm' | 591 | testrecipe = 'mdadm' |
615 | recipefile = get_bb_var('FILE', testrecipe) | 592 | recipefile = get_bb_var('FILE', testrecipe) |
616 | src_uri = get_bb_var('SRC_URI', testrecipe) | 593 | src_uri = get_bb_var('SRC_URI', testrecipe) |
@@ -622,7 +599,7 @@ class DevtoolTests(DevtoolBase): | |||
622 | tempsrcdir = os.path.join(tempdir, 'source') | 599 | tempsrcdir = os.path.join(tempdir, 'source') |
623 | templayerdir = os.path.join(tempdir, 'layer') | 600 | templayerdir = os.path.join(tempdir, 'layer') |
624 | self.track_for_cleanup(tempdir) | 601 | self.track_for_cleanup(tempdir) |
625 | self.track_for_cleanup(workspacedir) | 602 | self.track_for_cleanup(self.workspacedir) |
626 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | 603 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') |
627 | # (don't bother with cleaning the recipe on teardown, we won't be building it) | 604 | # (don't bother with cleaning the recipe on teardown, we won't be building it) |
628 | result = runCmd('devtool modify %s -x %s' % (testrecipe, tempsrcdir)) | 605 | result = runCmd('devtool modify %s -x %s' % (testrecipe, tempsrcdir)) |
@@ -685,8 +662,6 @@ class DevtoolTests(DevtoolBase): | |||
685 | @testcase(1171) | 662 | @testcase(1171) |
686 | def test_devtool_update_recipe_append_git(self): | 663 | def test_devtool_update_recipe_append_git(self): |
687 | # Check preconditions | 664 | # Check preconditions |
688 | workspacedir = os.path.join(self.builddir, 'workspace') | ||
689 | self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory') | ||
690 | testrecipe = 'mtd-utils' | 665 | testrecipe = 'mtd-utils' |
691 | recipefile = get_bb_var('FILE', testrecipe) | 666 | recipefile = get_bb_var('FILE', testrecipe) |
692 | src_uri = get_bb_var('SRC_URI', testrecipe) | 667 | src_uri = get_bb_var('SRC_URI', testrecipe) |
@@ -702,7 +677,7 @@ class DevtoolTests(DevtoolBase): | |||
702 | tempsrcdir = os.path.join(tempdir, 'source') | 677 | tempsrcdir = os.path.join(tempdir, 'source') |
703 | templayerdir = os.path.join(tempdir, 'layer') | 678 | templayerdir = os.path.join(tempdir, 'layer') |
704 | self.track_for_cleanup(tempdir) | 679 | self.track_for_cleanup(tempdir) |
705 | self.track_for_cleanup(workspacedir) | 680 | self.track_for_cleanup(self.workspacedir) |
706 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | 681 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') |
707 | # (don't bother with cleaning the recipe on teardown, we won't be building it) | 682 | # (don't bother with cleaning the recipe on teardown, we won't be building it) |
708 | result = runCmd('devtool modify %s -x %s' % (testrecipe, tempsrcdir)) | 683 | result = runCmd('devtool modify %s -x %s' % (testrecipe, tempsrcdir)) |
@@ -781,13 +756,10 @@ class DevtoolTests(DevtoolBase): | |||
781 | 756 | ||
782 | @testcase(1163) | 757 | @testcase(1163) |
783 | def test_devtool_extract(self): | 758 | def test_devtool_extract(self): |
784 | # Check preconditions | ||
785 | workspacedir = os.path.join(self.builddir, 'workspace') | ||
786 | self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory') | ||
787 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | 759 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') |
788 | # Try devtool extract | 760 | # Try devtool extract |
789 | self.track_for_cleanup(tempdir) | 761 | self.track_for_cleanup(tempdir) |
790 | self.track_for_cleanup(workspacedir) | 762 | self.track_for_cleanup(self.workspacedir) |
791 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | 763 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') |
792 | result = runCmd('devtool extract remake %s' % tempdir) | 764 | result = runCmd('devtool extract remake %s' % tempdir) |
793 | self.assertTrue(os.path.exists(os.path.join(tempdir, 'Makefile.am')), 'Extracted source could not be found') | 765 | self.assertTrue(os.path.exists(os.path.join(tempdir, 'Makefile.am')), 'Extracted source could not be found') |
@@ -795,12 +767,9 @@ class DevtoolTests(DevtoolBase): | |||
795 | 767 | ||
796 | @testcase(1168) | 768 | @testcase(1168) |
797 | def test_devtool_reset_all(self): | 769 | def test_devtool_reset_all(self): |
798 | # Check preconditions | ||
799 | workspacedir = os.path.join(self.builddir, 'workspace') | ||
800 | self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory') | ||
801 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | 770 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') |
802 | self.track_for_cleanup(tempdir) | 771 | self.track_for_cleanup(tempdir) |
803 | self.track_for_cleanup(workspacedir) | 772 | self.track_for_cleanup(self.workspacedir) |
804 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | 773 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') |
805 | testrecipe1 = 'mdadm' | 774 | testrecipe1 = 'mdadm' |
806 | testrecipe2 = 'cronie' | 775 | testrecipe2 = 'cronie' |
@@ -846,8 +815,7 @@ class DevtoolTests(DevtoolBase): | |||
846 | break | 815 | break |
847 | else: | 816 | else: |
848 | self.skipTest('No tap devices found - you must set up tap devices with scripts/runqemu-gen-tapdevs before running this test') | 817 | self.skipTest('No tap devices found - you must set up tap devices with scripts/runqemu-gen-tapdevs before running this test') |
849 | workspacedir = os.path.join(self.builddir, 'workspace') | 818 | self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory') |
850 | self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory') | ||
851 | # Definitions | 819 | # Definitions |
852 | testrecipe = 'mdadm' | 820 | testrecipe = 'mdadm' |
853 | testfile = '/sbin/mdadm' | 821 | testfile = '/sbin/mdadm' |
@@ -863,7 +831,7 @@ class DevtoolTests(DevtoolBase): | |||
863 | # Try devtool modify | 831 | # Try devtool modify |
864 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | 832 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') |
865 | self.track_for_cleanup(tempdir) | 833 | self.track_for_cleanup(tempdir) |
866 | self.track_for_cleanup(workspacedir) | 834 | self.track_for_cleanup(self.workspacedir) |
867 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | 835 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') |
868 | self.add_command_to_tearDown('bitbake -c clean %s' % testrecipe) | 836 | self.add_command_to_tearDown('bitbake -c clean %s' % testrecipe) |
869 | result = runCmd('devtool modify %s -x %s' % (testrecipe, tempdir)) | 837 | result = runCmd('devtool modify %s -x %s' % (testrecipe, tempdir)) |
@@ -911,10 +879,9 @@ class DevtoolTests(DevtoolBase): | |||
911 | def test_devtool_build_image(self): | 879 | def test_devtool_build_image(self): |
912 | """Test devtool build-image plugin""" | 880 | """Test devtool build-image plugin""" |
913 | # Check preconditions | 881 | # Check preconditions |
914 | workspacedir = os.path.join(self.builddir, 'workspace') | 882 | self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory') |
915 | self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory') | ||
916 | image = 'core-image-minimal' | 883 | image = 'core-image-minimal' |
917 | self.track_for_cleanup(workspacedir) | 884 | self.track_for_cleanup(self.workspacedir) |
918 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | 885 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') |
919 | self.add_command_to_tearDown('bitbake -c clean %s' % image) | 886 | self.add_command_to_tearDown('bitbake -c clean %s' % image) |
920 | bitbake('%s -c clean' % image) | 887 | bitbake('%s -c clean' % image) |
@@ -944,8 +911,7 @@ class DevtoolTests(DevtoolBase): | |||
944 | 911 | ||
945 | def test_devtool_upgrade(self): | 912 | def test_devtool_upgrade(self): |
946 | # Check preconditions | 913 | # Check preconditions |
947 | workspacedir = os.path.join(self.builddir, 'workspace') | 914 | self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory') |
948 | self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory') | ||
949 | # Check parameters | 915 | # Check parameters |
950 | result = runCmd('devtool upgrade -h') | 916 | result = runCmd('devtool upgrade -h') |
951 | for param in 'recipename srctree --version -V --branch -b --keep-temp --no-patch'.split(): | 917 | for param in 'recipename srctree --version -V --branch -b --keep-temp --no-patch'.split(): |
@@ -963,9 +929,9 @@ class DevtoolTests(DevtoolBase): | |||
963 | # Check if srctree at least is populated | 929 | # Check if srctree at least is populated |
964 | self.assertTrue(len(os.listdir(tempdir)) > 0, 'scrtree (%s) should be populated with new (%s) source code' % (tempdir, version)) | 930 | self.assertTrue(len(os.listdir(tempdir)) > 0, 'scrtree (%s) should be populated with new (%s) source code' % (tempdir, version)) |
965 | # Check new recipe folder is present | 931 | # Check new recipe folder is present |
966 | self.assertTrue(os.path.exists(os.path.join(workspacedir,'recipes',recipe)), 'Recipe folder should exist') | 932 | self.assertTrue(os.path.exists(os.path.join(self.workspacedir,'recipes',recipe)), 'Recipe folder should exist') |
967 | # Check new recipe file is present | 933 | # Check new recipe file is present |
968 | self.assertTrue(os.path.exists(os.path.join(workspacedir,'recipes',recipe,"%s_%s.bb" % (recipe,version))), 'Recipe folder should exist') | 934 | self.assertTrue(os.path.exists(os.path.join(self.workspacedir,'recipes',recipe,"%s_%s.bb" % (recipe,version))), 'Recipe folder should exist') |
969 | # Check devtool status and make sure recipe is present | 935 | # Check devtool status and make sure recipe is present |
970 | result = runCmd('devtool status') | 936 | result = runCmd('devtool status') |
971 | self.assertIn(recipe, result.output) | 937 | self.assertIn(recipe, result.output) |
@@ -975,5 +941,5 @@ class DevtoolTests(DevtoolBase): | |||
975 | result = runCmd('devtool status') | 941 | result = runCmd('devtool status') |
976 | self.assertNotIn(recipe, result.output) | 942 | self.assertNotIn(recipe, result.output) |
977 | self.track_for_cleanup(tempdir) | 943 | self.track_for_cleanup(tempdir) |
978 | self.track_for_cleanup(workspacedir) | 944 | self.track_for_cleanup(self.workspacedir) |
979 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | 945 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') |