From e85f8dbcf2039dade64a2df3d9bee3473e88e4bc Mon Sep 17 00:00:00 2001 From: Pavel Safronov Date: Tue, 6 Jun 2023 17:21:39 -0700 Subject: [PATCH] Create the batsee output directory if one doesn't exist yet. Also adding the output directory to .gitignore. --- .gitignore | 1 + go/utils/batsee/main.go | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/.gitignore b/.gitignore index 92c13c9fdf..2322e1f91c 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ SysbenchDockerfile SysbenchDockerfile.dockerignore sysbench-runner-tests-entrypoint.sh config.json +integration-tests/bats/batsee_results diff --git a/go/utils/batsee/main.go b/go/utils/batsee/main.go index b1e92c47df..68bf6b6bc1 100644 --- a/go/utils/batsee/main.go +++ b/go/utils/batsee/main.go @@ -313,6 +313,17 @@ func runBats(path string, resultChan chan<- batsResult, ctx context.Context, cfg return } + // ensure cfg.output exists, and create it if it doesn't + if _, err := os.Stat(cfg.output); os.IsNotExist(err) { + err = os.Mkdir(cfg.output, 0755) + if err != nil { + cli.Println("Error creating output directory:", err.Error()) + result.err = err + resultChan <- result + return + } + } + startTime := time.Now() outPath := fmt.Sprintf("%s/%s.stdout.log", cfg.output, path)