blob: 4c539a1f3fc79f57b6bd3830070ff411c0c7fed4 [file] [log] [blame]
Patrick Williamsf1e5d692016-03-30 15:21:19 -05001import unittest
2import os
3import logging
4import tempfile
5import shutil
6
7from oeqa.selftest.base import oeSelfTest
8from oeqa.utils.commands import runCmd
9from oeqa.utils.decorators import skipUnlessPassed
10
11class 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)