aboutsummaryrefslogtreecommitdiffstats
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:20 +0100
commit9419c81e69d2facc82e39c846466670c09e6b444 (patch)
tree624fcc0eb5cd6c586304a480e40c2d9a34d6d5f6 /meta/lib/oeqa/selftest/case.py
parent7281c995ff2b009c3fb23c7af1d91fe106ca8f87 (diff)
downloadopenembedded-core-contrib-9419c81e69d2facc82e39c846466670c09e6b444.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] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
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
from oeqa.core.case import OETestCase
class OESelftestTestCase(OETestCase):
- builddir = os.environ.get("BUILDDIR") or ""
- localconf_path = os.path.join(builddir, "conf/local.conf")
- localconf_backup = os.path.join(builddir, "conf/local.bk")
- testinc_path = os.path.join(builddir, "conf/selftest.inc")
- local_bblayers_path = os.path.join(builddir, "conf/bblayers.conf")
- local_bblayers_backup = os.path.join(builddir, "conf/bblayers.bk")
- testinc_bblayers_path = os.path.join(builddir, "conf/bblayers.inc")
- machineinc_path = os.path.join(builddir, "conf/machine.inc")
-
def __init__(self, methodName="runTest"):
self._extra_tear_down_commands = []
- self._track_for_cleanup = [
- self.testinc_path, self.testinc_bblayers_path,
- self.machineinc_path, self.localconf_backup,
- self.local_bblayers_backup]
-
super(OESelftestTestCase, self).__init__(methodName)
@classmethod
def setUpClass(cls):
super(OESelftestTestCase, cls).setUpClass()
- cls.testlayer_path = cls.tc.testlayer_path
+
+ cls.testlayer_path = cls.tc.config_paths['testlayer_path']
+ cls.builddir = cls.tc.config_paths['builddir']
+
+ cls.localconf_path = cls.tc.config_paths['localconf']
+ cls.localconf_backup = cls.tc.config_paths['localconf_class_backup']
+ cls.local_bblayers_path = cls.tc.config_paths['bblayers']
+ cls.local_bblayers_backup = cls.tc.config_paths['bblayers_class_backup']
+
+ cls.testinc_path = os.path.join(cls.tc.config_paths['builddir'],
+ "conf/selftest.inc")
+ cls.testinc_bblayers_path = os.path.join(cls.tc.config_paths['builddir'],
+ "conf/bblayers.inc")
+ cls.machineinc_path = os.path.join(cls.tc.config_paths['builddir'],
+ "conf/machine.inc")
+
+ cls._track_for_cleanup = [
+ cls.testinc_path, cls.testinc_bblayers_path,
+ cls.machineinc_path, cls.localconf_backup,
+ cls.local_bblayers_backup]
+
cls.add_include()
@classmethod