mirror of
https://git.yoctoproject.org/poky
synced 2026-09-19 18:49:32 +02:00
context: Include a command line argument to run all except certain tests
A new command line argument (-R, which is the oposite of current -r) that allows to run all test cases except the ones indicated through the command line. Some command line examples: * Run all except the distro test case: $ oe-selftest -R distrodata * Run all except the archiver test case and a single bblayers unit test $ oe-selftest -R archiver bblayers.BitbakeLayers.test_bitbakelayers_add_remove [YOCTO #11847] (From OE-Core rev: e40eeaa790b95d9c25832405c0b0d5b3a0d0292b) Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
582097c103
commit
5ec91f9a32
@@ -25,14 +25,14 @@ class OESelftestTestContext(OETestContext):
|
||||
self.custommachine = None
|
||||
self.config_paths = config_paths
|
||||
|
||||
def runTests(self, machine=None):
|
||||
def runTests(self, 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()
|
||||
return super(OESelftestTestContext, self).runTests(skips)
|
||||
|
||||
def listTests(self, display_type, machine=None):
|
||||
return super(OESelftestTestContext, self).listTests(display_type)
|
||||
@@ -51,6 +51,9 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
|
||||
group.add_argument('-a', '--run-all-tests', default=False,
|
||||
action="store_true", dest="run_all_tests",
|
||||
help='Run all (unhidden) tests')
|
||||
group.add_argument('-R', '--skip-tests', required=False, action='store',
|
||||
nargs='+', dest="skips", default=None,
|
||||
help='Run all (unhidden) tests except the ones specified. Format should be <module>[.<class>[.<test_method>]]')
|
||||
group.add_argument('-r', '--run-tests', required=False, action='store',
|
||||
nargs='+', dest="run_tests", default=None,
|
||||
help='Select what tests to run (modules, classes or test methods). Format should be: <module>.<class>.<test_method>')
|
||||
@@ -133,6 +136,8 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
|
||||
copyfile(self.tc_kwargs['init']['config_paths']['bblayers'],
|
||||
self.tc_kwargs['init']['config_paths']['bblayers_backup'])
|
||||
|
||||
self.tc_kwargs['run']['skips'] = args.skips
|
||||
|
||||
def _pre_run(self):
|
||||
def _check_required_env_variables(vars):
|
||||
for var in vars:
|
||||
@@ -203,7 +208,7 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
|
||||
sys.exit(1)
|
||||
|
||||
if args.list_tests:
|
||||
rc = self.tc.listTests(args.list_tests, **self.tc_kwargs['run'])
|
||||
rc = self.tc.listTests(args.list_tests, **self.tc_kwargs['list'])
|
||||
else:
|
||||
self._pre_run()
|
||||
rc = self.tc.runTests(**self.tc_kwargs['run'])
|
||||
|
||||
Reference in New Issue
Block a user