aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2024-10-07 12:56:32 +0200
committerFlorin Coras <florin.coras@gmail.com>2024-10-07 17:27:26 +0000
commita3efc38e155eb3eccc674fbd06dfcff155220b42 (patch)
treeb7928726de2d80ae0a9d50d7c8baac375ac70c16
parent860916617dde9fcc857f3542fbc55c67653638ca (diff)
hs-test: force test failure when vpp core present
Type: test Change-Id: I874ee185a51dda9b620f3b783e466b8e88600d18 Signed-off-by: Matus Fabian <matfabia@cisco.com>
-rw-r--r--extras/hs-test/infra/hst_suite.go17
1 files changed, 11 insertions, 6 deletions
diff --git a/extras/hs-test/infra/hst_suite.go b/extras/hs-test/infra/hst_suite.go
index 8785fbf63d4..0de748b51c7 100644
--- a/extras/hs-test/infra/hst_suite.go
+++ b/extras/hs-test/infra/hst_suite.go
@@ -148,12 +148,16 @@ func (s *HstSuite) TearDownTest() {
if *IsPersistent {
return
}
- s.WaitForCoreDump()
+ coreDump := s.WaitForCoreDump()
s.ResetContainers()
if s.Ip4AddrAllocator != nil {
s.Ip4AddrAllocator.DeleteIpAddresses()
}
+
+ if coreDump {
+ Fail("VPP crashed")
+ }
}
func (s *HstSuite) SkipIfUnconfiguring() {
@@ -349,19 +353,19 @@ func (s *HstSuite) SkipUnlessLeakCheck() {
}
}
-func (s *HstSuite) WaitForCoreDump() {
+func (s *HstSuite) WaitForCoreDump() bool {
var filename string
dir, err := os.Open(s.getLogDirPath())
if err != nil {
s.Log(err)
- return
+ return false
}
defer dir.Close()
files, err := dir.Readdirnames(0)
if err != nil {
s.Log(err)
- return
+ return false
}
for _, file := range files {
if strings.Contains(file, "core") {
@@ -378,7 +382,7 @@ func (s *HstSuite) WaitForCoreDump() {
fileInfo, err := os.Stat(corePath)
if err != nil {
s.Log("Error while reading file info: " + fmt.Sprint(err))
- return
+ return true
}
currSize := fileInfo.Size()
s.Log(fmt.Sprintf("Waiting %ds/%ds...", i, timeout))
@@ -405,10 +409,11 @@ func (s *HstSuite) WaitForCoreDump() {
s.Log(err)
}
}
- return
+ return true
}
}
}
+ return false
}
func (s *HstSuite) ResetContainers() {