mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-20 00:17:43 +00: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
45 lines
1.1 KiB
Python
Executable File
45 lines
1.1 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import os
|
|
import sys
|
|
import tempfile
|
|
|
|
|
|
def main():
|
|
(fd, filepath) = tempfile.mkstemp(dir=sys.argv[1])
|
|
|
|
x_before = os.lstat(filepath)
|
|
x = os.fstat(fd)
|
|
|
|
if x.st_size != x_before.st_size:
|
|
os.close(fd)
|
|
os.unlink(filepath)
|
|
print("fstat before unlink: size mismatch lstat={} fstat={}".format(x_before.st_size, x.st_size), end='')
|
|
return 1
|
|
|
|
if x.st_mode != x_before.st_mode:
|
|
os.close(fd)
|
|
os.unlink(filepath)
|
|
print("fstat before unlink: mode mismatch lstat={} fstat={}".format(x_before.st_mode, x.st_mode), end='')
|
|
return 1
|
|
|
|
os.unlink(filepath)
|
|
|
|
y = os.fstat(fd)
|
|
|
|
if y.st_nlink != 0:
|
|
os.close(fd)
|
|
print("fstat after unlink: expected nlink=0, got {}".format(y.st_nlink), end='')
|
|
return 1
|
|
|
|
if y.st_size != x.st_size:
|
|
os.close(fd)
|
|
print("fstat after unlink: size changed from {} to {}".format(x.st_size, y.st_size), end='')
|
|
return 1
|
|
|
|
os.close(fd)
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main()) |