Skip to content

Commit eddbadf

Browse files
committed
[compiler-rt] Allow override of 'emulator' value from lit_config.
Currently the 'emulator' value is fixed at build time. This patch allows changing the emulator at testing time and enables us to run the tests on different board or simulators without needing to run CMake again to change the value of emulator. With this patch in place, the value of 'emulator' can be changed at test time from the command line like this: $ llvm-lit --param=emulator="..." Reviewed By: delcypher Differential Revision: https://reviews.llvm.org/D84708
1 parent 08097fc commit eddbadf

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

compiler-rt/test/lit.common.cfg.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,21 @@
132132
else:
133133
config.substitutions.append( ('%run_nomprotect', '%run') )
134134

135+
# Copied from libcxx's config.py
136+
def get_lit_conf(name, default=None):
137+
# Allow overriding on the command line using --param=<name>=<val>
138+
val = lit_config.params.get(name, None)
139+
if val is None:
140+
val = getattr(config, name, None)
141+
if val is None:
142+
val = default
143+
return val
144+
145+
emulator = get_lit_conf('emulator', None)
146+
135147
# Allow tests to be executed on a simulator or remotely.
136-
if config.emulator:
137-
config.substitutions.append( ('%run', config.emulator) )
148+
if emulator:
149+
config.substitutions.append( ('%run', emulator) )
138150
config.substitutions.append( ('%env ', "env ") )
139151
# TODO: Implement `%device_rm` to perform removal of files in the emulator.
140152
# For now just make it a no-op.

0 commit comments

Comments
 (0)