mirror of https://github.com/trapexit/mergerfs.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.1 KiB
51 lines
1.1 KiB
#!/usr/bin/env python3
|
|
|
|
import os
|
|
import sys
|
|
import tempfile
|
|
|
|
from posix_parity import compare_calls
|
|
from posix_parity import fail
|
|
from posix_parity import join
|
|
|
|
|
|
def statvfs_cmp(lhs, rhs):
|
|
return (
|
|
lhs.f_namemax == rhs.f_namemax
|
|
and lhs.f_bsize > 0
|
|
and rhs.f_bsize > 0
|
|
and lhs.f_frsize > 0
|
|
and rhs.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:
|
|
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(mount, "posix-statfs/missing")),
|
|
lambda: os.statvfs(join(native, "posix-statfs/missing")),
|
|
)
|
|
if err:
|
|
return fail(err)
|
|
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|