• Jakob Unterwurzacher's avatar
    fuse: add unit-tests for loopback Utimens() · f48dd028
    Jakob Unterwurzacher authored
    Tests loopbackFileSystem.Utimens() and loopbackfile.Utimens()
    at 1-second precision.
    
    The exising TestUtimesNano() test only works on Linux
    because it relies on syscall.UtimesNano(), which is not
    available on Darwin. The new tests call the Utimens()
    functions directly, bypassing FUSE, and work on all
    platforms.
    
    Because Darwin does not have syscall.UtimesNano(),
    getting the Utimens() implementation right is hard.
    
    The tests currently fail on Darwin, underlining the
    need for them ( https://github.com/rfjakob/gocryptfs/issues/229 ):
    
    $ go test ./fuse/nodefs
    [...]
    --- FAIL: TestLoopbackFileUtimens (0.00s)
    	helpers.go:51: mtime has changed: 1525384186 -> 1073
    	helpers.go:70: atime has changed: 1525291058 -> 1073
    [...]
    
    $ go test ./fuse/pathfs
    --- FAIL: TestLoopbackFileSystemUtimens (0.00s)
    	helpers.go:51: mtime has changed: 1525384379 -> 1073
    	helpers.go:70: atime has changed: 1525291058 -> 1073
    [...]
    f48dd028
loopback_test.go 851 Bytes