blob: ce7bba401d66d0ab89e2f254e49415003c5b3ff4 [file] [log] [blame]
Brad Bishopc342db32019-05-15 21:57:59 -04001#
2# SPDX-License-Identifier: MIT
3#
4
Brad Bishop316dfdd2018-06-25 12:45:53 -04005from oeqa.selftest.case import OESelftestTestCase
6from oeqa.sdk.utils.sdkbuildproject import SDKBuildProject
7from oeqa.utils.commands import bitbake, get_bb_vars, runCmd
Brad Bishop79641f22019-09-10 07:20:22 -04008from oeqa.core.decorator import OETestTag
Brad Bishop316dfdd2018-06-25 12:45:53 -04009import tempfile
10import shutil
11
Brad Bishop79641f22019-09-10 07:20:22 -040012@OETestTag("machine")
Brad Bishop316dfdd2018-06-25 12:45:53 -040013class MetaIDE(OESelftestTestCase):
14
15 @classmethod
16 def setUpClass(cls):
17 super(MetaIDE, cls).setUpClass()
18 bitbake('meta-ide-support')
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050019 bitbake('build-sysroots')
20 bb_vars = get_bb_vars(['MULTIMACH_TARGET_SYS', 'DEPLOY_DIR_IMAGE', 'COREBASE'])
Brad Bishop316dfdd2018-06-25 12:45:53 -040021 cls.environment_script = 'environment-setup-%s' % bb_vars['MULTIMACH_TARGET_SYS']
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050022 cls.deploydir = bb_vars['DEPLOY_DIR_IMAGE']
23 cls.environment_script_path = '%s/%s' % (cls.deploydir, cls.environment_script)
Brad Bishop316dfdd2018-06-25 12:45:53 -040024 cls.corebasedir = bb_vars['COREBASE']
25 cls.tmpdir_metaideQA = tempfile.mkdtemp(prefix='metaide')
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050026
Brad Bishop316dfdd2018-06-25 12:45:53 -040027 @classmethod
28 def tearDownClass(cls):
29 shutil.rmtree(cls.tmpdir_metaideQA, ignore_errors=True)
30 super(MetaIDE, cls).tearDownClass()
31
Brad Bishop316dfdd2018-06-25 12:45:53 -040032 def test_meta_ide_had_installed_meta_ide_support(self):
33 self.assertExists(self.environment_script_path)
34
Brad Bishop316dfdd2018-06-25 12:45:53 -040035 def test_meta_ide_can_compile_c_program(self):
36 runCmd('cp %s/test.c %s' % (self.tc.files_dir, self.tmpdir_metaideQA))
37 runCmd("cd %s; . %s; $CC test.c -lm" % (self.tmpdir_metaideQA, self.environment_script_path))
38 compiled_file = '%s/a.out' % self.tmpdir_metaideQA
39 self.assertExists(compiled_file)
40
Brad Bishop316dfdd2018-06-25 12:45:53 -040041 def test_meta_ide_can_build_cpio_project(self):
42 dl_dir = self.td.get('DL_DIR', None)
43 self.project = SDKBuildProject(self.tmpdir_metaideQA + "/cpio/", self.environment_script_path,
Andrew Geissler82c905d2020-04-13 13:39:40 -050044 "https://ftp.gnu.org/gnu/cpio/cpio-2.13.tar.gz",
Brad Bishop316dfdd2018-06-25 12:45:53 -040045 self.tmpdir_metaideQA, self.td['DATETIME'], dl_dir=dl_dir)
46 self.project.download_archive()
Andrew Geisslerc9f78652020-09-18 14:11:35 -050047 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 -040048 msg="Running configure failed")
49 self.assertEqual(self.project.run_make(), 0,
50 msg="Running make failed")
51 self.assertEqual(self.project.run_install(), 0,
52 msg="Running make install failed")
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050053
54 def test_meta_ide_can_run_sdk_tests(self):
55 bitbake('-c populate_sysroot gtk+3')
56 bitbake('build-sysroots')
57 bitbake('-c testsdk meta-ide-support')