aboutsummaryrefslogtreecommitdiff
path: root/tests/reverse/correctness_test.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-10-10 22:38:22 +0200
committerJakob Unterwurzacher2018-10-10 22:40:55 +0200
commit4f2feb1be7530d4fca7061b89d61f3ffc5761a0b (patch)
tree148748c3183425a5f369969a975e748c8c0d5a94 /tests/reverse/correctness_test.go
parent5a1ebdb4f7449759656a1344d3c63ba3798e2782 (diff)
tests: catch "name too long" symlink failure on XFS
Retry with length 1000 if length 4000 fails, which should work on all filesystems. Failure was: --- FAIL: TestTooLongSymlink (0.00s) correctness_test.go:198: symlink xxx[...]xxxx /tmp/xfs.mnt/gocryptfs-test-parent/549823072/365091391/TooLongSymlink: file name too long https://github.com/rfjakob/gocryptfs/issues/267
Diffstat (limited to 'tests/reverse/correctness_test.go')
-rw-r--r--tests/reverse/correctness_test.go19
1 files changed, 12 insertions, 7 deletions
diff --git a/tests/reverse/correctness_test.go b/tests/reverse/correctness_test.go
index 62e3bbc..246936b 100644
--- a/tests/reverse/correctness_test.go
+++ b/tests/reverse/correctness_test.go
@@ -5,7 +5,6 @@ import (
"fmt"
"io/ioutil"
"os"
- "runtime"
"syscall"
"testing"
@@ -187,16 +186,22 @@ func TestEnoent(t *testing.T) {
// returning an I/O error to the user.
// https://github.com/rfjakob/gocryptfs/issues/167
func TestTooLongSymlink(t *testing.T) {
- l := 4000
- if runtime.GOOS == "darwin" {
- l = 1000 // max length is much lower on darwin
- }
+ var err error
+ var l int
fn := dirA + "/TooLongSymlink"
- target := string(bytes.Repeat([]byte("x"), l))
- err := os.Symlink(target, fn)
+ // Try 4000 first (works on ext4 and tmpfs), then retry with 1000 (XFS and
+ // Darwin have a limit of about 1024)
+ for _, l = range []int{4000, 1000} {
+ target := string(bytes.Repeat([]byte("x"), l))
+ err = os.Symlink(target, fn)
+ if err == nil {
+ break
+ }
+ }
if err != nil {
t.Fatal(err)
}
+ t.Logf("Created symlink of length %d", l)
_, err = os.Readlink(dirC + "/TooLongSymlink")
if err == nil {
return