diff options
author | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-12-17 04:11:34 +0300 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2019-01-09 02:21:44 +0300 |
commit | 1a4b7ee28bf7413af6513fb45ad0d0736048f866 (patch) | |
tree | 79f6d8ea698cab8f2eaf4f54b793d2ca7a1451ce /poky/meta/lib/oeqa/selftest/cases/devtool.py | |
parent | 5b9ede0403237c7dace972affa65cf64a1aadd0e (diff) | |
download | openbmc-1a4b7ee28bf7413af6513fb45ad0d0736048f866.tar.xz |
reset upstream subtrees to yocto 2.6
Reset the following subtrees on thud HEAD:
poky: 87e3a9739d
meta-openembedded: 6094ae18c8
meta-security: 31dc4e7532
meta-raspberrypi: a48743dc36
meta-xilinx: c42016e2e6
Also re-apply backports that didn't make it into thud:
poky:
17726d0 systemd-systemctl-native: handle Install wildcards
meta-openembedded:
4321a5d libtinyxml2: update to 7.0.1
042f0a3 libcereal: Add native and nativesdk classes
e23284f libcereal: Allow empty package
030e8d4 rsyslog: curl-less build with fmhttp PACKAGECONFIG
179a1b9 gtest: update to 1.8.1
Squashed OpenBMC subtree compatibility updates:
meta-aspeed:
Brad Bishop (1):
aspeed: add yocto 2.6 compatibility
meta-ibm:
Brad Bishop (1):
ibm: prepare for yocto 2.6
meta-ingrasys:
Brad Bishop (1):
ingrasys: set layer compatibility to yocto 2.6
meta-openpower:
Brad Bishop (1):
openpower: set layer compatibility to yocto 2.6
meta-phosphor:
Brad Bishop (3):
phosphor: set layer compatibility to thud
phosphor: libgpg-error: drop patches
phosphor: react to fitimage artifact rename
Ed Tanous (4):
Dropbear: upgrade options for latest upgrade
yocto2.6: update openssl options
busybox: remove upstream watchdog patch
systemd: Rebase CONFIG_CGROUP_BPF patch
Change-Id: I7b1fe71cca880d0372a82d94b5fd785323e3a9e7
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'poky/meta/lib/oeqa/selftest/cases/devtool.py')
-rw-r--r-- | poky/meta/lib/oeqa/selftest/cases/devtool.py | 180 |
1 files changed, 127 insertions, 53 deletions
diff --git a/poky/meta/lib/oeqa/selftest/cases/devtool.py b/poky/meta/lib/oeqa/selftest/cases/devtool.py index d5b6a46d49..9eb9badf84 100644 --- a/poky/meta/lib/oeqa/selftest/cases/devtool.py +++ b/poky/meta/lib/oeqa/selftest/cases/devtool.py @@ -11,9 +11,124 @@ from oeqa.utils.commands import runCmd, bitbake, get_bb_var, create_temp_layer from oeqa.utils.commands import get_bb_vars, runqemu, get_test_layer from oeqa.core.decorator.oeid import OETestID +oldmetapath = None + +def setUpModule(): + import bb.utils + + global templayerdir + templayerdir = tempfile.mkdtemp(prefix='devtoolqa') + corecopydir = os.path.join(templayerdir, 'core-copy') + bblayers_conf = os.path.join(os.environ['BUILDDIR'], 'conf', 'bblayers.conf') + edited_layers = [] + + # We need to take a copy of the meta layer so we can modify it and not + # have any races against other tests that might be running in parallel + # however things like COREBASE mean that you can't just copy meta, you + # need the whole repository. + def bblayers_edit_cb(layerpath, canonical_layerpath): + global oldmetapath + if not canonical_layerpath.endswith('/'): + # This helps us match exactly when we're using this path later + canonical_layerpath += '/' + if not edited_layers and canonical_layerpath.endswith('/meta/'): + canonical_layerpath = os.path.realpath(canonical_layerpath) + '/' + edited_layers.append(layerpath) + oldmetapath = os.path.realpath(layerpath) + result = runCmd('git rev-parse --show-toplevel', cwd=canonical_layerpath) + oldreporoot = result.output.rstrip() + newmetapath = os.path.join(corecopydir, os.path.relpath(oldmetapath, oldreporoot)) + runCmd('git clone %s %s' % (oldreporoot, corecopydir), cwd=templayerdir) + # Now we need to copy any modified files + # You might ask "why not just copy the entire tree instead of + # cloning and doing this?" - well, the problem with that is + # TMPDIR or an equally large subdirectory might exist + # under COREBASE and we don't want to copy that, so we have + # to be selective. + result = runCmd('git status --porcelain', cwd=oldreporoot) + for line in result.output.splitlines(): + if line.startswith(' M ') or line.startswith('?? '): + relpth = line.split()[1] + pth = os.path.join(oldreporoot, relpth) + if pth.startswith(canonical_layerpath): + if relpth.endswith('/'): + destdir = os.path.join(corecopydir, relpth) + shutil.copytree(pth, destdir) + else: + destdir = os.path.join(corecopydir, os.path.dirname(relpth)) + bb.utils.mkdirhier(destdir) + shutil.copy2(pth, destdir) + return newmetapath + else: + return layerpath + bb.utils.edit_bblayers_conf(bblayers_conf, None, None, bblayers_edit_cb) + +def tearDownModule(): + if oldmetapath: + edited_layers = [] + def bblayers_edit_cb(layerpath, canonical_layerpath): + if not edited_layers and canonical_layerpath.endswith('/meta'): + edited_layers.append(layerpath) + return oldmetapath + else: + return layerpath + bblayers_conf = os.path.join(os.environ['BUILDDIR'], 'conf', 'bblayers.conf') + bb.utils.edit_bblayers_conf(bblayers_conf, None, None, bblayers_edit_cb) + shutil.rmtree(templayerdir) + class DevtoolBase(OESelftestTestCase): - buffer = True + @classmethod + def setUpClass(cls): + super(DevtoolBase, cls).setUpClass() + bb_vars = get_bb_vars(['TOPDIR', 'SSTATE_DIR']) + cls.original_sstate = bb_vars['SSTATE_DIR'] + cls.devtool_sstate = os.path.join(bb_vars['TOPDIR'], 'sstate_devtool') + cls.sstate_conf = 'SSTATE_DIR = "%s"\n' % cls.devtool_sstate + cls.sstate_conf += ('SSTATE_MIRRORS += "file://.* file:///%s/PATH"\n' + % cls.original_sstate) + + @classmethod + def tearDownClass(cls): + cls.logger.debug('Deleting devtool sstate cache on %s' % cls.devtool_sstate) + runCmd('rm -rf %s' % cls.devtool_sstate) + super(DevtoolBase, cls).tearDownClass() + + def setUp(self): + """Test case setup function""" + super(DevtoolBase, self).setUp() + self.workspacedir = os.path.join(self.builddir, 'workspace') + self.assertTrue(not os.path.exists(self.workspacedir), + 'This test cannot be run with a workspace directory ' + 'under the build directory') + self.append_config(self.sstate_conf) + + def _check_src_repo(self, repo_dir): + """Check srctree git repository""" + self.assertTrue(os.path.isdir(os.path.join(repo_dir, '.git')), + 'git repository for external source tree not found') + result = runCmd('git status --porcelain', cwd=repo_dir) + self.assertEqual(result.output.strip(), "", + 'Created git repo is not clean') + result = runCmd('git symbolic-ref HEAD', cwd=repo_dir) + self.assertEqual(result.output.strip(), "refs/heads/devtool", + 'Wrong branch in git repo') + + def _check_repo_status(self, repo_dir, expected_status): + """Check the worktree status of a repository""" + result = runCmd('git status . --porcelain', + cwd=repo_dir) + for line in result.output.splitlines(): + for ind, (f_status, fn_re) in enumerate(expected_status): + if re.match(fn_re, line[3:]): + if f_status != line[:2]: + self.fail('Unexpected status in line: %s' % line) + expected_status.pop(ind) + break + else: + self.fail('Unexpected modified file in line: %s' % line) + if expected_status: + self.fail('Missing file changes: %s' % expected_status) def _test_recipe_contents(self, recipefile, checkvars, checkinherits): with open(recipefile, 'r') as f: @@ -118,58 +233,6 @@ class DevtoolBase(OESelftestTestCase): class DevtoolTests(DevtoolBase): - @classmethod - def setUpClass(cls): - super(DevtoolTests, cls).setUpClass() - bb_vars = get_bb_vars(['TOPDIR', 'SSTATE_DIR']) - cls.original_sstate = bb_vars['SSTATE_DIR'] - cls.devtool_sstate = os.path.join(bb_vars['TOPDIR'], 'sstate_devtool') - cls.sstate_conf = 'SSTATE_DIR = "%s"\n' % cls.devtool_sstate - cls.sstate_conf += ('SSTATE_MIRRORS += "file://.* file:///%s/PATH"\n' - % cls.original_sstate) - - @classmethod - def tearDownClass(cls): - cls.logger.debug('Deleting devtool sstate cache on %s' % cls.devtool_sstate) - runCmd('rm -rf %s' % cls.devtool_sstate) - super(DevtoolTests, cls).tearDownClass() - - def setUp(self): - """Test case setup function""" - super(DevtoolTests, self).setUp() - self.workspacedir = os.path.join(self.builddir, 'workspace') - self.assertTrue(not os.path.exists(self.workspacedir), - 'This test cannot be run with a workspace directory ' - 'under the build directory') - self.append_config(self.sstate_conf) - - def _check_src_repo(self, repo_dir): - """Check srctree git repository""" - self.assertTrue(os.path.isdir(os.path.join(repo_dir, '.git')), - 'git repository for external source tree not found') - result = runCmd('git status --porcelain', cwd=repo_dir) - self.assertEqual(result.output.strip(), "", - 'Created git repo is not clean') - result = runCmd('git symbolic-ref HEAD', cwd=repo_dir) - self.assertEqual(result.output.strip(), "refs/heads/devtool", - 'Wrong branch in git repo') - - def _check_repo_status(self, repo_dir, expected_status): - """Check the worktree status of a repository""" - result = runCmd('git status . --porcelain', - cwd=repo_dir) - for line in result.output.splitlines(): - for ind, (f_status, fn_re) in enumerate(expected_status): - if re.match(fn_re, line[3:]): - if f_status != line[:2]: - self.fail('Unexpected status in line: %s' % line) - expected_status.pop(ind) - break - else: - self.fail('Unexpected modified file in line: %s' % line) - if expected_status: - self.fail('Missing file changes: %s' % expected_status) - @OETestID(1158) def test_create_workspace(self): # Check preconditions @@ -191,6 +254,8 @@ class DevtoolTests(DevtoolBase): self.assertNotIn(tempdir, result.output) self.assertIn(self.workspacedir, result.output) +class DevtoolAddTests(DevtoolBase): + @OETestID(1159) def test_devtool_add(self): # Fetch source @@ -235,6 +300,8 @@ class DevtoolTests(DevtoolBase): @OETestID(1423) def test_devtool_add_git_local(self): + # We need dbus built so that DEPENDS recognition works + bitbake('dbus') # Fetch source from a remote URL, but do it outside of devtool tempdir = tempfile.mkdtemp(prefix='devtoolqa') self.track_for_cleanup(tempdir) @@ -444,6 +511,8 @@ class DevtoolTests(DevtoolBase): checkvars['SRC_URI'] = url.replace(testver, '${PV}') self._test_recipe_contents(recipefile, checkvars, []) +class DevtoolModifyTests(DevtoolBase): + @OETestID(1164) def test_devtool_modify(self): import oe.path @@ -689,6 +758,7 @@ class DevtoolTests(DevtoolBase): self._check_src_repo(tempdir) # This is probably sufficient +class DevtoolUpdateTests(DevtoolBase): @OETestID(1169) def test_devtool_update_recipe(self): @@ -1105,6 +1175,8 @@ class DevtoolTests(DevtoolBase): expected_status = [] self._check_repo_status(os.path.dirname(recipefile), expected_status) +class DevtoolExtractTests(DevtoolBase): + @OETestID(1163) def test_devtool_extract(self): tempdir = tempfile.mkdtemp(prefix='devtoolqa') @@ -1274,6 +1346,8 @@ class DevtoolTests(DevtoolBase): if reqpkgs: self.fail('The following packages were not present in the image as expected: %s' % ', '.join(reqpkgs)) +class DevtoolUpgradeTests(DevtoolBase): + @OETestID(1367) def test_devtool_upgrade(self): # Check preconditions |