lntest: add flag -goroutinedump

This commit is contained in:
Johan T. Halseth 2019-04-15 16:28:01 +02:00
parent 8d5430dae3
commit 195a868455
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26
2 changed files with 11 additions and 1 deletions

@ -652,6 +652,11 @@ func (n *NetworkHarness) StopNode(node *HarnessNode) error {
// SaveProfilesPages hits profiles pages of all active nodes and writes it to
// disk using a similar naming scheme as to the regular set of logs.
func (n *NetworkHarness) SaveProfilesPages() {
// Only write gorutine dumps if flag is active.
if !(*goroutineDump) {
return
}
for _, node := range n.activeNodes {
if err := saveProfilesPage(node); err != nil {
fmt.Println(err)

@ -80,7 +80,12 @@ var (
// logOutput is a flag that can be set to append the output from the
// seed nodes to log files.
logOutput = flag.Bool("logoutput", false,
"log output from node n to file outputn.log")
"log output from node n to file output-n.log")
// goroutineDump is a flag that can be set to dump the active
// goroutines of test nodes on failure.
goroutineDump = flag.Bool("goroutinedump", false,
"write goroutine dump from node n to file pprof-n.log")
)
// generateListeningPorts returns three ints representing ports to listen on