Skip to content

Commit

Permalink
fix: Auto clean gluon-bench folder
Browse files Browse the repository at this point in the history
Cleanup generated benchmark data on exit. Use `-skip-cleanup` to keep
the generated data.
  • Loading branch information
LBeernaertProton committed Sep 21, 2022
1 parent 3a05bd1 commit 47a7565
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions benchmarks/gluon_bench/benchmark/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,13 @@ func measureBenchmark(dirConfig BenchDirConfig, iteration uint, bench Benchmark)
panic(fmt.Sprintf("Failed to teardown benchmark %v: %v", bench.Name(), err))
}

if !*flags.SkipClean {
fmt.Printf("Cleaning benchmark dir: %v\n", benchPath)

if err := os.RemoveAll(benchPath); err != nil {
fmt.Fprintf(os.Stderr, "Failed to remote benchmark data dir '%v': %v\n", benchPath, err)
}
}

return reporter.NewBenchmarkStatistics(benchRun.Extra, benchRun.Durations...)
}
1 change: 1 addition & 0 deletions benchmarks/gluon_bench/flags/general.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ var (
Connector = flag.String("connector", "dummy", "Key of the connector implementation registered with ConnectorFactory.")
UserName = flag.String("user-name", "user", "Username for the connector user, defaults to 'user'.")
UserPassword = flag.String("user-pwd", "password", "Password for the connector user, defaults to 'password'.")
SkipClean = flag.Bool("skip-clean", false, "Do not cleanup benchmark data directory.")
)

0 comments on commit 47a7565

Please sign in to comment.