hs-test: force test failure when vpp core present
Type: test Change-Id: I874ee185a51dda9b620f3b783e466b8e88600d18 Signed-off-by: Matus Fabian <matfabia@cisco.com>
This commit is contained in:

committed by
Florin Coras

parent
860916617d
commit
a3efc38e15
@ -148,12 +148,16 @@ func (s *HstSuite) TearDownTest() {
|
|||||||
if *IsPersistent {
|
if *IsPersistent {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
s.WaitForCoreDump()
|
coreDump := s.WaitForCoreDump()
|
||||||
s.ResetContainers()
|
s.ResetContainers()
|
||||||
|
|
||||||
if s.Ip4AddrAllocator != nil {
|
if s.Ip4AddrAllocator != nil {
|
||||||
s.Ip4AddrAllocator.DeleteIpAddresses()
|
s.Ip4AddrAllocator.DeleteIpAddresses()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if coreDump {
|
||||||
|
Fail("VPP crashed")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *HstSuite) SkipIfUnconfiguring() {
|
func (s *HstSuite) SkipIfUnconfiguring() {
|
||||||
@ -349,19 +353,19 @@ func (s *HstSuite) SkipUnlessLeakCheck() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *HstSuite) WaitForCoreDump() {
|
func (s *HstSuite) WaitForCoreDump() bool {
|
||||||
var filename string
|
var filename string
|
||||||
dir, err := os.Open(s.getLogDirPath())
|
dir, err := os.Open(s.getLogDirPath())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.Log(err)
|
s.Log(err)
|
||||||
return
|
return false
|
||||||
}
|
}
|
||||||
defer dir.Close()
|
defer dir.Close()
|
||||||
|
|
||||||
files, err := dir.Readdirnames(0)
|
files, err := dir.Readdirnames(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.Log(err)
|
s.Log(err)
|
||||||
return
|
return false
|
||||||
}
|
}
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
if strings.Contains(file, "core") {
|
if strings.Contains(file, "core") {
|
||||||
@ -378,7 +382,7 @@ func (s *HstSuite) WaitForCoreDump() {
|
|||||||
fileInfo, err := os.Stat(corePath)
|
fileInfo, err := os.Stat(corePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.Log("Error while reading file info: " + fmt.Sprint(err))
|
s.Log("Error while reading file info: " + fmt.Sprint(err))
|
||||||
return
|
return true
|
||||||
}
|
}
|
||||||
currSize := fileInfo.Size()
|
currSize := fileInfo.Size()
|
||||||
s.Log(fmt.Sprintf("Waiting %ds/%ds...", i, timeout))
|
s.Log(fmt.Sprintf("Waiting %ds/%ds...", i, timeout))
|
||||||
@ -405,10 +409,11 @@ func (s *HstSuite) WaitForCoreDump() {
|
|||||||
s.Log(err)
|
s.Log(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *HstSuite) ResetContainers() {
|
func (s *HstSuite) ResetContainers() {
|
||||||
|
Reference in New Issue
Block a user