summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hughes <tomhughes@chromium.org>2021-09-20 23:24:38 +0000
committerCommit Bot <commit-bot@chromium.org>2021-09-21 17:49:08 +0000
commit2de3d51b0a32c9f26dea0dd3d430f1f7f9adab41 (patch)
tree140457676799574c8bb1a4267e4cf5f31d322538
parentad3c72d45cbfea3f5c8150a1a39625c99d82f784 (diff)
downloadchrome-ec-2de3d51b0a32c9f26dea0dd3d430f1f7f9adab41.tar.gz
test/run_device_tests.py: Allow specifying compiler
Default to using gcc, but allow selecting clang so that we can test it. BRANCH=none BUG=b:172020503 TEST=./test/run_device_tests.py --compiler clang --board dartmonkey --tests sha256 --remote 127.0.0.1:2551 TEST=./test/run_device_tests.py --board dartmonkey --tests sha256 --remote 127.0.0.1:2551 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I3cfd04825df8cac54fbee1ba1b084ea581e62e53 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3172037 Reviewed-by: Craig Hesling <hesling@chromium.org> Reviewed-by: Patryk Duda <patrykd@google.com>
-rwxr-xr-xtest/run_device_tests.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/test/run_device_tests.py b/test/run_device_tests.py
index 43b597bcf1..8207f83f66 100755
--- a/test/run_device_tests.py
+++ b/test/run_device_tests.py
@@ -58,6 +58,9 @@ DARTMONKEY = 'dartmonkey'
JTRACE = 'jtrace'
SERVO_MICRO = 'servo_micro'
+GCC = 'gcc'
+CLANG = 'clang'
+
class ImageType(Enum):
"""EC Image type to use for the test."""
@@ -254,10 +257,14 @@ def hw_write_protect(enable: bool) -> None:
subprocess.run(cmd).check_returncode()
-def build(test_name: str, board_name: str) -> None:
+def build(test_name: str, board_name: str, compiler: str) -> None:
"""Build specified test for specified board."""
- cmd = [
- 'make',
+ cmd = ['make']
+
+ if compiler == CLANG:
+ cmd = cmd + ['CC=arm-none-eabi-clang']
+
+ cmd = cmd + [
'BOARD=' + board_name,
'test-' + test_name,
'-j',
@@ -431,6 +438,11 @@ def main():
default=JTRACE
)
+ compiler_options = [GCC, CLANG]
+ parser.add_argument('--compiler', '-c',
+ choices=compiler_options,
+ default=GCC)
+
# This might be expanded to serve as a "remote" for flash_ec also, so
# we will leave it generic.
parser.add_argument(
@@ -455,7 +467,7 @@ def main():
for test in test_list:
# build test binary
- build(test.name, args.board)
+ build(test.name, args.board, args.compiler)
# flash test binary
# TODO(b/158327221): First attempt to flash fails after