mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 02:48:59 -04:00
- Make the test runner fail on failed tests and report explicit skips - Strengthen assertions for O_DIRECT, LUP policy, EXDEV fallback, and xattrs - Fix cleanup and file descriptor handling across test scripts
41 lines
No EOL
970 B
Python
Executable file
41 lines
No EOL
970 B
Python
Executable file
#!/usr/bin/env python3
|
|
|
|
import os
|
|
import sys
|
|
import tempfile
|
|
|
|
|
|
def main():
|
|
atime = 1234
|
|
mtime = 5678
|
|
(fd, filepath) = tempfile.mkstemp(dir=sys.argv[1])
|
|
|
|
os.utime(fd, (atime, mtime))
|
|
|
|
st1 = os.fstat(fd)
|
|
if st1.st_atime != atime or st1.st_mtime != mtime:
|
|
os.close(fd)
|
|
os.unlink(filepath)
|
|
print("futimens before unlink: expected atime={} mtime={}, got atime={} mtime={}".format(
|
|
atime, mtime, st1.st_atime, st1.st_mtime), end='')
|
|
return 1
|
|
|
|
os.unlink(filepath)
|
|
|
|
atime2 = 9999
|
|
mtime2 = 8888
|
|
os.utime(fd, (atime2, mtime2))
|
|
|
|
st2 = os.fstat(fd)
|
|
if st2.st_atime != atime2 or st2.st_mtime != mtime2:
|
|
os.close(fd)
|
|
print("futimens after unlink: expected atime={} mtime={}, got atime={} mtime={}".format(
|
|
atime2, mtime2, st2.st_atime, st2.st_mtime), end='')
|
|
return 1
|
|
|
|
os.close(fd)
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main()) |