summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/selftest/devtool.py60
1 files changed, 60 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py
index 71d205c73f..46f5a0b998 100644
--- a/meta/lib/oeqa/selftest/devtool.py
+++ b/meta/lib/oeqa/selftest/devtool.py
@@ -1349,3 +1349,63 @@ class DevtoolTests(DevtoolBase):
1349 files.remove(foundpatch) 1349 files.remove(foundpatch)
1350 if files: 1350 if files:
1351 self.fail('Unexpected file(s) copied next to bbappend: %s' % ', '.join(files)) 1351 self.fail('Unexpected file(s) copied next to bbappend: %s' % ', '.join(files))
1352
1353 def test_devtool_rename(self):
1354 # Check preconditions
1355 self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory')
1356 self.track_for_cleanup(self.workspacedir)
1357 self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
1358
1359 # First run devtool add
1360 # We already have this recipe in OE-Core, but that doesn't matter
1361 recipename = 'i2c-tools'
1362 recipever = '3.1.2'
1363 recipefile = os.path.join(self.workspacedir, 'recipes', recipename, '%s_%s.bb' % (recipename, recipever))
1364 url = 'http://downloads.yoctoproject.org/mirror/sources/i2c-tools-%s.tar.bz2' % recipever
1365 def add_recipe():
1366 result = runCmd('devtool add %s' % url)
1367 self.assertTrue(os.path.exists(recipefile), 'Expected recipe file not created')
1368 self.assertTrue(os.path.exists(os.path.join(self.workspacedir, 'sources', recipename)), 'Source directory not created')
1369 checkvars = {}
1370 checkvars['S'] = None
1371 checkvars['SRC_URI'] = url.replace(recipever, '${PV}')
1372 self._test_recipe_contents(recipefile, checkvars, [])
1373 add_recipe()
1374 # Now rename it - change both name and version
1375 newrecipename = 'mynewrecipe'
1376 newrecipever = '456'
1377 newrecipefile = os.path.join(self.workspacedir, 'recipes', newrecipename, '%s_%s.bb' % (newrecipename, newrecipever))
1378 result = runCmd('devtool rename %s %s -V %s' % (recipename, newrecipename, newrecipever))
1379 self.assertTrue(os.path.exists(newrecipefile), 'Recipe file not renamed')
1380 self.assertFalse(os.path.exists(os.path.join(self.workspacedir, 'recipes', recipename)), 'Old recipe directory still exists')
1381 newsrctree = os.path.join(self.workspacedir, 'sources', newrecipename)
1382 self.assertTrue(os.path.exists(newsrctree), 'Source directory not renamed')
1383 checkvars = {}
1384 checkvars['S'] = '${WORKDIR}/%s-%s' % (recipename, recipever)
1385 checkvars['SRC_URI'] = url
1386 self._test_recipe_contents(newrecipefile, checkvars, [])
1387 # Try again - change just name this time
1388 result = runCmd('devtool reset -n %s' % newrecipename)
1389 shutil.rmtree(newsrctree)
1390 add_recipe()
1391 newrecipefile = os.path.join(self.workspacedir, 'recipes', newrecipename, '%s_%s.bb' % (newrecipename, recipever))
1392 result = runCmd('devtool rename %s %s' % (recipename, newrecipename))
1393 self.assertTrue(os.path.exists(newrecipefile), 'Recipe file not renamed')
1394 self.assertFalse(os.path.exists(os.path.join(self.workspacedir, 'recipes', recipename)), 'Old recipe directory still exists')
1395 self.assertTrue(os.path.exists(os.path.join(self.workspacedir, 'sources', newrecipename)), 'Source directory not renamed')
1396 checkvars = {}
1397 checkvars['S'] = '${WORKDIR}/%s-${PV}' % recipename
1398 checkvars['SRC_URI'] = url.replace(recipever, '${PV}')
1399 self._test_recipe_contents(newrecipefile, checkvars, [])
1400 # Try again - change just version this time
1401 result = runCmd('devtool reset -n %s' % newrecipename)
1402 shutil.rmtree(newsrctree)
1403 add_recipe()
1404 newrecipefile = os.path.join(self.workspacedir, 'recipes', recipename, '%s_%s.bb' % (recipename, newrecipever))
1405 result = runCmd('devtool rename %s -V %s' % (recipename, newrecipever))
1406 self.assertTrue(os.path.exists(newrecipefile), 'Recipe file not renamed')
1407 self.assertTrue(os.path.exists(os.path.join(self.workspacedir, 'sources', recipename)), 'Source directory no longer exists')
1408 checkvars = {}
1409 checkvars['S'] = '${WORKDIR}/${BPN}-%s' % recipever
1410 checkvars['SRC_URI'] = url
1411 self._test_recipe_contents(newrecipefile, checkvars, [])