summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/selftest/base.py32
1 files changed, 31 insertions, 1 deletions
diff --git a/meta/lib/oeqa/selftest/base.py b/meta/lib/oeqa/selftest/base.py
index b5a52fe57a..26c93f905a 100644
--- a/meta/lib/oeqa/selftest/base.py
+++ b/meta/lib/oeqa/selftest/base.py
@@ -28,17 +28,47 @@ class oeSelfTest(unittest.TestCase):
28 def __init__(self, methodName="runTest"): 28 def __init__(self, methodName="runTest"):
29 self.builddir = os.environ.get("BUILDDIR") 29 self.builddir = os.environ.get("BUILDDIR")
30 self.localconf_path = os.path.join(self.builddir, "conf/local.conf") 30 self.localconf_path = os.path.join(self.builddir, "conf/local.conf")
31 self.localconf_backup = os.path.join(self.builddir, "conf/local.bk")
31 self.testinc_path = os.path.join(self.builddir, "conf/selftest.inc") 32 self.testinc_path = os.path.join(self.builddir, "conf/selftest.inc")
32 self.local_bblayers_path = os.path.join(self.builddir, "conf/bblayers.conf") 33 self.local_bblayers_path = os.path.join(self.builddir, "conf/bblayers.conf")
34 self.local_bblayers_backup = os.path.join(self.builddir,
35 "conf/bblayers.bk")
33 self.testinc_bblayers_path = os.path.join(self.builddir, "conf/bblayers.inc") 36 self.testinc_bblayers_path = os.path.join(self.builddir, "conf/bblayers.inc")
34 self.machineinc_path = os.path.join(self.builddir, "conf/machine.inc") 37 self.machineinc_path = os.path.join(self.builddir, "conf/machine.inc")
35 self.testlayer_path = oeSelfTest.testlayer_path 38 self.testlayer_path = oeSelfTest.testlayer_path
36 self._extra_tear_down_commands = [] 39 self._extra_tear_down_commands = []
37 self._track_for_cleanup = [self.testinc_path, self.testinc_bblayers_path, self.machineinc_path] 40 self._track_for_cleanup = [
41 self.testinc_path, self.testinc_bblayers_path,
42 self.machineinc_path, self.localconf_backup,
43 self.local_bblayers_backup]
38 super(oeSelfTest, self).__init__(methodName) 44 super(oeSelfTest, self).__init__(methodName)
39 45
40 def setUp(self): 46 def setUp(self):
41 os.chdir(self.builddir) 47 os.chdir(self.builddir)
48 # Check if local.conf or bblayers.conf files backup exists
49 # from a previous failed test and restore them
50 if os.path.isfile(self.localconf_backup) or os.path.isfile(
51 self.local_bblayers_backup):
52 self.log.debug("Found a local.conf and/or bblayers.conf backup \
53from a previously aborted test. Restoring these files now, but tests should \
54be re-executed from a clean environment to ensure accurate results.")
55 try:
56 shutil.copyfile(self.localconf_backup, self.localconf_path)
57 except OSError as e:
58 if e.errno != errno.ENOENT:
59 raise
60 try:
61 shutil.copyfile(self.local_bblayers_backup,
62 self.local_bblayers_path)
63 except OSError as e:
64 if e.errno != errno.ENOENT:
65 raise
66 else:
67 # backup local.conf and bblayers.conf
68 shutil.copyfile(self.localconf_path, self.localconf_backup)
69 shutil.copyfile(self.local_bblayers_path,
70 self.local_bblayers_backup)
71 self.log.debug("Creating local.conf and bblayers.conf backups.")
42 # we don't know what the previous test left around in config or inc files 72 # we don't know what the previous test left around in config or inc files
43 # if it failed so we need a fresh start 73 # if it failed so we need a fresh start
44 try: 74 try: