summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2023-10-29 10:21:22 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-11-05 10:57:56 +0000
commite598223e0b765c0a418c4f036927ef3e567c56ed (patch)
treea44d237a93ea7ca9fa8f72ad6f67e1464c8afc84 /meta/lib
parent8ea375589d68dfbf4eaf4974200c6a5a8b3a4b49 (diff)
downloadpoky-e598223e0b765c0a418c4f036927ef3e567c56ed.tar.gz
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. (From OE-Core rev: 815d04a2007e1154b69f1a027c8677ea86935354) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/selftest/case.py12
-rw-r--r--meta/lib/oeqa/selftest/context.py51
2 files changed, 1 insertions, 62 deletions
diff --git a/meta/lib/oeqa/selftest/case.py b/meta/lib/oeqa/selftest/case.py
index 54d90c78ac..da35b25f68 100644
--- a/meta/lib/oeqa/selftest/case.py
+++ b/meta/lib/oeqa/selftest/case.py
@@ -117,10 +117,6 @@ class OESelftestTestCase(OETestCase):
117 if e.errno != errno.ENOENT: 117 if e.errno != errno.ENOENT:
118 raise 118 raise
119 119
120 if self.tc.custommachine:
121 machine_conf = 'MACHINE ??= "%s"\n' % self.tc.custommachine
122 self.set_machine_config(machine_conf)
123
124 # tests might need their own setup 120 # tests might need their own setup
125 # but if they overwrite this one they have to call 121 # but if they overwrite this one they have to call
126 # super each time, so let's give them an alternative 122 # super each time, so let's give them an alternative
@@ -178,19 +174,11 @@ class OESelftestTestCase(OETestCase):
178 self.logger.debug("Writing to: %s\n%s\n" % (dest_path, data)) 174 self.logger.debug("Writing to: %s\n%s\n" % (dest_path, data))
179 ftools.write_file(dest_path, data) 175 ftools.write_file(dest_path, data)
180 176
181 if not multiconfig and self.tc.custommachine and 'MACHINE' in data:
182 machine = get_bb_var('MACHINE')
183 self.logger.warning('MACHINE overridden: %s' % machine)
184
185 def append_config(self, data): 177 def append_config(self, data):
186 """Append to <builddir>/conf/selftest.inc""" 178 """Append to <builddir>/conf/selftest.inc"""
187 self.logger.debug("Appending to: %s\n%s\n" % (self.testinc_path, data)) 179 self.logger.debug("Appending to: %s\n%s\n" % (self.testinc_path, data))
188 ftools.append_file(self.testinc_path, data) 180 ftools.append_file(self.testinc_path, data)
189 181
190 if self.tc.custommachine and 'MACHINE' in data:
191 machine = get_bb_var('MACHINE')
192 self.logger.warning('MACHINE overridden: %s' % machine)
193
194 def remove_config(self, data): 182 def remove_config(self, data):
195 """Remove data from <builddir>/conf/selftest.inc""" 183 """Remove data from <builddir>/conf/selftest.inc"""
196 self.logger.debug("Removing from: %s\n%s\n" % (self.testinc_path, data)) 184 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 5a09aeedff..57844b289a 100644
--- a/meta/lib/oeqa/selftest/context.py
+++ b/meta/lib/oeqa/selftest/context.py
@@ -70,8 +70,6 @@ class OESelftestTestContext(OETestContext):
70 def __init__(self, td=None, logger=None, machines=None, config_paths=None, newbuilddir=None, keep_builddir=None): 70 def __init__(self, td=None, logger=None, machines=None, config_paths=None, newbuilddir=None, keep_builddir=None):
71 super(OESelftestTestContext, self).__init__(td, logger) 71 super(OESelftestTestContext, self).__init__(td, logger)
72 72
73 self.machines = machines
74 self.custommachine = None
75 self.config_paths = config_paths 73 self.config_paths = config_paths
76 self.newbuilddir = newbuilddir 74 self.newbuilddir = newbuilddir
77 75
@@ -160,12 +158,6 @@ class OESelftestTestContext(OETestContext):
160 return NonConcurrentTestSuite(suites, processes, self.setup_builddir, self.removebuilddir, self.bb_vars) 158 return NonConcurrentTestSuite(suites, processes, self.setup_builddir, self.removebuilddir, self.bb_vars)
161 159
162 def runTests(self, processes=None, machine=None, skips=[]): 160 def runTests(self, processes=None, machine=None, skips=[]):
163 if machine:
164 self.custommachine = machine
165 if machine == 'random':
166 self.custommachine = choice(self.machines)
167 self.logger.info('Run tests with custom MACHINE set to: %s' % \
168 self.custommachine)
169 return super(OESelftestTestContext, self).runTests(processes, skips) 161 return super(OESelftestTestContext, self).runTests(processes, skips)
170 162
171 def listTests(self, display_type, machine=None): 163 def listTests(self, display_type, machine=None):
@@ -205,9 +197,6 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
205 parser.add_argument('-j', '--num-processes', dest='processes', action='store', 197 parser.add_argument('-j', '--num-processes', dest='processes', action='store',
206 type=int, help="number of processes to execute in parallel with") 198 type=int, help="number of processes to execute in parallel with")
207 199
208 parser.add_argument('--machine', required=False, choices=['random', 'all'],
209 help='Run tests on different machines (random/all).')
210
211 parser.add_argument('-t', '--select-tag', dest="select_tags", 200 parser.add_argument('-t', '--select-tag', dest="select_tags",
212 action='append', default=None, 201 action='append', default=None,
213 help='Filter all (unhidden) tests to any that match any of the specified tag(s).') 202 help='Filter all (unhidden) tests to any that match any of the specified tag(s).')
@@ -222,20 +211,6 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
222 parser.add_argument('-v', '--verbose', action='store_true') 211 parser.add_argument('-v', '--verbose', action='store_true')
223 parser.set_defaults(func=self.run) 212 parser.set_defaults(func=self.run)
224 213
225 def _get_available_machines(self):
226 machines = []
227
228 bbpath = self.tc_kwargs['init']['td']['BBPATH'].split(':')
229
230 for path in bbpath:
231 found_machines = glob.glob(os.path.join(path, 'conf', 'machine', '*.conf'))
232 if found_machines:
233 for i in found_machines:
234 # eg: '/home/<user>/poky/meta-intel/conf/machine/intel-core2-32.conf'
235 machines.append(os.path.splitext(os.path.basename(i))[0])
236
237 return machines
238
239 def _get_cases_paths(self, bbpath): 214 def _get_cases_paths(self, bbpath):
240 cases_paths = [] 215 cases_paths = []
241 for layer in bbpath: 216 for layer in bbpath:
@@ -266,7 +241,6 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
266 args.list_tests = 'name' 241 args.list_tests = 'name'
267 242
268 self.tc_kwargs['init']['td'] = bbvars 243 self.tc_kwargs['init']['td'] = bbvars
269 self.tc_kwargs['init']['machines'] = self._get_available_machines()
270 244
271 builddir = os.environ.get("BUILDDIR") 245 builddir = os.environ.get("BUILDDIR")
272 self.tc_kwargs['init']['config_paths'] = {} 246 self.tc_kwargs['init']['config_paths'] = {}
@@ -414,30 +388,7 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
414 388
415 rc = None 389 rc = None
416 try: 390 try:
417 if args.machine: 391 rc = self._internal_run(logger, args)
418 logger.info('Custom machine mode enabled. MACHINE set to %s' %
419 args.machine)
420
421 if args.machine == 'all':
422 results = []
423 for m in self.tc_kwargs['init']['machines']:
424 self.tc_kwargs['run']['machine'] = m
425 results.append(self._internal_run(logger, args))
426
427 # XXX: the oe-selftest script only needs to know if one
428 # machine run fails
429 for r in results:
430 rc = r
431 if not r.wasSuccessful():
432 break
433
434 else:
435 self.tc_kwargs['run']['machine'] = args.machine
436 return self._internal_run(logger, args)
437
438 else:
439 self.tc_kwargs['run']['machine'] = args.machine
440 rc = self._internal_run(logger, args)
441 finally: 392 finally:
442 config_paths = self.tc_kwargs['init']['config_paths'] 393 config_paths = self.tc_kwargs['init']['config_paths']
443 394