Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1 | from oeqa.selftest.case import OESelftestTestCase |
| 2 | from oeqa.sdk.utils.sdkbuildproject import SDKBuildProject |
| 3 | from oeqa.utils.commands import bitbake, get_bb_vars, runCmd |
| 4 | from oeqa.core.decorator.oeid import OETestID |
| 5 | import tempfile |
| 6 | import shutil |
| 7 | |
| 8 | class MetaIDE(OESelftestTestCase): |
| 9 | |
| 10 | @classmethod |
| 11 | def setUpClass(cls): |
| 12 | super(MetaIDE, cls).setUpClass() |
| 13 | bitbake('meta-ide-support') |
| 14 | bb_vars = get_bb_vars(['MULTIMACH_TARGET_SYS', 'TMPDIR', 'COREBASE']) |
| 15 | cls.environment_script = 'environment-setup-%s' % bb_vars['MULTIMACH_TARGET_SYS'] |
| 16 | cls.tmpdir = bb_vars['TMPDIR'] |
| 17 | cls.environment_script_path = '%s/%s' % (cls.tmpdir, cls.environment_script) |
| 18 | cls.corebasedir = bb_vars['COREBASE'] |
| 19 | cls.tmpdir_metaideQA = tempfile.mkdtemp(prefix='metaide') |
| 20 | |
| 21 | @classmethod |
| 22 | def tearDownClass(cls): |
| 23 | shutil.rmtree(cls.tmpdir_metaideQA, ignore_errors=True) |
| 24 | super(MetaIDE, cls).tearDownClass() |
| 25 | |
| 26 | @OETestID(1982) |
| 27 | def test_meta_ide_had_installed_meta_ide_support(self): |
| 28 | self.assertExists(self.environment_script_path) |
| 29 | |
| 30 | @OETestID(1983) |
| 31 | def test_meta_ide_can_compile_c_program(self): |
| 32 | runCmd('cp %s/test.c %s' % (self.tc.files_dir, self.tmpdir_metaideQA)) |
| 33 | runCmd("cd %s; . %s; $CC test.c -lm" % (self.tmpdir_metaideQA, self.environment_script_path)) |
| 34 | compiled_file = '%s/a.out' % self.tmpdir_metaideQA |
| 35 | self.assertExists(compiled_file) |
| 36 | |
| 37 | @OETestID(1984) |
| 38 | def test_meta_ide_can_build_cpio_project(self): |
| 39 | dl_dir = self.td.get('DL_DIR', None) |
| 40 | self.project = SDKBuildProject(self.tmpdir_metaideQA + "/cpio/", self.environment_script_path, |
| 41 | "https://ftp.gnu.org/gnu/cpio/cpio-2.12.tar.gz", |
| 42 | self.tmpdir_metaideQA, self.td['DATETIME'], dl_dir=dl_dir) |
| 43 | self.project.download_archive() |
| 44 | self.assertEqual(self.project.run_configure(), 0, |
| 45 | msg="Running configure failed") |
| 46 | self.assertEqual(self.project.run_make(), 0, |
| 47 | msg="Running make failed") |
| 48 | self.assertEqual(self.project.run_install(), 0, |
| 49 | msg="Running make install failed") |