tests: Remove more flags

This commit is contained in:
Alexander Neumann committed 2015-06-28 13:52:22 +02:00
1 parent 189a33730a
commit 26e4d2e019
8 files changed
+52 -87

No files matched your search

+2 -27
View File
@@ -5,12 +5,10 @@ import (
"crypto/md5"
"crypto/sha256"
"encoding/hex"
"flag"
"hash"
"io"
"io/ioutil"
"math/rand"
"os"
"testing"
"time"
@@ -18,8 +16,6 @@ import (
. "github.com/restic/restic/test"
)
var benchmarkFile = flag.String("bench.file", "", "read from this file for benchmark")
func parseDigest(s string) []byte {
d, err := hex.DecodeString(s)
if err != nil {
@@ -247,29 +243,8 @@ func TestChunkerWithoutHash(t *testing.T) {
}
func benchmarkChunker(b *testing.B, hash hash.Hash) {
var (
rd io.ReadSeeker
size int
)
if *benchmarkFile != "" {
b.Logf("using file %q for benchmark", *benchmarkFile)
f, err := os.Open(*benchmarkFile)
if err != nil {
b.Fatalf("open(%q): %v", *benchmarkFile, err)
}
fi, err := f.Stat()
if err != nil {
b.Fatalf("lstat(%q): %v", *benchmarkFile, err)
}
size = int(fi.Size())
rd = f
} else {
size = 10 * 1024 * 1024
rd = bytes.NewReader(getRandom(23, size))
}
size := 10 * 1024 * 1024
rd := bytes.NewReader(getRandom(23, size))
b.ResetTimer()
b.SetBytes(int64(size))