[compiler-rt] eddbadf - [compiler-rt] Allow override of 'emulator' value from lit_config.

Hafiz Abid Qadeer via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 13 09:15:29 PDT 2020


Author: Hafiz Abid Qadeer
Date: 2020-10-13T17:12:34+01:00
New Revision: eddbadfe13fbdcf18fee7d643d70d8042d69c778

URL: https://github.com/llvm/llvm-project/commit/eddbadfe13fbdcf18fee7d643d70d8042d69c778
DIFF: https://github.com/llvm/llvm-project/commit/eddbadfe13fbdcf18fee7d643d70d8042d69c778.diff

LOG: [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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py
index be1534d554ea..57b26c19e8e2 100644
--- a/compiler-rt/test/lit.common.cfg.py
+++ b/compiler-rt/test/lit.common.cfg.py
@@ -132,9 +132,21 @@
 else:
   config.substitutions.append( ('%run_nomprotect', '%run') )
 
+# Copied from libcxx's config.py
+def get_lit_conf(name, default=None):
+    # Allow overriding on the command line using --param=<name>=<val>
+    val = lit_config.params.get(name, None)
+    if val is None:
+        val = getattr(config, name, None)
+        if val is None:
+            val = default
+    return val
+
+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.


        


More information about the llvm-commits mailing list