diff options
author | Yeoh Ee Peng <ee.peng.yeoh@intel.com> | 2018-02-07 16:01:04 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-02-15 11:23:11 +0000 |
commit | 3f6eb216ef7fb35ab0bc3086548b904c452096c2 (patch) | |
tree | dd66680c87475e26a92a8eb589bb1ea34d43ad96 | |
parent | 2d9d05f2fdd42e35e3e4d6efecf95f874e7e662d (diff) | |
download | poky-3f6eb216ef7fb35ab0bc3086548b904c452096c2.tar.gz |
oe-selftest: meta_ide: add tests for meta-ide-support
QA team were testing meta-ide-support manually. Add automated
tests to test that bibtake meta-ide-support will create the
toolchain and environment setup script. Also test that after
using environment setup script, one can compile c program
and build cpio project.
(From OE-Core rev: db40eba68f51d02677526dfa4bc21343d9c27958)
Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/lib/oeqa/selftest/cases/meta_ide.py | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/meta_ide.py b/meta/lib/oeqa/selftest/cases/meta_ide.py new file mode 100644 index 0000000000..5df9d3ed93 --- /dev/null +++ b/meta/lib/oeqa/selftest/cases/meta_ide.py | |||
@@ -0,0 +1,49 @@ | |||
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") | ||