aboutsummaryrefslogtreecommitdiff
path: root/tests/defaults
diff options
context:
space:
mode:
authorJakob Unterwurzacher2021-07-29 20:39:50 +0200
committerJakob Unterwurzacher2021-07-29 20:39:50 +0200
commit0ca302f12aa8be391d6b8e7081b5c75fbec2e872 (patch)
treebdf36873bb3a7cfc6cc5a3c14f63dede7d33c2a0 /tests/defaults
parente83b79b4c2e8619f0f9622bbafc39d04eeced3f0 (diff)
fusefrontend: implement fsync on directories
Fixes https://github.com/rfjakob/gocryptfs/issues/587
Diffstat (limited to 'tests/defaults')
-rw-r--r--tests/defaults/main_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/defaults/main_test.go b/tests/defaults/main_test.go
index b356f41..2513860 100644
--- a/tests/defaults/main_test.go
+++ b/tests/defaults/main_test.go
@@ -11,6 +11,7 @@ import (
"runtime"
"strings"
"sync"
+ "syscall"
"testing"
"github.com/rfjakob/gocryptfs/tests/test_helpers"
@@ -394,3 +395,30 @@ func TestMaxlen(t *testing.T) {
t.Errorf("wrong output: %s", string(out))
}
}
+
+func TestFsync(t *testing.T) {
+ fileName := test_helpers.DefaultPlainDir + "/" + t.Name() + ".file"
+ fileFD, err := syscall.Creat(fileName, 0600)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer syscall.Close(fileFD)
+ dirName := test_helpers.DefaultPlainDir + "/" + t.Name() + ".dir"
+ if err := os.Mkdir(dirName, 0700); err != nil {
+ t.Fatal(err)
+ }
+ dirFD, err := syscall.Open(dirName, syscall.O_RDONLY, 0)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer syscall.Close(dirFD)
+
+ err = syscall.Fsync(dirFD)
+ if err != nil {
+ t.Fatal(err)
+ }
+ err = syscall.Fsync(fileFD)
+ if err != nil {
+ t.Fatal(err)
+ }
+}