Skip to content

Commit

Permalink
resources: Make the Exif benchmark filenames distinct
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed Sep 1, 2019
1 parent 3becba7 commit 4f50116
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion resources/image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
6 changes: 5 additions & 1 deletion resources/testhelpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4f50116

Please sign in to comment.