hs-test: debugging utility methods

Type: test

Change-Id: I0c7e8424e53f1ad1896cd8439027e6081ccfeb28
Signed-off-by: Matus Fabian <matfabia@cisco.com>
This commit is contained in:
Matus Fabian
2024-09-20 10:44:08 +02:00
parent 2fb8d2f96d
commit 147585e7f6
2 changed files with 63 additions and 14 deletions

View File

@@ -619,3 +619,28 @@ func (vpp *VppInstance) MemLeakCheck(first, second []VppMemTrace) {
summary := fmt.Sprintf("\nSUMMARY: %d byte(s) leaked in %d allocation(s)\n", totalBytes, totalCounts)
AddReportEntry(summary, report)
}
// CollectEventLogs saves event logs to the test execution directory
func (vpp *VppInstance) CollectEventLogs() {
vpp.getSuite().Log(vpp.Vppctl("event-logger save event_log"))
targetDir := vpp.Container.Suite.getLogDirPath()
err := vpp.Container.GetFile("/tmp/event_log", targetDir+"/"+vpp.Container.Name+"-event_log")
if err != nil {
vpp.getSuite().Log(fmt.Sprint(err))
}
}
// EnablePcapTrace enables packet capture on all interfaces and maximum 10000 packets
func (vpp *VppInstance) EnablePcapTrace() {
vpp.getSuite().Log(vpp.Vppctl("pcap trace rx tx max 10000 intfc any file vppTest.pcap"))
}
// CollectPcapTrace saves pcap trace to the test execution directory
func (vpp *VppInstance) CollectPcapTrace() {
vpp.getSuite().Log(vpp.Vppctl("pcap trace off"))
targetDir := vpp.Container.Suite.getLogDirPath()
err := vpp.Container.GetFile("/tmp/vppTest.pcap", targetDir+"/"+vpp.Container.Name+".pcap")
if err != nil {
vpp.getSuite().Log(fmt.Sprint(err))
}
}