diff options
author | Matus Fabian <matfabia@cisco.com> | 2024-08-23 15:52:54 +0200 |
---|---|---|
committer | Matus Fabian <matfabia@cisco.com> | 2024-08-23 15:52:54 +0200 |
commit | 4306a3e8f4f8016e7571be75b6418b77ee2f701d (patch) | |
tree | bf339a0e723dffedc50bf8a9f72193be7a0a105f /extras/hs-test/infra/hst_suite.go | |
parent | 225e6f86a4fdc6ec00da4527e7697cd122b16783 (diff) |
hs-test: core dump improvement
- load vpp plugin libraries path in gdb
- if core dump deceted change message in summary and show bt
Type: test
Change-Id: If5d44d29703edd16c816efc9d29e6a7a1b20613a
Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'extras/hs-test/infra/hst_suite.go')
-rw-r--r-- | extras/hs-test/infra/hst_suite.go | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/extras/hs-test/infra/hst_suite.go b/extras/hs-test/infra/hst_suite.go index 21e4f098d9a..82734be9f3d 100644 --- a/extras/hs-test/infra/hst_suite.go +++ b/extras/hs-test/infra/hst_suite.go @@ -5,6 +5,7 @@ import ( "errors" "flag" "fmt" + "github.com/edwarnicke/exechelper" "io" "log" "net/http" @@ -330,7 +331,6 @@ func (s *HstSuite) SkipUnlessLeakCheck() { func (s *HstSuite) WaitForCoreDump() { var filename string - var cmd *exec.Cmd dir, err := os.Open(s.getLogDirPath()) if err != nil { s.Log(err) @@ -352,10 +352,10 @@ func (s *HstSuite) WaitForCoreDump() { waitTime := 5 if filename != "" { - filename := s.getLogDirPath() + filename - s.Log(fmt.Sprintf("WAITING FOR CORE DUMP (%s)", filename)) + corePath := s.getLogDirPath() + filename + s.Log(fmt.Sprintf("WAITING FOR CORE DUMP (%s)", corePath)) for i := waitTime; i <= timeout; i += waitTime { - fileInfo, err := os.Stat(filename) + fileInfo, err := os.Stat(corePath) if err != nil { s.Log("Error while reading file info: " + fmt.Sprint(err)) return @@ -363,25 +363,24 @@ func (s *HstSuite) WaitForCoreDump() { currSize := fileInfo.Size() s.Log(fmt.Sprintf("Waiting %ds/%ds...", i, timeout)) time.Sleep(time.Duration(waitTime) * time.Second) - fileInfo, _ = os.Stat(filename) + fileInfo, _ = os.Stat(corePath) if currSize == fileInfo.Size() { + debug := "" if *IsDebugBuild { - cmd = exec.Command("sudo", "gdb", "../../build-root/build-vpp_debug-native/vpp/bin/vpp", - "-c", filename, "-ex", "bt", "full", "-ex", "quit") - } else { - cmd = exec.Command("sudo", "gdb", "../../build-root/build-vpp-native/vpp/bin/vpp", - "-c", filename, "-ex", "bt", "full", "-ex", "quit") + debug = "_debug" } - + vppBinPath := fmt.Sprintf("../../build-root/build-vpp%s-native/vpp/bin/vpp", debug) + pluginsLibPath := fmt.Sprintf("build-root/build-vpp%s-native/vpp/lib/x86_64-linux-gnu/vpp_plugins", debug) + cmd := fmt.Sprintf("sudo gdb %s -c %s -ex 'set solib-search-path %s/%s' -ex 'bt full' -batch", vppBinPath, corePath, *VppSourceFileDir, pluginsLibPath) s.Log(cmd) - output, _ := cmd.Output() + output, _ := exechelper.Output(cmd) AddReportEntry("VPP Backtrace", StringerStruct{Label: string(output)}) os.WriteFile(s.getLogDirPath()+"backtrace.log", output, os.FileMode(0644)) if s.CpuAllocator.runningInCi { - err = os.Remove(filename) + err = os.Remove(corePath) if err == nil { - s.Log("removed " + filename) + s.Log("removed " + corePath) } else { s.Log(err) } |