From 815d04a2007e1154b69f1a027c8677ea86935354 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Sun, 29 Oct 2023 10:21:22 +0000 Subject: [PATCH] oeqa/selftest: Drop machines support The machines option to oe-selftest isn't used in our CI and is never likely to be, we focus and execute testing explictly. The YOCTO #15247 is about how this code doesn't interact well with build directory cleanup and at this point I think we should just remove the option/code. Signed-off-by: Richard Purdie --- meta/lib/oeqa/selftest/case.py | 12 -------- meta/lib/oeqa/selftest/context.py | 51 +------------------------------ 2 files changed, 1 insertion(+), 62 deletions(-) diff --git a/meta/lib/oeqa/selftest/case.py b/meta/lib/oeqa/selftest/case.py index 54d90c78ac5..da35b25f68e 100644 --- a/meta/lib/oeqa/selftest/case.py +++ b/meta/lib/oeqa/selftest/case.py @@ -117,10 +117,6 @@ class OESelftestTestCase(OETestCase): if e.errno != errno.ENOENT: raise - if self.tc.custommachine: - machine_conf = 'MACHINE ??= "%s"\n' % self.tc.custommachine - self.set_machine_config(machine_conf) - # tests might need their own setup # but if they overwrite this one they have to call # super each time, so let's give them an alternative @@ -178,19 +174,11 @@ class OESelftestTestCase(OETestCase): self.logger.debug("Writing to: %s\n%s\n" % (dest_path, data)) ftools.write_file(dest_path, data) - if not multiconfig and self.tc.custommachine and 'MACHINE' in data: - machine = get_bb_var('MACHINE') - self.logger.warning('MACHINE overridden: %s' % machine) - def append_config(self, data): """Append to /conf/selftest.inc""" self.logger.debug("Appending to: %s\n%s\n" % (self.testinc_path, data)) ftools.append_file(self.testinc_path, data) - if self.tc.custommachine and 'MACHINE' in data: - machine = get_bb_var('MACHINE') - self.logger.warning('MACHINE overridden: %s' % machine) - def remove_config(self, data): """Remove data from /conf/selftest.inc""" self.logger.debug("Removing from: %s\n%s\n" % (self.testinc_path, data)) diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py index 5a09aeedffe..57844b289a2 100644 --- a/meta/lib/oeqa/selftest/context.py +++ b/meta/lib/oeqa/selftest/context.py @@ -70,8 +70,6 @@ class OESelftestTestContext(OETestContext): def __init__(self, td=None, logger=None, machines=None, config_paths=None, newbuilddir=None, keep_builddir=None): super(OESelftestTestContext, self).__init__(td, logger) - self.machines = machines - self.custommachine = None self.config_paths = config_paths self.newbuilddir = newbuilddir @@ -160,12 +158,6 @@ class OESelftestTestContext(OETestContext): return NonConcurrentTestSuite(suites, processes, self.setup_builddir, self.removebuilddir, self.bb_vars) def runTests(self, processes=None, machine=None, skips=[]): - if machine: - self.custommachine = machine - if machine == 'random': - self.custommachine = choice(self.machines) - self.logger.info('Run tests with custom MACHINE set to: %s' % \ - self.custommachine) return super(OESelftestTestContext, self).runTests(processes, skips) def listTests(self, display_type, machine=None): @@ -205,9 +197,6 @@ class OESelftestTestContextExecutor(OETestContextExecutor): parser.add_argument('-j', '--num-processes', dest='processes', action='store', type=int, help="number of processes to execute in parallel with") - parser.add_argument('--machine', required=False, choices=['random', 'all'], - help='Run tests on different machines (random/all).') - parser.add_argument('-t', '--select-tag', dest="select_tags", action='append', default=None, help='Filter all (unhidden) tests to any that match any of the specified tag(s).') @@ -222,20 +211,6 @@ class OESelftestTestContextExecutor(OETestContextExecutor): parser.add_argument('-v', '--verbose', action='store_true') parser.set_defaults(func=self.run) - def _get_available_machines(self): - machines = [] - - bbpath = self.tc_kwargs['init']['td']['BBPATH'].split(':') - - for path in bbpath: - found_machines = glob.glob(os.path.join(path, 'conf', 'machine', '*.conf')) - if found_machines: - for i in found_machines: - # eg: '/home//poky/meta-intel/conf/machine/intel-core2-32.conf' - machines.append(os.path.splitext(os.path.basename(i))[0]) - - return machines - def _get_cases_paths(self, bbpath): cases_paths = [] for layer in bbpath: @@ -266,7 +241,6 @@ class OESelftestTestContextExecutor(OETestContextExecutor): args.list_tests = 'name' self.tc_kwargs['init']['td'] = bbvars - self.tc_kwargs['init']['machines'] = self._get_available_machines() builddir = os.environ.get("BUILDDIR") self.tc_kwargs['init']['config_paths'] = {} @@ -414,30 +388,7 @@ class OESelftestTestContextExecutor(OETestContextExecutor): rc = None try: - if args.machine: - logger.info('Custom machine mode enabled. MACHINE set to %s' % - args.machine) - - if args.machine == 'all': - results = [] - for m in self.tc_kwargs['init']['machines']: - self.tc_kwargs['run']['machine'] = m - results.append(self._internal_run(logger, args)) - - # XXX: the oe-selftest script only needs to know if one - # machine run fails - for r in results: - rc = r - if not r.wasSuccessful(): - break - - else: - self.tc_kwargs['run']['machine'] = args.machine - return self._internal_run(logger, args) - - else: - self.tc_kwargs['run']['machine'] = args.machine - rc = self._internal_run(logger, args) + rc = self._internal_run(logger, args) finally: config_paths = self.tc_kwargs['init']['config_paths'] -- 2.47.3