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
61 lines
1.5 KiB
Python
Executable File
61 lines
1.5 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import os
|
|
import sys
|
|
import tempfile
|
|
|
|
from posix_parity import cleanup_dir
|
|
from posix_parity import compare_calls
|
|
from posix_parity import fail
|
|
from posix_parity import join
|
|
from posix_parity import temp_dir
|
|
|
|
|
|
def statvfs_cmp(lhs, rhs):
|
|
return (
|
|
lhs.f_namemax == rhs.f_namemax
|
|
and lhs.f_bsize == rhs.f_bsize
|
|
and lhs.f_frsize == rhs.f_frsize
|
|
and lhs.f_bsize > 0
|
|
and lhs.f_frsize > 0
|
|
)
|
|
|
|
|
|
def main():
|
|
if len(sys.argv) != 2:
|
|
print("usage: TEST_posix_statfs <mountpoint>", file=sys.stderr)
|
|
return 1
|
|
|
|
mount = sys.argv[1]
|
|
|
|
with tempfile.TemporaryDirectory() as native:
|
|
merge_base = temp_dir(mount)
|
|
try:
|
|
native_base = join(native, os.path.basename(merge_base))
|
|
os.makedirs(native_base, exist_ok=True)
|
|
|
|
err = compare_calls(
|
|
"statvfs mount parity",
|
|
lambda: os.statvfs(mount),
|
|
lambda: os.statvfs(native),
|
|
statvfs_cmp,
|
|
)
|
|
if err:
|
|
return fail(err)
|
|
|
|
err = compare_calls(
|
|
"statvfs ENOENT",
|
|
lambda: os.statvfs(join(merge_base, "missing")),
|
|
lambda: os.statvfs(join(native_base, "missing")),
|
|
)
|
|
if err:
|
|
return fail(err)
|
|
|
|
return 0
|
|
finally:
|
|
cleanup_dir(merge_base)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|