aboutsummaryrefslogtreecommitdiff
path: root/integration_tests/helpers.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-12-10 20:02:18 +0100
committerJakob Unterwurzacher2015-12-10 20:02:18 +0100
commit61ee2271c454047781afad6ded2e17e6efe20113 (patch)
treed2f6a45c34a6686b4247037b75671a89f861c68c /integration_tests/helpers.go
parent29336ba61425240e89878049853e0bf4fbd5c148 (diff)
tests: test read-write directory operations on all example filesystems
Diffstat (limited to 'integration_tests/helpers.go')
-rw-r--r--integration_tests/helpers.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/integration_tests/helpers.go b/integration_tests/helpers.go
index bff4e5b..b269069 100644
--- a/integration_tests/helpers.go
+++ b/integration_tests/helpers.go
@@ -1,6 +1,7 @@
package integration_tests
import (
+ "syscall"
"crypto/md5"
"encoding/hex"
"fmt"
@@ -51,6 +52,7 @@ func resetTmpDir() {
func mount(c string, p string, extraArgs ...string) {
var args []string
args = append(args, extraArgs...)
+ args = append(args, "-q")
//args = append(args, "--fusedebug")
args = append(args, c)
args = append(args, p)
@@ -113,3 +115,31 @@ func verifySize(t *testing.T, path string, want int) {
t.Errorf("wrong stat file size, got=%d want=%d", fi.Size(), want)
}
}
+
+// Create and delete a directory
+func testMkdirRmdir(t *testing.T, plainDir string) {
+ dir := plainDir + "dir1"
+ err := os.Mkdir(dir, 0777)
+ if err != nil {
+ t.Fatal(err)
+ }
+ err = syscall.Rmdir(dir)
+ if err != nil {
+ t.Fatal(err)
+ }
+}
+
+// Create and rename a file
+func testRename(t *testing.T, plainDir string) {
+ file1 := plainDir+"rename1"
+ file2 := plainDir+"rename2"
+ err := ioutil.WriteFile(file1, []byte("content"), 0777)
+ if err != nil {
+ t.Fatal(err)
+ }
+ err = syscall.Rename(file1, file2)
+ if err != nil {
+ t.Fatal(err)
+ }
+ syscall.Unlink(file2)
+}