diff options
Diffstat (limited to 'integration_tests/performance_test.go')
-rw-r--r-- | integration_tests/performance_test.go | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/integration_tests/performance_test.go b/integration_tests/performance_test.go index e4a618a..7667243 100644 --- a/integration_tests/performance_test.go +++ b/integration_tests/performance_test.go @@ -1,8 +1,8 @@ package integration_tests import ( + "io/ioutil" "os" - "os/exec" "fmt" "io" "testing" @@ -75,14 +75,25 @@ func BenchmarkStreamRead(t *testing.B) { file.Close() } -func BenchmarkUntar(t *testing.B) { - t.SetBytes(422229778) - c := exec.Command("tar", "xf", "/tmp/linux-3.0.tar.gz", "-C", plainDir) - c.Stdout = os.Stdout - c.Stderr = os.Stderr - t.ResetTimer() - err := c.Run() +func BenchmarkCreate10B(t *testing.B) { + dir := plainDir + "BenchmarkCreate10B" + err := os.RemoveAll(dir) + if err != nil { + t.Fatal(err) + } + err = os.Mkdir(dir, 0777) if err != nil { t.Fatal(err) } + buf := []byte("1234567890") + t.SetBytes(int64(len(buf))) + t.ResetTimer() + var i int + for i = 0; i < t.N; i++ { + file := fmt.Sprintf("%s/%d", dir, i) + err = ioutil.WriteFile(file, buf, 0666) + if err != nil { + t.Fatal(err) + } + } } |