mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 19:01:56 -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
1,011 B
Python
Executable file
41 lines
No EOL
1,011 B
Python
Executable file
#!/usr/bin/env python3
|
|
|
|
import os
|
|
import sys
|
|
import tempfile
|
|
|
|
|
|
def main():
|
|
(srcfd, src) = tempfile.mkstemp(dir=sys.argv[1])
|
|
(tgtfd, tgt) = tempfile.mkstemp(dir=sys.argv[1])
|
|
|
|
st_src_before = os.fstat(srcfd)
|
|
st_tgt_before = os.fstat(tgtfd)
|
|
|
|
os.unlink(tgt)
|
|
os.rename(src, tgt)
|
|
|
|
st_src_after = os.fstat(srcfd)
|
|
st_tgt_after = os.fstat(tgtfd)
|
|
|
|
if st_src_after.st_size != st_src_before.st_size:
|
|
os.close(srcfd)
|
|
os.close(tgtfd)
|
|
print("rename: src fd size changed before={} after={}".format(
|
|
st_src_before.st_size, st_src_after.st_size), end='')
|
|
return 1
|
|
|
|
if st_tgt_after.st_ino != st_tgt_before.st_ino:
|
|
os.close(srcfd)
|
|
os.close(tgtfd)
|
|
print("rename: tgt fd inode changed after unlink+rename expected={} got={}".format(
|
|
st_tgt_before.st_ino, st_tgt_after.st_ino), end='')
|
|
return 1
|
|
|
|
os.close(srcfd)
|
|
os.close(tgtfd)
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main()) |