diff --git a/reframe/frontend/autodetect.py b/reframe/frontend/autodetect.py index 6378155fb..605a54932 100644 --- a/reframe/frontend/autodetect.py +++ b/reframe/frontend/autodetect.py @@ -136,7 +136,7 @@ def _is_part_local(part): part.launcher_type.registered_name == 'local') -def _remote_detect(part): +def _remote_detect(part, cli_job_options): use_login_shell = runtime.runtime().get_option('general/0/use_login_shell') def _emit_script_for_source(job, env): @@ -172,7 +172,7 @@ def _emit_custom_script(job, env, commands): job = Job.create(part.scheduler, part.launcher_type(), name='rfm-detect-job', - sched_access=part.access) + sched_access=part.access + cli_job_options) custom_command = runtime.runtime().get_option( 'general/0/remote_install' ) @@ -201,7 +201,8 @@ def _emit_custom_script(job, env, commands): return topo_info -def detect_topology(): +def detect_topology(cli_job_options=None): + cli_job_options = [] if cli_job_options is None else cli_job_options rt = runtime.runtime() detect_remote_systems = rt.get_option('general/0/remote_detect') topo_prefix = osext.expandvars(rt.get_option('general/0/topology_prefix')) @@ -280,7 +281,9 @@ def detect_topology(): _save_info(topo_file, part.processor.info) elif detect_remote_systems: with runtime.temp_environment(modules=modules, env_vars=vars): - part._processor = ProcessorInfo(_remote_detect(part)) + part._processor = ProcessorInfo( + _remote_detect(part, cli_job_options) + ) if part.processor.info: _save_info(topo_file, part.processor.info) diff --git a/reframe/frontend/cli.py b/reframe/frontend/cli.py index 64f1b9dae..5c699b452 100644 --- a/reframe/frontend/cli.py +++ b/reframe/frontend/cli.py @@ -1109,7 +1109,20 @@ def restrict_logging(): sys.exit(0) - autodetect.detect_topology() + # Need to parse the cli options before autodetection + parsed_job_options = [] + for opt in options.job_options: + opt_split = opt.split('=', maxsplit=1) + optstr = opt_split[0] + valstr = opt_split[1] if len(opt_split) > 1 else '' + if opt.startswith('-') or opt.startswith('#'): + parsed_job_options.append(opt) + elif len(optstr) == 1: + parsed_job_options.append(f'-{optstr} {valstr}') + else: + parsed_job_options.append(f'--{optstr}={valstr}') + + autodetect.detect_topology(parsed_job_options) printer.debug(format_env(options.env_vars)) # Setup the check loader @@ -1224,19 +1237,6 @@ def print_infoline(param, value): try: logging.getprofiler().enter_region('test processing') - # Need to parse the cli options before loading the tests - parsed_job_options = [] - for opt in options.job_options: - opt_split = opt.split('=', maxsplit=1) - optstr = opt_split[0] - valstr = opt_split[1] if len(opt_split) > 1 else '' - if opt.startswith('-') or opt.startswith('#'): - parsed_job_options.append(opt) - elif len(optstr) == 1: - parsed_job_options.append(f'-{optstr} {valstr}') - else: - parsed_job_options.append(f'--{optstr}={valstr}') - # Locate and load checks; `force=True` is not needed for normal # invocations from the command line and has practically no effect, but # it is needed to better emulate the behavior of running reframe's CLI diff --git a/unittests/test_parameters.py b/unittests/test_parameters.py index a818a3d8c..1b5826a90 100644 --- a/unittests/test_parameters.py +++ b/unittests/test_parameters.py @@ -10,7 +10,6 @@ import reframe as rfm from reframe.core.exceptions import ReframeSyntaxError -import reframe.core.decorators as decorators class NoParams(rfm.RunOnlyRegressionTest):