diff mbox series

oeqa/selftest: Drop machines support

Message ID 20231029102344.1879648-1-richard.purdie@linuxfoundation.org
State Accepted, archived
Commit 815d04a2007e1154b69f1a027c8677ea86935354
Headers show
Series oeqa/selftest: Drop machines support | expand

Commit Message

Richard Purdie Oct. 29, 2023, 10:23 a.m. UTC
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 <richard.purdie@linuxfoundation.org>
---
 meta/lib/oeqa/selftest/case.py    | 12 --------
 meta/lib/oeqa/selftest/context.py | 50 +------------------------------
 2 files changed, 1 insertion(+), 61 deletions(-)
diff mbox series

Patch

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 <builddir>/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 <builddir>/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..01ed360e1ff 100644
--- a/meta/lib/oeqa/selftest/context.py
+++ b/meta/lib/oeqa/selftest/context.py
@@ -70,7 +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 +159,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 +198,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 +212,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/<user>/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 +242,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 +389,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']