mirror of
https://github.com/restic/restic.git
synced 2024-12-25 17:27:25 +00:00
Use existing setTimestamp function for ctime test and improve error checking.
This commit is contained in:
parent
35b7607802
commit
0ebfc55ee3
1 changed files with 5 additions and 12 deletions
|
@ -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 a new issue