macos: adjust TestTooLongSymlink length for darwin

Limit is much lower than on linux
This commit is contained in:
Jakob Unterwurzacher 2018-03-05 21:23:57 +01:00
parent 7db5395c53
commit b820fa691d
1 changed files with 6 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"os" "os"
"runtime"
"syscall" "syscall"
"testing" "testing"
@ -185,8 +186,12 @@ func TestEnoent(t *testing.T) {
// returning an I/O error to the user. // returning an I/O error to the user.
// https://github.com/rfjakob/gocryptfs/issues/167 // https://github.com/rfjakob/gocryptfs/issues/167
func TestTooLongSymlink(t *testing.T) { func TestTooLongSymlink(t *testing.T) {
l := 4000
if runtime.GOOS == "darwin" {
l = 1000 // max length is much lower on darwin
}
fn := dirA + "/TooLongSymlink" fn := dirA + "/TooLongSymlink"
target := string(bytes.Repeat([]byte("x"), 4000)) target := string(bytes.Repeat([]byte("x"), l))
err := os.Symlink(target, fn) err := os.Symlink(target, fn)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)