summaryrefslogtreecommitdiff
path: root/tests/reverse/correctness_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'tests/reverse/correctness_test.go')
-rw-r--r--tests/reverse/correctness_test.go36
1 files changed, 19 insertions, 17 deletions
diff --git a/tests/reverse/correctness_test.go b/tests/reverse/correctness_test.go
index a5719eb..40b53f9 100644
--- a/tests/reverse/correctness_test.go
+++ b/tests/reverse/correctness_test.go
@@ -1,6 +1,7 @@
package reverse_test
import (
+ "bytes"
"io/ioutil"
"os"
"syscall"
@@ -10,25 +11,26 @@ import (
"github.com/rfjakob/gocryptfs/tests/test_helpers"
)
+// TestLongnameStat checks that file names of all sizes (1 to 255) show up in
+// the decrypted reverse view (dirC, mounted in TestMain).
func TestLongnameStat(t *testing.T) {
- fd, err := os.Create(dirA + "/" + x240)
- if err != nil {
- t.Fatal(err)
- }
- path := dirC + "/" + x240
- if !test_helpers.VerifyExistence(path) {
- t.Fail()
- }
- test_helpers.VerifySize(t, path, 0)
- _, err = fd.Write(make([]byte, 10))
- if err != nil {
- t.Fatal(err)
+ for i := 1; i <= 255; i++ {
+ name := string(bytes.Repeat([]byte("x"), i))
+ fd, err := os.Create(dirA + "/" + name)
+ if err != nil {
+ t.Fatal(err)
+ }
+ fd.Close()
+ path := dirC + "/" + name
+ if !test_helpers.VerifyExistence(path) {
+ t.Fail()
+ }
+ test_helpers.VerifySize(t, path, 0)
+ // A large number of longname files is a performance problem in
+ // reverse mode. Delete the file once we are done with it to speed up
+ // the test (2 seconds -> 0.2 seconds)
+ syscall.Unlink(dirA + "/" + name)
}
- fd.Close()
- /*
- time.Sleep(1000 * time.Millisecond)
- test_helpers.VerifySize(t, path, 10)
- */
}
func TestSymlinks(t *testing.T) {