hs-test: add test timeout override 83/42883/2
authorAdrian Villin <avillin@cisco.com>
Tue, 13 May 2025 08:34:34 +0000 (10:34 +0200)
committerAdrian Villin <avillin@cisco.com>
Tue, 13 May 2025 08:40:59 +0000 (10:40 +0200)
Type: test

Change-Id: If472c1539b0d4b864a9d004a02bbb6f54c43a565
Signed-off-by: Adrian Villin <avillin@cisco.com>
extras/hs-test/Makefile
extras/hs-test/framework_test.go
extras/hs-test/hs_test.sh
extras/hs-test/infra/hst_suite.go

index 2d4ee4b..097ad09 100644 (file)
@@ -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
index be62b61..66c5e50 100644 (file)
@@ -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") != ""
index 3323e39..37556fe 100644 (file)
@@ -115,6 +115,9 @@ case "${i}" in
     --perf=*)
         perf="${i#*=}"
         ;;
+    --timeout=*)
+        args="$args -timeout ${i#*=}"
+        ;;
 esac
 done
 
index dc63e7a..49b1aa9 100644 (file)
@@ -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