diff --git a/.config/nextest.toml b/.config/nextest.toml index 7ce58a2f60..2e94aeaad8 100644 --- a/.config/nextest.toml +++ b/.config/nextest.toml @@ -9,3 +9,6 @@ retries = 2 [profile.postsubmit] # Do not retry tests in postsubmit to detect flaky tests. retries = 0 + +[profile.presubmit] +# Use default settings for presubmit diff --git a/tools/dev_container b/tools/dev_container index 5a821aacd1..6fbf44f66b 100755 --- a/tools/dev_container +++ b/tools/dev_container @@ -72,8 +72,6 @@ COMMON_ARGS = [ "--device /dev/kvm" if Path("/dev/kvm").is_char_device() else None, # Enable terminal colors f"--env TERM={os.environ.get('TERM', 'xterm-256color')}", - # Pass through NEXTEST_PROFILE for use by run_tests. - f"--env NEXTEST_PROFILE", ] DOCKER_ARGS = [ @@ -88,6 +86,11 @@ PODMAN_ARGS = [ "--pids-limit=4096" if os.name == "posix" else None, ] +# Environment variables to pass through to the container if they are specified. +ENV_PASSTHROUGH = [ + "NEXTEST_PROFILE", +] + def machine_is_running(docker: cmd): machine_state = docker("machine info").stdout() @@ -273,6 +276,14 @@ def main(argv: List[str]): else: docker_args.append(DEV_IMAGE_NAME + ":" + DEV_IMAGE_VERSION) + # Add environment variables to command line + exec_args: List[str] = [] + for key in ENV_PASSTHROUGH: + value = os.environ.get(key) + if value is not None: + exec_args.append("--env") + exec_args.append(f"{key}={quoted(value)}") + if args.self_test: TestDevContainer.docker = docker suite = unittest.defaultTestLoader.loadTestsFromTestCase(TestDevContainer) @@ -307,14 +318,14 @@ def main(argv: List[str]): if args.hermetic: # cmd is passed to entrypoint quoted_cmd = list(map(quoted, command)) - docker(f"run --rm", *tty_args, *docker_args, *quoted_cmd).fg() + docker(f"run --rm", *tty_args, *docker_args, *exec_args, *quoted_cmd).fg() else: # cmd is executed directly cid = ensure_container_is_alive(docker, docker_args, args.cros) if not command: command = ("/bin/bash",) quoted_cmd = list(map(quoted, command)) - docker("exec", *tty_args, cid, *quoted_cmd).fg() + docker("exec", *tty_args, *exec_args, cid, *quoted_cmd).fg() class TestDevContainer(unittest.TestCase): diff --git a/tools/run_tests b/tools/run_tests index 4bde0df18b..758610bd64 100755 --- a/tools/run_tests +++ b/tools/run_tests @@ -163,7 +163,6 @@ def get_vm_arch(triple: Triple): "--features", help=f"List of comma separated features to be passed to cargo. Defaults to `all-$platform`", ) -@argh.arg("--profile", help="Select nextest profile.") @argh.arg("--no-parallel", help="Do not parallelize integration tests. Slower but more stable.") @argh.arg("--repetitions", help="Repeat all tests, useful for checking test stability.") def main( @@ -177,7 +176,6 @@ def main( no_strip: bool = False, run_root_tests: bool = False, features: Optional[str] = None, - profile: Optional[str] = None, no_parallel: bool = False, repetitions: int = 1, ):