blob: bae98359e544ea61460b688e44e19664c9e4a562 [file] [log] [blame]
Brad Bishopc342db32019-05-15 21:57:59 -04001#
Patrick Williams92b42cb2022-09-03 06:53:57 -05002# Copyright OpenEmbedded Contributors
3#
Brad Bishopc342db32019-05-15 21:57:59 -04004# SPDX-License-Identifier: MIT
5#
6
Brad Bishop316dfdd2018-06-25 12:45:53 -04007from oeqa.selftest.case import OESelftestTestCase
8from oeqa.sdk.utils.sdkbuildproject import SDKBuildProject
9from oeqa.utils.commands import bitbake, get_bb_vars, runCmd
Brad Bishop79641f22019-09-10 07:20:22 -040010from oeqa.core.decorator import OETestTag
Brad Bishop316dfdd2018-06-25 12:45:53 -040011import tempfile
12import shutil
13
Brad Bishop79641f22019-09-10 07:20:22 -040014@OETestTag("machine")
Brad Bishop316dfdd2018-06-25 12:45:53 -040015class MetaIDE(OESelftestTestCase):
16
17 @classmethod
18 def setUpClass(cls):
19 super(MetaIDE, cls).setUpClass()
20 bitbake('meta-ide-support')
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050021 bitbake('build-sysroots')
22 bb_vars = get_bb_vars(['MULTIMACH_TARGET_SYS', 'DEPLOY_DIR_IMAGE', 'COREBASE'])
Brad Bishop316dfdd2018-06-25 12:45:53 -040023 cls.environment_script = 'environment-setup-%s' % bb_vars['MULTIMACH_TARGET_SYS']
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050024 cls.deploydir = bb_vars['DEPLOY_DIR_IMAGE']
25 cls.environment_script_path = '%s/%s' % (cls.deploydir, cls.environment_script)
Brad Bishop316dfdd2018-06-25 12:45:53 -040026 cls.corebasedir = bb_vars['COREBASE']
27 cls.tmpdir_metaideQA = tempfile.mkdtemp(prefix='metaide')
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050028
Brad Bishop316dfdd2018-06-25 12:45:53 -040029 @classmethod
30 def tearDownClass(cls):
31 shutil.rmtree(cls.tmpdir_metaideQA, ignore_errors=True)
32 super(MetaIDE, cls).tearDownClass()
33
Brad Bishop316dfdd2018-06-25 12:45:53 -040034 def test_meta_ide_had_installed_meta_ide_support(self):
35 self.assertExists(self.environment_script_path)
36
Brad Bishop316dfdd2018-06-25 12:45:53 -040037 def test_meta_ide_can_compile_c_program(self):
38 runCmd('cp %s/test.c %s' % (self.tc.files_dir, self.tmpdir_metaideQA))
39 runCmd("cd %s; . %s; $CC test.c -lm" % (self.tmpdir_metaideQA, self.environment_script_path))
40 compiled_file = '%s/a.out' % self.tmpdir_metaideQA
41 self.assertExists(compiled_file)
42
Brad Bishop316dfdd2018-06-25 12:45:53 -040043 def test_meta_ide_can_build_cpio_project(self):
44 dl_dir = self.td.get('DL_DIR', None)
45 self.project = SDKBuildProject(self.tmpdir_metaideQA + "/cpio/", self.environment_script_path,
Andrew Geissler82c905d2020-04-13 13:39:40 -050046 "https://ftp.gnu.org/gnu/cpio/cpio-2.13.tar.gz",
Brad Bishop316dfdd2018-06-25 12:45:53 -040047 self.tmpdir_metaideQA, self.td['DATETIME'], dl_dir=dl_dir)
48 self.project.download_archive()
Andrew Geisslerc9f78652020-09-18 14:11:35 -050049 self.assertEqual(self.project.run_configure('$CONFIGURE_FLAGS --disable-maintainer-mode','sed -i -e "/char \*program_name/d" src/global.c;'), 0,
Brad Bishop316dfdd2018-06-25 12:45:53 -040050 msg="Running configure failed")
51 self.assertEqual(self.project.run_make(), 0,
52 msg="Running make failed")
53 self.assertEqual(self.project.run_install(), 0,
54 msg="Running make install failed")
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050055
56 def test_meta_ide_can_run_sdk_tests(self):
57 bitbake('-c populate_sysroot gtk+3')
58 bitbake('build-sysroots')
59 bitbake('-c testsdk meta-ide-support')