2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-26 06:46:34 +00:00

Use existing setTimestamp function for ctime test and improve error checking.

This commit is contained in:
Courtney Bane 2019-04-23 22:39:13 -05:00
parent 35b7607802
commit 0ebfc55ee3

View File

@ -580,21 +580,14 @@ func TestFileChanged(t *testing.T) {
{ {
Name: "new-content-same-timestamp", Name: "new-content-same-timestamp",
Modify: func(t testing.TB, filename string) { Modify: func(t testing.TB, filename string) {
fi, _ := os.Stat(filename) fi, err := os.Stat(filename)
if err != nil {
t.Fatal(err)
}
extFI := fs.ExtendedStat(fi) extFI := fs.ExtendedStat(fi)
save(t, filename, bytes.ToUpper(defaultContent)) save(t, filename, bytes.ToUpper(defaultContent))
sleep() sleep()
ts := []syscall.Timespec{ setTimestamp(t, filename, extFI.AccessTime, extFI.ModTime)
{
Sec: extFI.AccessTime.Unix(),
Nsec: int64(extFI.AccessTime.Nanosecond()),
},
{
Sec: extFI.ModTime.Unix(),
Nsec: int64(extFI.ModTime.Nanosecond()),
},
}
syscall.UtimesNano(filename, ts)
}, },
}, },
{ {