diff options
author | Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> | 2015-09-30 05:38:36 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-10-01 07:43:39 +0100 |
commit | 979de7703cf3e468aa2923da1445138e1c93d234 (patch) | |
tree | fe76d5c7396476fe2e8caa7ec86ab1e79dd5687c /meta-yocto-bsp/lib | |
parent | e20d8b84b30c8c16a008666e7259a79bf99ab3d9 (diff) | |
download | poky-979de7703cf3e468aa2923da1445138e1c93d234.tar.gz |
lib/oeqa/selftest/yoctobsp: Basic tests for yocto-bsp script
Unit tests include listing properties and creating BSP using the default kernel,
both tests done for supported architectures. Test can be manually executed with:
$ oe-selftest --run-tests yoctobsp.YoctoBSP
(From meta-yocto rev: e84fb6fe8219f874b0157bdf53489bbb5f7f81cb)
Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta-yocto-bsp/lib')
-rw-r--r-- | meta-yocto-bsp/lib/oeqa/yoctobsp.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/meta-yocto-bsp/lib/oeqa/yoctobsp.py b/meta-yocto-bsp/lib/oeqa/yoctobsp.py new file mode 100644 index 0000000000..4c539a1f3f --- /dev/null +++ b/meta-yocto-bsp/lib/oeqa/yoctobsp.py | |||
@@ -0,0 +1,39 @@ | |||
1 | import unittest | ||
2 | import os | ||
3 | import logging | ||
4 | import tempfile | ||
5 | import shutil | ||
6 | |||
7 | from oeqa.selftest.base import oeSelfTest | ||
8 | from oeqa.utils.commands import runCmd | ||
9 | from oeqa.utils.decorators import skipUnlessPassed | ||
10 | |||
11 | class YoctoBSP(oeSelfTest): | ||
12 | |||
13 | @classmethod | ||
14 | def setUpClass(self): | ||
15 | result = runCmd("yocto-bsp list karch") | ||
16 | self.karchs = [karch.lstrip() for karch in result.output.splitlines()][1:] | ||
17 | |||
18 | def test_yoctobsp_listproperties(self): | ||
19 | for karch in self.karchs: | ||
20 | result = runCmd("yocto-bsp list %s properties" % karch) | ||
21 | self.assertEqual(0, result.status, msg="Properties from %s architecture could not be listed" % karch) | ||
22 | |||
23 | def test_yoctobsp_create(self): | ||
24 | # Generate a temporal file and folders for each karch | ||
25 | json = "{\"use_default_kernel\":\"yes\"}\n" | ||
26 | fd = tempfile.NamedTemporaryFile(delete=False) | ||
27 | fd.write(json) | ||
28 | fd.close() | ||
29 | tmpfolders = dict([(karch, tempfile.mkdtemp()) for karch in self.karchs]) | ||
30 | # Create BSP | ||
31 | for karch in self.karchs: | ||
32 | result = runCmd("yocto-bsp create test %s -o %s -i %s" % (karch, "%s/unitest" % tmpfolders[karch], fd.name)) | ||
33 | self.assertEqual(0, result.status, msg="Could not create a BSP with architecture %s using %s " % (karch, fd.name)) | ||
34 | # Remove tmp file/folders | ||
35 | os.unlink(fd.name) | ||
36 | self.assertFalse(os.path.exists(fd.name), msg = "Temporal file %s could not be removed" % fd.name) | ||
37 | for tree in tmpfolders.values(): | ||
38 | shutil.rmtree(tree) | ||
39 | self.assertFalse(os.path.exists(tree), msg = "Temporal folder %s could not be removed" % tree) | ||