func execPgbench(b *testing.B, pgUrl url.URL) { c, err := pgbench.SetupExec(pgUrl, "bench", 20000, b.N) if err != nil { b.Fatal(err) } b.ResetTimer() out, err := c.CombinedOutput() if testing.Verbose() || err != nil { fmt.Println(string(out)) } if err != nil { b.Log(c) b.Fatal(err) } b.StopTimer() }
func execPgbench(b *testing.B, pgUrl url.URL) { if _, err := exec.LookPath("pgbench"); err != nil { b.Skip("pgbench is not available on PATH") } c, err := pgbench.SetupExec(pgUrl, "bench", 20000, b.N) if err != nil { b.Fatal(err) } b.ResetTimer() out, err := c.CombinedOutput() if testing.Verbose() || err != nil { fmt.Println(string(out)) } if err != nil { b.Log(c) b.Fatal(err) } b.StopTimer() }