From 12dca65da1b8e849252e7e201101743b0d7e44f9 Mon Sep 17 00:00:00 2001 From: David Chase Date: Wed, 6 Oct 2021 15:48:58 -0400 Subject: [PATCH] benchmark should write to tmp dir, not ./testdata. Fixes #42. --- AUTHORS.txt | 1 + benchmark_test.go | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/AUTHORS.txt b/AUTHORS.txt index 5ec9443..805d105 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -6,6 +6,7 @@ Beyang Liu Brandon Mulcahy Chris McBride Craig Landry +David Chase Dimitri Sokolyuk Dmitri Shuralyov Elazar Leibovich diff --git a/benchmark_test.go b/benchmark_test.go index 808f17f..cc25d78 100644 --- a/benchmark_test.go +++ b/benchmark_test.go @@ -27,12 +27,17 @@ func BenchmarkBindata(b *testing.B) { b.Fatal(err) } b.SetBytes(size) + outDir, err := ioutil.TempDir("", "bench_bindata") + if err != nil { + b.Fatal(err) + } + defer os.RemoveAll(outDir) // clean up cfg := &bindata.Config{ Package: "assets", Input: []bindata.InputConfig{ {Path: "testdata/benchmark", Recursive: true}, }, - Output: "testdata/assets/bindata.go", + Output: filepath.Join(outDir, "bindata.go"), NoMemCopy: false, NoCompress: true, Debug: false,