[OE-core] [PATCH 5/5] lib/oeqa/selftest/yoctobsp: Basic tests for yocto-bsp script
leonardo.sandoval.gonzalez at linux.intel.com
leonardo.sandoval.gonzalez at linux.intel.com
Wed Sep 30 05:38:36 UTC 2015
From: Leonardo Sandoval <leonardo.sandoval.gonzalez at linux.intel.com>
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
Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez at linux.intel.com>
---
meta/lib/oeqa/selftest/yoctobsp.py | 39 ++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
create mode 100644 meta/lib/oeqa/selftest/yoctobsp.py
diff --git a/meta/lib/oeqa/selftest/yoctobsp.py b/meta/lib/oeqa/selftest/yoctobsp.py
new file mode 100644
index 0000000..4c539a1
--- /dev/null
+++ b/meta/lib/oeqa/selftest/yoctobsp.py
@@ -0,0 +1,39 @@
+import unittest
+import os
+import logging
+import tempfile
+import shutil
+
+from oeqa.selftest.base import oeSelfTest
+from oeqa.utils.commands import runCmd
+from oeqa.utils.decorators import skipUnlessPassed
+
+class YoctoBSP(oeSelfTest):
+
+ @classmethod
+ def setUpClass(self):
+ result = runCmd("yocto-bsp list karch")
+ self.karchs = [karch.lstrip() for karch in result.output.splitlines()][1:]
+
+ def test_yoctobsp_listproperties(self):
+ for karch in self.karchs:
+ result = runCmd("yocto-bsp list %s properties" % karch)
+ self.assertEqual(0, result.status, msg="Properties from %s architecture could not be listed" % karch)
+
+ def test_yoctobsp_create(self):
+ # Generate a temporal file and folders for each karch
+ json = "{\"use_default_kernel\":\"yes\"}\n"
+ fd = tempfile.NamedTemporaryFile(delete=False)
+ fd.write(json)
+ fd.close()
+ tmpfolders = dict([(karch, tempfile.mkdtemp()) for karch in self.karchs])
+ # Create BSP
+ for karch in self.karchs:
+ result = runCmd("yocto-bsp create test %s -o %s -i %s" % (karch, "%s/unitest" % tmpfolders[karch], fd.name))
+ self.assertEqual(0, result.status, msg="Could not create a BSP with architecture %s using %s " % (karch, fd.name))
+ # Remove tmp file/folders
+ os.unlink(fd.name)
+ self.assertFalse(os.path.exists(fd.name), msg = "Temporal file %s could not be removed" % fd.name)
+ for tree in tmpfolders.values():
+ shutil.rmtree(tree)
+ self.assertFalse(os.path.exists(tree), msg = "Temporal folder %s could not be removed" % tree)
--
1.8.4.5
More information about the Openembedded-core
mailing list