From: Adrian Villin Date: Wed, 11 Dec 2024 08:56:29 +0000 (+0100) Subject: hs-test: added a test counter and time elapsed X-Git-Tag: v25.06-rc0~83 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F06%2F41906%2F2;p=vpp.git hs-test: added a test counter and time elapsed - only works when not running in parallel Type: test Change-Id: Iab9881f8a2a93c6ef5129742e3c0ad950f9e5328 Signed-off-by: Adrian Villin --- diff --git a/extras/hs-test/infra/hst_suite.go b/extras/hs-test/infra/hst_suite.go index 1e189b62b8f..78cabb3eae9 100644 --- a/extras/hs-test/infra/hst_suite.go +++ b/extras/hs-test/infra/hst_suite.go @@ -104,6 +104,19 @@ type StringerStruct struct { Label string } +var testCounter uint16 +var startTime time.Time = time.Now() + +func testCounterFunc() { + if ParallelTotal.Value.String() != "1" { + return + } + testCounter++ + fmt.Printf("Test counter: %d\n"+ + "Time elapsed: %.2fs\n", + testCounter, time.Since(startTime).Seconds()) +} + // ColorableString for ReportEntry to use func (s StringerStruct) ColorableString() string { return fmt.Sprintf("{{red}}%s{{/}}", s.Label) @@ -233,6 +246,7 @@ func (s *HstSuite) SkipIfUnconfiguring() { } func (s *HstSuite) SetupTest() { + testCounterFunc() s.Log("[* TEST SETUP]") s.StartedContainers = s.StartedContainers[:0] s.SkipIfUnconfiguring()