2
2
mirror of https://github.com/octoleo/restic.git synced 2025-04-07 07:21:50 +00:00

Skip /dev/null on darwin

This commit is contained in:
Alexander Neumann 2017-04-07 20:37:20 +02:00
parent 10a395ca33
commit db7e23b423

View File

@ -4,6 +4,7 @@ package restic
import ( import (
"os" "os"
"runtime"
"syscall" "syscall"
"testing" "testing"
"time" "time"
@ -81,15 +82,21 @@ func checkDevice(t testing.TB, stat *syscall.Stat_t, node *Node) {
} }
func TestNodeFromFileInfo(t *testing.T) { func TestNodeFromFileInfo(t *testing.T) {
var tests = []struct { type Test struct {
filename string filename string
canSkip bool canSkip bool
}{ }
var tests = []Test{
{"node_test.go", false}, {"node_test.go", false},
{"/dev/null", true},
{"/dev/sda", 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 { for _, test := range tests {
t.Run("", func(t *testing.T) { t.Run("", func(t *testing.T) {
fi, found := stat(t, test.filename) fi, found := stat(t, test.filename)