From: Bjørn Erik Pedersen Date: Sun, 1 Sep 2019 20:05:39 +0000 (+0200) Subject: resources: Make the Exif benchmark filenames distinct X-Git-Tag: v0.58.0~18 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=4f5011692a22762e213e872fd9e39d015141083f;p=brevno-suite%2Fhugo resources: Make the Exif benchmark filenames distinct --- diff --git a/resources/image_test.go b/resources/image_test.go index dc5e0a21..6d879d27 100644 --- a/resources/image_test.go +++ b/resources/image_test.go @@ -366,7 +366,7 @@ func BenchmarkImageExif(b *testing.B) { spec := newTestResourceSpec(specDescriptor{fs: fs, c: c}) images := make([]resource.Image, b.N) for i := 0; i < b.N; i++ { - images[i] = fetchImageForSpec(spec, c, "sunset.jpg") + images[i] = fetchResourceForSpec(spec, c, "sunset.jpg", strconv.Itoa(i)).(resource.Image) } return images } diff --git a/resources/testhelpers_test.go b/resources/testhelpers_test.go index bc24fb8f..3e072545 100644 --- a/resources/testhelpers_test.go +++ b/resources/testhelpers_test.go @@ -154,10 +154,14 @@ func fetchImageForSpec(spec *Spec, c *qt.C, name string) resource.Image { return img } -func fetchResourceForSpec(spec *Spec, c *qt.C, name string) resource.ContentResource { +func fetchResourceForSpec(spec *Spec, c *qt.C, name string, targetPathAddends ...string) resource.ContentResource { src, err := os.Open(filepath.FromSlash("testdata/" + name)) c.Assert(err, qt.IsNil) workDir := spec.WorkingDir + if len(targetPathAddends) > 0 { + addends := strings.Join(targetPathAddends, "_") + name = addends + "_" + name + } targetFilename := filepath.Join(workDir, name) out, err := helpers.OpenFileForWriting(spec.Fs.Source, targetFilename) c.Assert(err, qt.IsNil)