hs-test: force test failure when vpp core present
Type: test
Change-Id: I874ee185a51dda9b620f3b783e466b8e88600d18
Signed-off-by: Matus Fabian <matfabia@cisco.com>
diff --git a/extras/hs-test/infra/hst_suite.go b/extras/hs-test/infra/hst_suite.go
index 8785fbf..0de748b 100644
--- a/extras/hs-test/infra/hst_suite.go
+++ b/extras/hs-test/infra/hst_suite.go
@@ -148,12 +148,16 @@
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) 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 @@
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 @@
s.Log(err)
}
}
- return
+ return true
}
}
}
+ return false
}
func (s *HstSuite) ResetContainers() {