summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/cases/recipetool.py
diff options
context:
space:
mode:
authorStefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>2021-12-08 11:18:38 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-12-09 10:33:25 +0000
commit796ca60fa98b864d77aba663ac13e731e945a53f (patch)
tree977b51aa3a3eabbbcc635cade8cbfa238a09710b /meta/lib/oeqa/selftest/cases/recipetool.py
parent5b54a2602dd9075ef5949fd914a487cb5845a2ac (diff)
downloadpoky-796ca60fa98b864d77aba663ac13e731e945a53f.tar.gz
selftest/recipetool: Add tests for branch parameter and srcbranch option
The recipetool support two ways to pass a branch and fallback to master if no branch is defined. Add tests for default branch, branch parameter and srcbranch option. (From OE-Core rev: f232cffc09e917458d6e850b4aca4f87b53b43e4) Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/recipetool.py')
-rw-r--r--meta/lib/oeqa/selftest/cases/recipetool.py38
1 files changed, 27 insertions, 11 deletions
diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py
index c30a0eb016..439e41597c 100644
--- a/meta/lib/oeqa/selftest/cases/recipetool.py
+++ b/meta/lib/oeqa/selftest/cases/recipetool.py
@@ -350,7 +350,7 @@ class RecipetoolCreateTests(RecipetoolBase):
350 checkvars['SRC_URI[sha256sum]'] = '2e6a401cac9024db2288297e3be1a8ab60e7401ba8e91225218aaf4a27e82a07' 350 checkvars['SRC_URI[sha256sum]'] = '2e6a401cac9024db2288297e3be1a8ab60e7401ba8e91225218aaf4a27e82a07'
351 self._test_recipe_contents(recipefile, checkvars, []) 351 self._test_recipe_contents(recipefile, checkvars, [])
352 352
353 def test_recipetool_create_git(self): 353 def test_recipetool_create_autotools(self):
354 if 'x11' not in get_bb_var('DISTRO_FEATURES'): 354 if 'x11' not in get_bb_var('DISTRO_FEATURES'):
355 self.skipTest('Test requires x11 as distro feature') 355 self.skipTest('Test requires x11 as distro feature')
356 # Ensure we have the right data in shlibs/pkgdata 356 # Ensure we have the right data in shlibs/pkgdata
@@ -359,7 +359,7 @@ class RecipetoolCreateTests(RecipetoolBase):
359 tempsrc = os.path.join(self.tempdir, 'srctree') 359 tempsrc = os.path.join(self.tempdir, 'srctree')
360 os.makedirs(tempsrc) 360 os.makedirs(tempsrc)
361 recipefile = os.path.join(self.tempdir, 'libmatchbox.bb') 361 recipefile = os.path.join(self.tempdir, 'libmatchbox.bb')
362 srcuri = 'git://git.yoctoproject.org/libmatchbox;branch=master' 362 srcuri = 'git://git.yoctoproject.org/libmatchbox'
363 result = runCmd(['recipetool', 'create', '-o', recipefile, srcuri + ";rev=9f7cf8895ae2d39c465c04cc78e918c157420269", '-x', tempsrc]) 363 result = runCmd(['recipetool', 'create', '-o', recipefile, srcuri + ";rev=9f7cf8895ae2d39c465c04cc78e918c157420269", '-x', tempsrc])
364 self.assertTrue(os.path.isfile(recipefile), 'recipetool did not create recipe file; output:\n%s' % result.output) 364 self.assertTrue(os.path.isfile(recipefile), 'recipetool did not create recipe file; output:\n%s' % result.output)
365 checkvars = {} 365 checkvars = {}
@@ -367,7 +367,7 @@ class RecipetoolCreateTests(RecipetoolBase):
367 checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=7fbc338309ac38fefcd64b04bb903e34' 367 checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=7fbc338309ac38fefcd64b04bb903e34'
368 checkvars['S'] = '${WORKDIR}/git' 368 checkvars['S'] = '${WORKDIR}/git'
369 checkvars['PV'] = '1.11+git${SRCPV}' 369 checkvars['PV'] = '1.11+git${SRCPV}'
370 checkvars['SRC_URI'] = srcuri 370 checkvars['SRC_URI'] = srcuri + ';branch=master'
371 checkvars['DEPENDS'] = set(['libcheck', 'libjpeg-turbo', 'libpng', 'libx11', 'libxext', 'pango']) 371 checkvars['DEPENDS'] = set(['libcheck', 'libjpeg-turbo', 'libpng', 'libx11', 'libxext', 'pango'])
372 inherits = ['autotools', 'pkgconfig'] 372 inherits = ['autotools', 'pkgconfig']
373 self._test_recipe_contents(recipefile, checkvars, inherits) 373 self._test_recipe_contents(recipefile, checkvars, inherits)
@@ -506,19 +506,35 @@ class RecipetoolCreateTests(RecipetoolBase):
506 inherits = ['setuptools3'] 506 inherits = ['setuptools3']
507 self._test_recipe_contents(recipefile, checkvars, inherits) 507 self._test_recipe_contents(recipefile, checkvars, inherits)
508 508
509 def test_recipetool_create_git_http(self): 509 def _test_recipetool_create_git(self, srcuri, branch=None):
510 # Basic test to check http git URL mangling works 510 # Basic test to check http git URL mangling works
511 temprecipe = os.path.join(self.tempdir, 'recipe') 511 temprecipe = os.path.join(self.tempdir, 'recipe')
512 os.makedirs(temprecipe) 512 os.makedirs(temprecipe)
513 recipefile = os.path.join(temprecipe, 'matchbox-terminal_git.bb') 513 name = srcuri.split(';')[0].split('/')[-1]
514 srcuri = 'http://git.yoctoproject.org/git/matchbox-terminal' 514 recipefile = os.path.join(temprecipe, name + '_git.bb')
515 result = runCmd('recipetool create -o %s %s' % (temprecipe, srcuri)) 515 options = ' -B %s' % branch if branch else ''
516 result = runCmd('recipetool create -o %s%s "%s"' % (temprecipe, options, srcuri))
516 self.assertTrue(os.path.isfile(recipefile)) 517 self.assertTrue(os.path.isfile(recipefile))
517 checkvars = {} 518 checkvars = {}
518 checkvars['LICENSE'] = set(['GPLv2']) 519 checkvars['SRC_URI'] = srcuri
519 checkvars['SRC_URI'] = 'git://git.yoctoproject.org/git/matchbox-terminal;protocol=http;branch=master' 520 for scheme in ['http', 'https']:
520 inherits = ['pkgconfig', 'autotools'] 521 if srcuri.startswith(scheme + ":"):
521 self._test_recipe_contents(recipefile, checkvars, inherits) 522 checkvars['SRC_URI'] = 'git%s;protocol=%s' % (srcuri[len(scheme):], scheme)
523 if ';branch=' not in srcuri:
524 checkvars['SRC_URI'] += ';branch=' + (branch or 'master')
525 self._test_recipe_contents(recipefile, checkvars, [])
526
527 def test_recipetool_create_git_http(self):
528 self._test_recipetool_create_git('http://git.yoctoproject.org/git/matchbox-keyboard')
529
530 def test_recipetool_create_git_srcuri_master(self):
531 self._test_recipetool_create_git('git://git.yoctoproject.org/matchbox-keyboard;branch=master')
532
533 def test_recipetool_create_git_srcuri_branch(self):
534 self._test_recipetool_create_git('git://git.yoctoproject.org/matchbox-keyboard;branch=matchbox-keyboard-0-1')
535
536 def test_recipetool_create_git_srcbranch(self):
537 self._test_recipetool_create_git('git://git.yoctoproject.org/matchbox-keyboard', 'matchbox-keyboard-0-1')
522 538
523 539
524class RecipetoolTests(RecipetoolBase): 540class RecipetoolTests(RecipetoolBase):