restore: test timestamps for macOS resource forks are restored correctly

This commit is contained in:
Michael Eischer 2024-08-25 23:13:54 +02:00
parent 2e55209b34
commit 43b36ad2b0

View file

@ -197,6 +197,20 @@ var nodeTests = []Node{
{"user.foo", []byte("bar")},
},
},
{
Name: "testXattrFileMacOSResourceFork",
Type: "file",
Content: IDs{},
UID: uint32(os.Getuid()),
GID: uint32(os.Getgid()),
Mode: 0604,
ModTime: parseTime("2005-05-14 21:07:03.111"),
AccessTime: parseTime("2005-05-14 21:07:04.222"),
ChangeTime: parseTime("2005-05-14 21:07:05.333"),
ExtendedAttributes: []ExtendedAttribute{
{"com.apple.ResourceFork", []byte("bar")},
},
},
}
func TestNodeRestoreAt(t *testing.T) {
@ -216,6 +230,11 @@ func TestNodeRestoreAt(t *testing.T) {
extAttrArr[i].Name = strings.ToUpper(extAttrArr[i].Name)
}
}
for _, attr := range test.ExtendedAttributes {
if strings.HasPrefix(attr.Name, "com.apple.") && runtime.GOOS != "darwin" {
t.Skipf("attr %v only relevant on macOS", attr.Name)
}
}
// tempdir might be backed by a filesystem that does not support
// extended attributes