From 48aa865e34c8d0294402e8292c9a5353f25e9b1a Mon Sep 17 00:00:00 2001 From: Adrian Villin Date: Tue, 13 May 2025 10:34:34 +0200 Subject: [PATCH] hs-test: add test timeout override Type: test Change-Id: If472c1539b0d4b864a9d004a02bbb6f54c43a565 Signed-off-by: Adrian Villin --- extras/hs-test/Makefile | 14 ++++++++++---- extras/hs-test/framework_test.go | 2 +- extras/hs-test/hs_test.sh | 3 +++ extras/hs-test/infra/hst_suite.go | 1 + 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/extras/hs-test/Makefile b/extras/hs-test/Makefile index 2d4ee4b6763..097ad09ff92 100644 --- a/extras/hs-test/Makefile +++ b/extras/hs-test/Makefile @@ -61,6 +61,10 @@ ifeq ($(NO_COLOR),) VERBOSE=false endif +ifeq ($(TIMEOUT),) +TIMEOUT=5 +endif + FORCE_BUILD?=true .PHONY: help @@ -99,6 +103,7 @@ help: @echo " CPU0=[true|false] - use cpu0" @echo " DRYRUN=[true|false] - set up containers but don't run tests" @echo " NO_COLOR=[true|false] - disables colorful Docker and Ginkgo output" + @echo " TIMEOUT=[minutes] - test timeout override (5 minutes by default)" .PHONY: list-tests list-tests: @@ -132,7 +137,7 @@ test: .deps.ok .build.ok @bash ./hs_test.sh --persist=$(PERSIST) --verbose=$(VERBOSE) \ --unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST) --cpus=$(CPUS) \ --vppsrc=$(VPPSRC) --parallel=$(PARALLEL) --repeat=$(REPEAT) --cpu0=$(CPU0) \ - --dryrun=$(DRYRUN) --skip=$(SKIP) --no_color=$(NO_COLOR); \ + --dryrun=$(DRYRUN) --skip=$(SKIP) --no_color=$(NO_COLOR) --timeout=$(TIMEOUT); \ ./script/compress.sh $$? .PHONY: test-debug @@ -141,7 +146,7 @@ test-debug: .deps.ok .build_debug.ok @bash ./hs_test.sh --persist=$(PERSIST) --verbose=$(VERBOSE) \ --unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST) --cpus=$(CPUS) \ --vppsrc=$(VPPSRC) --parallel=$(PARALLEL) --repeat=$(REPEAT) --debug_build=true \ - --cpu0=$(CPU0) --dryrun=$(DRYRUN) --skip=$(SKIP) --no_color=$(NO_COLOR); \ + --cpu0=$(CPU0) --dryrun=$(DRYRUN) --skip=$(SKIP) --no_color=$(NO_COLOR) --timeout=$(TIMEOUT); \ ./script/compress.sh $$? .PHONY: wipe-lcov @@ -153,13 +158,14 @@ test-cov: FORCE_BUILD=false test-cov: .deps.ok .build.cov.ok wipe-lcov @bash ./hs_test.sh --coverage=true --persist=$(PERSIST) --verbose=$(VERBOSE) \ --unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST-HS) --cpus=$(CPUS) \ - --vppsrc=$(VPPSRC) --cpu0=$(CPU0) --dryrun=$(DRYRUN) --skip=$(SKIP) --no_color=$(NO_COLOR); \ + --vppsrc=$(VPPSRC) --cpu0=$(CPU0) --dryrun=$(DRYRUN) --skip=$(SKIP) --no_color=$(NO_COLOR) \ + --timeout=$(TIMEOUT); \ ./script/compress.sh $$? $(MAKE) -C ../.. test-cov-post-standalone HS_TEST=1 .PHONY: test-leak test-leak: .deps.ok .build_debug.ok - @bash ./hs_test.sh --test=$(TEST) --debug_build=true --leak_check=true --vppsrc=$(VPPSRC) + @bash ./hs_test.sh --test=$(TEST) --debug_build=true --leak_check=true --vppsrc=$(VPPSRC) --timeout=$(TIMEOUT) .PHONY: test-perf test-perf: FORCE_BUILD=false diff --git a/extras/hs-test/framework_test.go b/extras/hs-test/framework_test.go index be62b61a057..66c5e50bd84 100644 --- a/extras/hs-test/framework_test.go +++ b/extras/hs-test/framework_test.go @@ -30,7 +30,7 @@ func TestHst(t *testing.T) { // 30 minute timeout so that the framework won't timeout while debugging TestTimeout = time.Minute * 30 } else { - TestTimeout = time.Minute * 5 + TestTimeout = time.Minute * time.Duration(*Timeout) } RunningInCi = os.Getenv("BUILD_NUMBER") != "" diff --git a/extras/hs-test/hs_test.sh b/extras/hs-test/hs_test.sh index 3323e39082b..37556fe7567 100644 --- a/extras/hs-test/hs_test.sh +++ b/extras/hs-test/hs_test.sh @@ -115,6 +115,9 @@ case "${i}" in --perf=*) perf="${i#*=}" ;; + --timeout=*) + args="$args -timeout ${i#*=}" + ;; esac done diff --git a/extras/hs-test/infra/hst_suite.go b/extras/hs-test/infra/hst_suite.go index dc63e7a30cb..49b1aa9958e 100644 --- a/extras/hs-test/infra/hst_suite.go +++ b/extras/hs-test/infra/hst_suite.go @@ -45,6 +45,7 @@ var IsLeakCheck = flag.Bool("leak_check", false, "run leak-check tests") var ParallelTotal = flag.Lookup("ginkgo.parallel.total") var DryRun = flag.Bool("dryrun", false, "set up containers but don't run tests") var SudoUser = flag.String("sudo_user", "root", "what user ran hs-test with sudo") +var Timeout = flag.Int("timeout", 5, "test timeout override (in minutes)") var NumaAwareCpuAlloc bool var TestTimeout time.Duration var RunningInCi bool -- 2.16.6