slightly cleaner timeout solution
diff --git a/.bazelrc b/.bazelrc index ab8b222..669c58a 100644 --- a/.bazelrc +++ b/.bazelrc
@@ -85,15 +85,15 @@ # that fires when --test_tag_filters is set by both k_common and this config. test:virt_ast10x0 --test_tag_filters=-integration,-do_not_build,-do_not_run_test,-kernel_doc_test,-hardware -# Stress test configs — identical to the base configs but with --no-timeout in -# --run_under and +stress in test_tag_filters so only stress targets are run. +# Stress test configs — same platform/build flags as the base configs but with +# --timeout 0 in --run_under so the runner blocks indefinitely until FAIL. common:stress_virt_ast10x0 --platforms=//target/ast10x0 common:stress_virt_ast10x0 --//target/ast10x0:qemu=true build:stress_virt_ast10x0 --build_tag_filters=-do_not_build,-kernel_doc_test run:stress_virt_ast10x0 --run_under="//target/ast10x0/harness:qemu_runner \ - --no-timeout --cpu cortex-m4 --machine ast1030-evb --image " + --timeout 0 --cpu cortex-m4 --machine ast1030-evb --image " test:stress_virt_ast10x0 --run_under="//target/ast10x0/harness:qemu_runner \ - --no-timeout --cpu cortex-m4 --machine ast1030-evb --image " + --timeout 0 --cpu cortex-m4 --machine ast1030-evb --image " common:stress_k_ast1060_evb --platforms=//target/ast10x0 build:stress_k_ast1060_evb --build_tag_filters=-do_not_build,-kernel_doc_test test:stress_k_ast1060_evb --local_test_jobs=1
diff --git a/target/ast10x0/harness/qemu_runner.py b/target/ast10x0/harness/qemu_runner.py index 0ea4e46..e2a53ed 100644 --- a/target/ast10x0/harness/qemu_runner.py +++ b/target/ast10x0/harness/qemu_runner.py
@@ -41,7 +41,6 @@ PASS_SENTINEL = b"TEST_RESULT:PASS" FAIL_SENTINEL = b"TEST_RESULT:FAIL" -TIMEOUT_SECONDS = 30 def _parse_args(): @@ -56,9 +55,10 @@ "--qemu-args", nargs="*", help="Extra arguments to pass to qemu" ) parser.add_argument( - "--no-timeout", - action="store_true", - help="Run indefinitely; for stress tests that never emit PASS", + "--timeout", + type=int, + default=30, + help="Seconds to wait for a test result sentinel (0 = no timeout, default: 30)", ) return parser.parse_args() @@ -159,17 +159,14 @@ stdout_thread.start() try: - if args.no_timeout: - proc.wait() - else: - proc.wait(timeout=TIMEOUT_SECONDS) + proc.wait(timeout=args.timeout if args.timeout > 0 else None) except KeyboardInterrupt: proc.kill() proc.wait() except subprocess.TimeoutExpired: _LOG.error( "Test timed out after %ds — no sentinel detected", - TIMEOUT_SECONDS, + args.timeout, ) proc.kill() proc.wait()