fuse integration: verify TEST_MOUNT_POINT is a real mount

This commit is contained in:
Devin committed 2026-10-22 07:46:29 -07:00
1 parent 6f7e377c23
commit 41088e93f6
3 files changed
+30 -1

No files matched your search

+6
View File
@@ -103,6 +103,12 @@ func (f *FuseTestFramework) Setup(config *TestConfig) error {
return fmt.Errorf("existing mount point not accessible: %v", err)
}
// A plain directory passes every check below; refuse to run the suite
// against the local disk
if !mountedAt(existingMount) {
return fmt.Errorf("mount point %s is not a mounted filesystem", existingMount)
}
// Run inside a private work dir so test files do not pile up in
// the shared mount root and cleanup can remove only what it made
workDir, err := os.MkdirTemp(existingMount, ".fuse_test_")
+18 -1
View File
@@ -2,7 +2,10 @@
package fuse
import "syscall"
import (
"path/filepath"
"syscall"
)
// deviceID returns the device ID of the filesystem containing path.
func deviceID(path string) (uint64, error) {
@@ -12,3 +15,17 @@ func deviceID(path string) (uint64, error) {
}
return uint64(st.Dev), nil
}
// mountedAt reports whether something is actually mounted at path: a plain
// directory shares its parent's device, a mount point does not.
func mountedAt(path string) bool {
dev, err := deviceID(path)
if err != nil {
return false
}
parentDev, err := deviceID(filepath.Dir(path))
if err != nil {
return false
}
return dev != parentDev
}
@@ -8,3 +8,9 @@ package fuse
func deviceID(path string) (uint64, error) {
return 0, nil
}
// mountedAt cannot be detected off unix; report mounted so an external
// TEST_MOUNT_POINT keeps its best-effort write verification.
func mountedAt(path string) bool {
return true
}