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:
parent
35b7607802
commit
0ebfc55ee3
@ -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)
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user