diff options
author | Daniel Lublin <daniel@lublin.se> | 2018-06-18 20:12:38 +0200 |
---|---|---|
committer | Nikolaus Rath <Nikolaus@rath.org> | 2018-06-18 19:12:38 +0100 |
commit | f0452119e0e5365bd140e8dd47ff268d274f55de (patch) | |
tree | c302a30a447fd9b8e169573887a21664298ab91f /test/test_sshfs.py | |
parent | fb174704ddbaa086ed801cfbb5c8326d28140a92 (diff) | |
download | sshfs-f0452119e0e5365bd140e8dd47ff268d274f55de.tar sshfs-f0452119e0e5365bd140e8dd47ff268d274f55de.tar.gz sshfs-f0452119e0e5365bd140e8dd47ff268d274f55de.tar.bz2 sshfs-f0452119e0e5365bd140e8dd47ff268d274f55de.zip |
Make utimens(NULL) work correctly
Diffstat (limited to 'test/test_sshfs.py')
-rwxr-xr-x | test/test_sshfs.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/test_sshfs.py b/test/test_sshfs.py index caa7fda..04366fe 100755 --- a/test/test_sshfs.py +++ b/test/test_sshfs.py @@ -102,6 +102,7 @@ def test_sshfs(tmpdir, debug, cache_timeout, sync_rd, capfd): # SSHFS only supports one second resolution when setting # file timestamps. tst_utimens(mnt_dir, tol=1) + tst_utimens_now(mnt_dir) tst_link(mnt_dir, cache_timeout) tst_truncate_path(mnt_dir) @@ -403,6 +404,18 @@ def tst_utimens(mnt_dir, tol=0): assert abs(fstat.st_atime_ns - atime_ns) < tol*1e9 assert abs(fstat.st_mtime_ns - mtime_ns) < tol*1e9 +def tst_utimens_now(mnt_dir): + fullname = pjoin(mnt_dir, name_generator()) + + fd = os.open(fullname, os.O_CREAT | os.O_RDWR) + os.close(fd) + os.utime(fullname, None) + + fstat = os.lstat(fullname) + # We should get now-timestamps + assert fstat.st_atime != 0 + assert fstat.st_mtime != 0 + def tst_passthrough(src_dir, mnt_dir, cache_timeout): name = name_generator() src_name = pjoin(src_dir, name) |