mergerfs/tests
Antonio SJ Musumeci 11e759101d fix: make the preload helper correct on FreeBSD and safe on reopen
- The helper called Linux fgetxattr on FreeBSD. Read mergerfs.fullpath
  there through extattr_get_fd in EXTATTR_NAMESPACE_USER; Linux keeps
  user.mergerfs.fullpath.
- FreeBSD mode_t is promoted when passed through an ellipsis, so
  reading it back as mode_t was undefined. Read the promoted type.
- O_TMPFILE includes O_DIRECTORY on Linux, so a plain directory open
  consumed a mode argument that wasn't passed. Require O_CREAT or the
  whole nonzero O_TMPFILE mask.
- The backing path is returned without a terminating NUL. Reject empty
  or oversized values and terminate it before reopening; keep the
  already-open descriptor when no usable path is available.
- The reopen of the backing file repeated O_TRUNC, and creat() ran
  creat() again. The open through mergerfs had already truncated that
  file, so the second truncation could only destroy data another
  process wrote in between. Drop O_TRUNC from the reopen and reopen
  creat()ed files O_WRONLY.
- fopen and fopen64 reopened the branch path with the caller's mode,
  so w truncated a second time and a could recreate a name removed in
  between. Redirect only modes starting with r, including r+, as
  given, and keep the original stream otherwise; tooling.md says so.
  TEST_preload_fopen_modes checks the bytes and that a missing branch
  name is not created.
- fs_fstatat.hpp used AT_SYMLINK_NOFOLLOW without including fcntl.h,
  which failed against FreeBSD headers.
2026-11-29 23:11:08 -05:00
..
OPTIONS_TEST_PLAN.md Remove timed node removal 2026-05-06 20:49:46 -04:00
posix_parity.py test: never delete a fixture through a live mount 2026-11-29 23:10:57 -05:00
README.md make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
run-tests make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_api_xattr make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_cfg_link_rename_exdev test: disable minimum free space threshold in EXDEV tests 2026-11-06 11:24:54 -06:00
TEST_cfg_statfs_ignore make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_cfg_xattr_modes make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_dirents_allocation fix: keep readdir listings stable under fill errors 2026-11-29 23:11:07 -05:00
TEST_io_passthrough_create_open make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_io_passthrough_open_race make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_mount_lifecycle make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_movefile_enospc fix: pick the moveonenospc source and destination correctly 2026-11-29 23:10:59 -05:00
TEST_no_fuse_hidden make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_o_direct make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_open_after_unlink make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_policy_lup make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_posix_access make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_posix_bmap make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_posix_chmod make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_posix_chown make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_posix_copy_file_range make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_posix_create_mknod make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_posix_fsync_flush make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_posix_getattr_fgetattr make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_posix_ioctl make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_posix_link_symlink make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_posix_locking make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_posix_mkdir_rmdir make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_posix_open_read_write make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_posix_poll make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_posix_readdir make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_posix_readdir_plus make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_posix_release make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_posix_releasedir make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_posix_statfs make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_posix_statx make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_posix_syncfs make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_posix_tmpfile make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_posix_truncate_ftruncate make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_posix_unlink_rename make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_posix_utimens make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_posix_xattr make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_posix_xattr_matrix make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_preload_fopen_modes fix: make the preload helper correct on FreeBSD and safe on reopen 2026-11-29 23:11:08 -05:00
TEST_readdir_cor_cookie_replay fix: keep readdir listings stable under fill errors 2026-11-29 23:11:07 -05:00
TEST_readdir_cor_enomem fix: keep readdir listings stable under fill errors 2026-11-29 23:11:07 -05:00
TEST_readlink_semantics make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_release_metadata build: make NDEBUG=1 and make release build the release profile 2026-11-29 23:10:53 -05:00
TEST_release_pkg_preservation build: make NDEBUG=1 and make release build the release profile 2026-11-29 23:10:53 -05:00
TEST_rm_rf_concurrent test: don't let the default minfreespace fail the #1693 tests 2026-11-29 23:10:57 -05:00
TEST_rmdir_enotempty_priority make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_teardown_safety test: never delete a fixture through a live mount 2026-11-29 23:10:57 -05:00
TEST_unlink_rename make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_use_dirfd_after_rmdir test: don't let the default minfreespace fail the #1693 tests 2026-11-29 23:10:57 -05:00
TEST_use_fallocate_after_unlink make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_use_fchmod_after_unlink make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_use_fchown_after_unlink make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_use_fstat_after_unlink make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_use_ftruncate_after_unlink make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
TEST_use_futimens_after_unlink make all integration tests self-contained with ephemeral mounts 2026-05-07 21:47:40 -04:00
tests.cpp fix: make the statfs cache correct and its timeout configurable 2026-11-29 23:11:06 -05:00

POSIX Soft Conformance Suite

This directory contains integration tests that exercise mergerfs FUSE operations and compare behavior against equivalent native syscalls on a local filesystem.

The suite is "soft POSIX": it focuses on practical parity for return values, errno, and key side effects, including common error paths.

Each test mounts its own ephemeral mergerfs instance with random temporary branches and cleans everything up automatically.

Run with:

python3 tests/run-tests

Coverage Matrix

  • access -> TEST_posix_access
  • chmod / fchmod -> TEST_posix_chmod, TEST_use_fchmod_after_unlink
  • chown / fchown -> TEST_posix_chown, TEST_use_fchown_after_unlink
  • create / mknod -> TEST_posix_create_mknod
  • getattr / fgetattr -> TEST_posix_getattr_fgetattr, TEST_use_fstat_after_unlink
  • open / read / write -> TEST_posix_open_read_write, TEST_o_direct
  • flush / release / fsync / fsyncdir -> TEST_posix_fsync_flush
  • release close semantics -> TEST_posix_release
  • releasedir close semantics -> TEST_posix_releasedir
  • truncate / ftruncate -> TEST_posix_truncate_ftruncate, TEST_use_ftruncate_after_unlink
  • utimens / futimens -> TEST_posix_utimens, TEST_use_futimens_after_unlink
  • fallocate -> TEST_use_fallocate_after_unlink
  • copy_file_range -> TEST_posix_copy_file_range
  • ioctl -> TEST_posix_ioctl
  • poll -> TEST_posix_poll
  • tmpfile (O_TMPFILE) -> TEST_posix_tmpfile
  • bmap (via FIBMAP ioctl parity) -> TEST_posix_bmap
  • readlink -> TEST_readlink_semantics
  • link / symlink -> TEST_posix_link_symlink
  • mkdir / rmdir -> TEST_posix_mkdir_rmdir
  • unlink / rename -> TEST_posix_unlink_rename, TEST_unlink_rename
  • statfs -> TEST_posix_statfs
  • statx -> TEST_posix_statx
  • syncfs -> TEST_posix_syncfs
  • flock / lock -> TEST_posix_locking
  • setxattr / getxattr / listxattr / removexattr -> TEST_posix_xattr
  • xattr object/flag matrix (file, dir, symlink l*, create/replace) -> TEST_posix_xattr_matrix
  • xattr mode runtime toggles (passthrough/noattr/nosys) -> TEST_cfg_xattr_modes
  • statfs mode and statfs-ignore runtime toggles -> TEST_cfg_statfs_ignore
  • EXDEV fallback runtime toggles for link/rename -> TEST_cfg_link_rename_exdev
  • readdir (+ seek/tell behavior) -> TEST_posix_readdir
  • readdir_plus semantic parity (list+stat and readdir policy toggles) -> TEST_posix_readdir_plus
  • lifecycle (init/destroy) harness check -> TEST_mount_lifecycle
  • hidden temp exposure checks -> TEST_no_fuse_hidden

Error Conditions Emphasized

Across tests, parity checks include combinations of:

  • ENOENT
  • ENOTDIR
  • EEXIST
  • ENOTEMPTY
  • EISDIR
  • EBADF
  • privilege-sensitive outcomes (for example EPERM) where applicable

Notes

  • Some behavior is runtime/environment dependent (kernel, mount options, uid/gid, capabilities). Tests compare mergerfs to native behavior in the same runtime to keep assertions robust.
  • Tests that cannot exercise a behavior in the current environment may exit 77 and are reported as SKIP by tests/run-tests.
  • The xattr test uses a user.* key and assumes user xattrs are enabled.
  • Tests mount their own ephemeral mergerfs instances using the mergerfs_mount context manager in posix_parity.py. Random directories are created and cleaned up automatically.