tests: replace linux kernel untar test with synthetic small file creation
This commit is contained in:
parent
3664320fe5
commit
2e3388800d
@ -1,8 +1,8 @@
|
|||||||
package integration_tests
|
package integration_tests
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"testing"
|
"testing"
|
||||||
@ -75,14 +75,25 @@ func BenchmarkStreamRead(t *testing.B) {
|
|||||||
file.Close()
|
file.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkUntar(t *testing.B) {
|
func BenchmarkCreate10B(t *testing.B) {
|
||||||
t.SetBytes(422229778)
|
dir := plainDir + "BenchmarkCreate10B"
|
||||||
c := exec.Command("tar", "xf", "/tmp/linux-3.0.tar.gz", "-C", plainDir)
|
err := os.RemoveAll(dir)
|
||||||
c.Stdout = os.Stdout
|
|
||||||
c.Stderr = os.Stderr
|
|
||||||
t.ResetTimer()
|
|
||||||
err := c.Run()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user