From 2e9180638e6fd00f5e89920a75b6badc27953ddd Mon Sep 17 00:00:00 2001 From: Greg Date: Tue, 25 Jan 2022 18:05:56 -0800 Subject: [PATCH] Fix test failures on Solaris Add exceptions for symlinks, sticky bits, and device nodes in the same places where the BSDSs and/or Darwin have them. --- cmd/restic/integration_helpers_test.go | 2 +- internal/restic/node_test.go | 4 ++-- internal/restic/node_unix_test.go | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cmd/restic/integration_helpers_test.go b/cmd/restic/integration_helpers_test.go index 1bbd41cb8..df9893350 100644 --- a/cmd/restic/integration_helpers_test.go +++ b/cmd/restic/integration_helpers_test.go @@ -67,7 +67,7 @@ func isSymlink(fi os.FileInfo) bool { func sameModTime(fi1, fi2 os.FileInfo) bool { switch runtime.GOOS { - case "darwin", "freebsd", "openbsd", "netbsd": + case "darwin", "freebsd", "openbsd", "netbsd", "solaris": if isSymlink(fi1) && isSymlink(fi2) { return true } diff --git a/internal/restic/node_test.go b/internal/restic/node_test.go index 5390a90ad..8139ee57b 100644 --- a/internal/restic/node_test.go +++ b/internal/restic/node_test.go @@ -210,7 +210,7 @@ func TestNodeRestoreAt(t *testing.T) { "%v: GID doesn't match (%v != %v)", test.Type, test.GID, n2.GID) if test.Type != "symlink" { // On OpenBSD only root can set sticky bit (see sticky(8)). - if runtime.GOOS != "openbsd" && runtime.GOOS != "netbsd" && test.Name == "testSticky" { + if runtime.GOOS != "openbsd" && runtime.GOOS != "netbsd" && runtime.GOOS != "solaris" && test.Name == "testSticky" { rtest.Assert(t, test.Mode == n2.Mode, "%v: mode doesn't match (0%o != 0%o)", test.Type, test.Mode, n2.Mode) } @@ -228,7 +228,7 @@ func AssertFsTimeEqual(t *testing.T, label string, nodeType string, t1 time.Time // Go currently doesn't support setting timestamps of symbolic links on darwin and bsd if nodeType == "symlink" { switch runtime.GOOS { - case "darwin", "freebsd", "openbsd", "netbsd": + case "darwin", "freebsd", "openbsd", "netbsd", "solaris": return } } diff --git a/internal/restic/node_unix_test.go b/internal/restic/node_unix_test.go index 0908d378e..204330824 100644 --- a/internal/restic/node_unix_test.go +++ b/internal/restic/node_unix_test.go @@ -93,7 +93,9 @@ func TestNodeFromFileInfo(t *testing.T) { // on darwin, users are not permitted to list the extended attributes of // /dev/null, therefore skip it. - if runtime.GOOS != "darwin" { + // on solaris, /dev/null is a symlink to a device node in /devices + // which does not support extended attributes, therefore skip it. + if runtime.GOOS != "darwin" && runtime.GOOS != "solaris" { tests = append(tests, Test{"/dev/null", true}) }