From db7e23b4234f5eb5a814c5a578a798fe1244ec46 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Fri, 7 Apr 2017 20:37:20 +0200 Subject: [PATCH] Skip /dev/null on darwin --- src/restic/node_unix_test.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/restic/node_unix_test.go b/src/restic/node_unix_test.go index 0b8d20434..a9f0c5df1 100644 --- a/src/restic/node_unix_test.go +++ b/src/restic/node_unix_test.go @@ -4,6 +4,7 @@ package restic import ( "os" + "runtime" "syscall" "testing" "time" @@ -81,15 +82,21 @@ func checkDevice(t testing.TB, stat *syscall.Stat_t, node *Node) { } func TestNodeFromFileInfo(t *testing.T) { - var tests = []struct { + type Test struct { filename string canSkip bool - }{ + } + var tests = []Test{ {"node_test.go", false}, - {"/dev/null", true}, {"/dev/sda", true}, } + // on darwin, users are not permitted to list the extended attributes of + // /dev/null, therefore skip it. + if runtime.GOOS != "darwin" { + tests = append(tests, Test{"/dev/null", true}) + } + for _, test := range tests { t.Run("", func(t *testing.T) { fi, found := stat(t, test.filename)