aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2023-06-13 09:31:57 -0700
committerGitHub <noreply@github.com>2023-06-13 09:31:57 -0700
commitd0d1b08f8c49354de0a11a0f3dff44eea5eb8281 (patch)
tree5bdefc8656b257e8134427c88742d4ba9bc0612f
parent7b52ba3b7167acb4d8b38f4d4633112b4699cb26 (diff)
parent6c5455c025f6bd06353ca8803553b3c2c378501d (diff)
downloadriscv-tests-d0d1b08f8c49354de0a11a0f3dff44eea5eb8281.zip
riscv-tests-d0d1b08f8c49354de0a11a0f3dff44eea5eb8281.tar.gz
riscv-tests-d0d1b08f8c49354de0a11a0f3dff44eea5eb8281.tar.bz2
Merge pull request #476 from riscv-software-src/env_args
Get gcc and gdb path from environment.
-rw-r--r--debug/testlib.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/debug/testlib.py b/debug/testlib.py
index 26eac60..ba2bd7c 100644
--- a/debug/testlib.py
+++ b/debug/testlib.py
@@ -39,10 +39,7 @@ class CompileError(Exception):
gcc_cmd = None
def compile(args): # pylint: disable=redefined-builtin
- if gcc_cmd:
- cmd = [gcc_cmd]
- else:
- cmd = ["riscv64-unknown-elf-gcc"]
+ cmd = [gcc_cmd]
cmd.append("-g")
for arg in args:
found = find_file(arg)
@@ -607,7 +604,7 @@ class Gdb:
self.target = target
self.ports = ports
- self.cmd = cmd or "riscv64-unknown-elf-gdb"
+ self.cmd = cmd
self.timeout = timeout
self.binaries = binaries or [None] * len(ports)
@@ -1059,9 +1056,15 @@ def add_test_run_options(parser):
parser.add_argument("test", nargs='*',
help="Run only tests that are named here.")
parser.add_argument("--gcc",
- help="The command to use to start gcc.")
+ help="The command to use to start gcc. Defaults to the contents of "
+ "RISCV_TESTS_DEBUG_GCC, or riscv64-unknown-elf-gcc.",
+ default=os.environ.get("RISCV_TESTS_DEBUG_GCC",
+ "riscv64-unknown-elf-gcc"))
parser.add_argument("--gdb",
- help="The command to use to start gdb.")
+ help="The command to use to start gdb. Defaults to the contents of "
+ "RISCV_TESTS_DEBUG_GDB, or riscv64-unknown-elf-gdb.",
+ default=os.environ.get("RISCV_TESTS_DEBUG_GDB",
+ "riscv64-unknown-elf-gdb"))
parser.add_argument("--misaval",
help="Don't run ExamineTarget, just assume the misa value which is "
"specified.")