aboutsummaryrefslogtreecommitdiff
path: root/integration_tests
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-11-12 21:18:18 +0100
committerJakob Unterwurzacher2015-11-12 21:18:18 +0100
commit2e3388800d028fee3e2b9cf6cfca2c878b7e6327 (patch)
treebfe66f629d6f10d0eee8256b776b7a555c9c2b33 /integration_tests
parent3664320fe5b4f5ec5bc398c84e9e48c8f529783a (diff)
tests: replace linux kernel untar test with synthetic small file creation
Diffstat (limited to 'integration_tests')
-rw-r--r--integration_tests/performance_test.go27
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)
+ }
+ }
}