From 835924f5af2f15931e88ee9941c511fc58e0802d Mon Sep 17 00:00:00 2001 From: Amaury Chamayou Date: Thu, 14 Nov 2024 14:00:09 +0000 Subject: [PATCH] Fix node debugging in e2e tests (#6646) --- tests/infra/e2e_args.py | 11 ++++++++++- tests/infra/remote.py | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/infra/e2e_args.py b/tests/infra/e2e_args.py index 29d7e5a335b9..14782b40dabe 100644 --- a/tests/infra/e2e_args.py +++ b/tests/infra/e2e_args.py @@ -51,6 +51,13 @@ def max_f(args, number_nodes): return (number_nodes - 1) // 2 +def default_platform(): + if os.path.exists("PLATFORM"): + with open("PLATFORM") as f: + return f.read().strip() + return "virtual" + + def cli_args( add=lambda x: None, parser=None, @@ -110,7 +117,9 @@ def cli_args( "-t", "--enclave-platform", help="Enclave platform (Trusted Execution Environment)", - default=os.getenv("TEST_ENCLAVE", os.getenv("DEFAULT_ENCLAVE_PLATFORM", "sgx")), + default=os.getenv( + "TEST_ENCLAVE", os.getenv("DEFAULT_ENCLAVE_PLATFORM", default_platform()) + ), choices=("sgx", "snp", "virtual"), ) log_level_choices = ("trace", "debug", "info", "fail", "fatal") diff --git a/tests/infra/remote.py b/tests/infra/remote.py index c36c020c0af1..e7522d0734ef 100644 --- a/tests/infra/remote.py +++ b/tests/infra/remote.py @@ -19,7 +19,7 @@ from loguru import logger as LOG -DBG = os.getenv("DBG", "cgdb") +DBG = os.getenv("DBG", "lldb") # Duration after which unresponsive node is declared as crashed on startup REMOTE_STARTUP_TIMEOUT_S = 5 @@ -269,7 +269,7 @@ def get_cmd(self, include_dir=True): def debug_node_cmd(self): cmd = " ".join(self.cmd) - return f"cd {self.root} && {DBG} --args {cmd}" + return f"cd {self.root} && {DBG} -- {cmd}" def check_done(self): return self.proc is not None and self.proc.poll() is not None