Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 1 | # |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 2 | # Copyright OpenEmbedded Contributors |
| 3 | # |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 4 | # SPDX-License-Identifier: MIT |
| 5 | # |
| 6 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 7 | from oeqa.selftest.case import OESelftestTestCase |
| 8 | from oeqa.sdk.utils.sdkbuildproject import SDKBuildProject |
| 9 | from oeqa.utils.commands import bitbake, get_bb_vars, runCmd |
Brad Bishop | 79641f2 | 2019-09-10 07:20:22 -0400 | [diff] [blame] | 10 | from oeqa.core.decorator import OETestTag |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 11 | import tempfile |
| 12 | import shutil |
| 13 | |
Brad Bishop | 79641f2 | 2019-09-10 07:20:22 -0400 | [diff] [blame] | 14 | @OETestTag("machine") |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 15 | class MetaIDE(OESelftestTestCase): |
| 16 | |
| 17 | @classmethod |
| 18 | def setUpClass(cls): |
| 19 | super(MetaIDE, cls).setUpClass() |
| 20 | bitbake('meta-ide-support') |
Patrick Williams | db4c27e | 2022-08-05 08:10:29 -0500 | [diff] [blame] | 21 | bitbake('build-sysroots') |
| 22 | bb_vars = get_bb_vars(['MULTIMACH_TARGET_SYS', 'DEPLOY_DIR_IMAGE', 'COREBASE']) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 23 | cls.environment_script = 'environment-setup-%s' % bb_vars['MULTIMACH_TARGET_SYS'] |
Patrick Williams | db4c27e | 2022-08-05 08:10:29 -0500 | [diff] [blame] | 24 | cls.deploydir = bb_vars['DEPLOY_DIR_IMAGE'] |
| 25 | cls.environment_script_path = '%s/%s' % (cls.deploydir, cls.environment_script) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 26 | cls.corebasedir = bb_vars['COREBASE'] |
| 27 | cls.tmpdir_metaideQA = tempfile.mkdtemp(prefix='metaide') |
Patrick Williams | db4c27e | 2022-08-05 08:10:29 -0500 | [diff] [blame] | 28 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 29 | @classmethod |
| 30 | def tearDownClass(cls): |
| 31 | shutil.rmtree(cls.tmpdir_metaideQA, ignore_errors=True) |
| 32 | super(MetaIDE, cls).tearDownClass() |
| 33 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 34 | def test_meta_ide_had_installed_meta_ide_support(self): |
| 35 | self.assertExists(self.environment_script_path) |
| 36 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 37 | 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 Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 43 | 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 Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 46 | "https://ftp.gnu.org/gnu/cpio/cpio-2.13.tar.gz", |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 47 | self.tmpdir_metaideQA, self.td['DATETIME'], dl_dir=dl_dir) |
| 48 | self.project.download_archive() |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 49 | self.assertEqual(self.project.run_configure('$CONFIGURE_FLAGS --disable-maintainer-mode','sed -i -e "/char \*program_name/d" src/global.c;'), 0, |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 50 | 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 Williams | db4c27e | 2022-08-05 08:10:29 -0500 | [diff] [blame] | 55 | |
| 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') |