summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/case.py
diff options
context:
space:
mode:
authorAníbal Limón <anibal.limon@linux.intel.com>2017-06-23 15:10:38 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-07-21 08:44:25 +0100
commitad734fd64add0f44a4e5125823cc15ee0ae30aa0 (patch)
tree0f27b5969ec5473b7b3f735a7c6b73bca9fccddf /meta/lib/oeqa/selftest/case.py
parentf4a978485f870e079d5bb4567ca972f1434b8242 (diff)
downloadpoky-ad734fd64add0f44a4e5125823cc15ee0ae30aa0.tar.gz
oeqa/selftest/{context,case}: Handle KeyboardInterrupt/SIGINT and SIGTERM
In order to avoid corrupt local.conf and bblayers.conf adds signal handler for SIGTERM and use try/finally (KeyboardIntrrupt) block to restore previously backuped configuration. [YOCTO #11650] (From OE-Core rev: 9419c81e69d2facc82e39c846466670c09e6b444) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest/case.py')
-rw-r--r--meta/lib/oeqa/selftest/case.py36
1 files changed, 21 insertions, 15 deletions
diff --git a/meta/lib/oeqa/selftest/case.py b/meta/lib/oeqa/selftest/case.py
index 31a11fddda..871009c568 100644
--- a/meta/lib/oeqa/selftest/case.py
+++ b/meta/lib/oeqa/selftest/case.py
@@ -13,28 +13,34 @@ from oeqa.utils.commands import runCmd, bitbake, get_bb_var
13from oeqa.core.case import OETestCase 13from oeqa.core.case import OETestCase
14 14
15class OESelftestTestCase(OETestCase): 15class OESelftestTestCase(OETestCase):
16 builddir = os.environ.get("BUILDDIR") or ""
17 localconf_path = os.path.join(builddir, "conf/local.conf")
18 localconf_backup = os.path.join(builddir, "conf/local.bk")
19 testinc_path = os.path.join(builddir, "conf/selftest.inc")
20 local_bblayers_path = os.path.join(builddir, "conf/bblayers.conf")
21 local_bblayers_backup = os.path.join(builddir, "conf/bblayers.bk")
22 testinc_bblayers_path = os.path.join(builddir, "conf/bblayers.inc")
23 machineinc_path = os.path.join(builddir, "conf/machine.inc")
24
25 def __init__(self, methodName="runTest"): 16 def __init__(self, methodName="runTest"):
26 self._extra_tear_down_commands = [] 17 self._extra_tear_down_commands = []
27 self._track_for_cleanup = [
28 self.testinc_path, self.testinc_bblayers_path,
29 self.machineinc_path, self.localconf_backup,
30 self.local_bblayers_backup]
31
32 super(OESelftestTestCase, self).__init__(methodName) 18 super(OESelftestTestCase, self).__init__(methodName)
33 19
34 @classmethod 20 @classmethod
35 def setUpClass(cls): 21 def setUpClass(cls):
36 super(OESelftestTestCase, cls).setUpClass() 22 super(OESelftestTestCase, cls).setUpClass()
37 cls.testlayer_path = cls.tc.testlayer_path 23
24 cls.testlayer_path = cls.tc.config_paths['testlayer_path']
25 cls.builddir = cls.tc.config_paths['builddir']
26
27 cls.localconf_path = cls.tc.config_paths['localconf']
28 cls.localconf_backup = cls.tc.config_paths['localconf_class_backup']
29 cls.local_bblayers_path = cls.tc.config_paths['bblayers']
30 cls.local_bblayers_backup = cls.tc.config_paths['bblayers_class_backup']
31
32 cls.testinc_path = os.path.join(cls.tc.config_paths['builddir'],
33 "conf/selftest.inc")
34 cls.testinc_bblayers_path = os.path.join(cls.tc.config_paths['builddir'],
35 "conf/bblayers.inc")
36 cls.machineinc_path = os.path.join(cls.tc.config_paths['builddir'],
37 "conf/machine.inc")
38
39 cls._track_for_cleanup = [
40 cls.testinc_path, cls.testinc_bblayers_path,
41 cls.machineinc_path, cls.localconf_backup,
42 cls.local_bblayers_backup]
43
38 cls.add_include() 44 cls.add_include()
39 45
40 @classmethod 46 @classmethod