diff options
Diffstat (limited to 'poky/meta/lib/oeqa/selftest/context.py')
-rw-r--r-- | poky/meta/lib/oeqa/selftest/context.py | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/poky/meta/lib/oeqa/selftest/context.py b/poky/meta/lib/oeqa/selftest/context.py index 9a56888c2f..c521290327 100644 --- a/poky/meta/lib/oeqa/selftest/context.py +++ b/poky/meta/lib/oeqa/selftest/context.py @@ -11,6 +11,7 @@ from shutil import copyfile from random import choice import oeqa +import oe from oeqa.core.context import OETestContext, OETestContextExecutor from oeqa.core.exception import OEQAPreRun, OEQATestNotFound @@ -25,14 +26,14 @@ class OESelftestTestContext(OETestContext): self.custommachine = None self.config_paths = config_paths - def runTests(self, machine=None, skips=[]): + 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(skips) + return super(OESelftestTestContext, self).runTests(processes, skips) def listTests(self, display_type, machine=None): return super(OESelftestTestContext, self).listTests(display_type) @@ -68,6 +69,9 @@ class OESelftestTestContextExecutor(OETestContextExecutor): action="store_true", default=False, help='List all available tests.') + 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).') @@ -96,7 +100,6 @@ class OESelftestTestContextExecutor(OETestContextExecutor): return cases_paths def _process_args(self, logger, args): - args.test_start_time = time.strftime("%Y%m%d%H%M%S") args.test_data_file = None args.CASES_PATHS = None @@ -143,6 +146,7 @@ class OESelftestTestContextExecutor(OETestContextExecutor): self.tc_kwargs['init']['config_paths']['bblayers_backup']) self.tc_kwargs['run']['skips'] = args.skips + self.tc_kwargs['run']['processes'] = args.processes def _pre_run(self): def _check_required_env_variables(vars): @@ -158,7 +162,7 @@ class OESelftestTestContextExecutor(OETestContextExecutor): os.chdir(builddir) if not "meta-selftest" in self.tc.td["BBLAYERS"]: - self.tc.logger.warn("meta-selftest layer not found in BBLAYERS, adding it") + self.tc.logger.warning("meta-selftest layer not found in BBLAYERS, adding it") meta_selftestdir = os.path.join( self.tc.td["BBLAYERS_FETCH_DIR"], 'meta-selftest') if os.path.isdir(meta_selftestdir): @@ -189,6 +193,10 @@ class OESelftestTestContextExecutor(OETestContextExecutor): self.tc.logger.error("You have buildhistory enabled already and this isn't recommended for selftest, please disable it first.") raise OEQAPreRun + if "rm_work.bbclass" in self.tc.td["BBINCLUDED"]: + self.tc.logger.error("You have rm_work enabled which isn't recommended while running oe-selftest. Please disable it before continuing.") + raise OEQAPreRun + if "PRSERV_HOST" in self.tc.td: self.tc.logger.error("Please unset PRSERV_HOST in order to run oe-selftest") raise OEQAPreRun @@ -199,8 +207,8 @@ class OESelftestTestContextExecutor(OETestContextExecutor): _add_layer_libs() - self.tc.logger.info("Running bitbake -p") - runCmd("bitbake -p") + self.tc.logger.info("Running bitbake -e to test the configuration is valid/parsable") + runCmd("bitbake -e") def get_json_result_dir(self, args): json_result_dir = os.path.join(self.tc.td["LOG_DIR"], 'oeqa') @@ -216,7 +224,7 @@ class OESelftestTestContextExecutor(OETestContextExecutor): configuration = {'TEST_TYPE': 'oeselftest', 'STARTTIME': args.test_start_time, 'MACHINE': self.tc.td["MACHINE"], - 'HOST_DISTRO': ('-'.join(platform.linux_distribution())).replace(' ', '-'), + 'HOST_DISTRO': oe.lsb.distro_identifier().replace(' ', '-'), 'HOST_NAME': metadata['hostname'], 'LAYERS': metadata['layers']} return configuration |