diff --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py --- a/compiler-rt/test/lit.common.cfg.py +++ b/compiler-rt/test/lit.common.cfg.py @@ -129,9 +129,21 @@ else: config.substitutions.append( ('%run_nomprotect', '%run') ) +# It is copied from config.py used by libcxx. +def get_lit_conf(name, default=None): + val = lit_config.params.get(name, None) + if val is None: + val = getattr(config, name, None) + if val is None: + val = default + return val + +# Allow overriding the emulator value from lit_config. +emulator = get_lit_conf('emulator', None) + # Allow tests to be executed on a simulator or remotely. -if config.emulator: - config.substitutions.append( ('%run', config.emulator) ) +if emulator: + config.substitutions.append( ('%run', emulator) ) config.substitutions.append( ('%env ', "env ") ) # TODO: Implement `%device_rm` to perform removal of files in the emulator. # For now just make it a no-op.