From 1c7d6584a7811b7785ae5c1e378f14b5ba0971cf Mon Sep 17 00:00:00 2001 From: takeshi_hoshina Date: Mon, 2 Nov 2020 11:07:33 +0900 Subject: basesystem-jj recipes --- external/poky/meta/lib/oeqa/selftest/case.py | 52 +++++++++------------------- 1 file changed, 17 insertions(+), 35 deletions(-) (limited to 'external/poky/meta/lib/oeqa/selftest/case.py') diff --git a/external/poky/meta/lib/oeqa/selftest/case.py b/external/poky/meta/lib/oeqa/selftest/case.py index 9c08d595..dcad4f76 100644 --- a/external/poky/meta/lib/oeqa/selftest/case.py +++ b/external/poky/meta/lib/oeqa/selftest/case.py @@ -1,9 +1,11 @@ +# # Copyright (C) 2013-2017 Intel Corporation -# Released under the MIT license (see COPYING.MIT) +# +# SPDX-License-Identifier: MIT +# import sys import os -import shutil import glob import errno from unittest.util import safe_repr @@ -27,9 +29,7 @@ class OESelftestTestCase(OETestCase): 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") @@ -40,8 +40,7 @@ class OESelftestTestCase(OETestCase): cls._track_for_cleanup = [ cls.testinc_path, cls.testinc_bblayers_path, - cls.machineinc_path, cls.localconf_backup, - cls.local_bblayers_backup] + cls.machineinc_path] cls.add_include() @@ -99,30 +98,6 @@ class OESelftestTestCase(OETestCase): def setUp(self): super(OESelftestTestCase, self).setUp() os.chdir(self.builddir) - # Check if local.conf or bblayers.conf files backup exists - # from a previous failed test and restore them - if os.path.isfile(self.localconf_backup) or os.path.isfile( - self.local_bblayers_backup): - self.logger.debug("\ -Found a local.conf and/or bblayers.conf backup from a previously aborted test.\ -Restoring these files now, but tests should be re-executed from a clean environment\ -to ensure accurate results.") - try: - shutil.copyfile(self.localconf_backup, self.localconf_path) - except OSError as e: - if e.errno != errno.ENOENT: - raise - try: - shutil.copyfile(self.local_bblayers_backup, - self.local_bblayers_path) - except OSError as e: - if e.errno != errno.ENOENT: - raise - else: - # backup local.conf and bblayers.conf - shutil.copyfile(self.localconf_path, self.localconf_backup) - shutil.copyfile(self.local_bblayers_path, self.local_bblayers_backup) - self.logger.debug("Creating local.conf and bblayers.conf backups.") # we don't know what the previous test left around in config or inc files # if it failed so we need a fresh start try: @@ -190,13 +165,20 @@ to ensure accurate results.") self.logger.debug("Adding path '%s' to be cleaned up when test is over" % path) self._track_for_cleanup.append(path) - def write_config(self, data): - """Write to /conf/selftest.inc""" + def write_config(self, data, multiconfig=None): + """Write to config file""" + if multiconfig: + multiconfigdir = "%s/conf/multiconfig" % self.builddir + os.makedirs(multiconfigdir, exist_ok=True) + dest_path = '%s/%s.conf' % (multiconfigdir, multiconfig) + self.track_for_cleanup(dest_path) + else: + dest_path = self.testinc_path - self.logger.debug("Writing to: %s\n%s\n" % (self.testinc_path, data)) - ftools.write_file(self.testinc_path, data) + self.logger.debug("Writing to: %s\n%s\n" % (dest_path, data)) + ftools.write_file(dest_path, data) - if self.tc.custommachine and 'MACHINE' in data: + if not multiconfig and self.tc.custommachine and 'MACHINE' in data: machine = get_bb_var('MACHINE') self.logger.warning('MACHINE overridden: %s' % machine) -- cgit 1.2.3-korg