posixtest

package
v2.0.0-...-0d9a4c2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2025 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Overview

Package posixtest file systems for generic posix conformance.

Index

Constants

This section is empty.

Variables

View Source
var All = map[string]func(*testing.T, string){
	"AppendWrite":                AppendWrite,
	"DirSeek":                    DirSeek,
	"DirectIO":                   DirectIO,
	"Fallocate":                  Fallocate,
	"FallocateKeepSize":          FallocateKeepSize,
	"FcntlFlockLocksFile":        FcntlFlockLocksFile,
	"FcntlFlockSetLk":            FcntlFlockSetLk,
	"FdLeak":                     FdLeak,
	"FileBasic":                  FileBasic,
	"FstatDeleted":               FstatDeleted,
	"Link":                       Link,
	"LinkUnlinkRename":           LinkUnlinkRename,
	"LseekEnxioCheck":            LseekEnxioCheck,
	"LseekHoleSeeksToEOF":        LseekHoleSeeksToEOF,
	"MkdirRmdir":                 MkdirRmdir,
	"NlinkZero":                  NlinkZero,
	"OpenAt":                     OpenAt,
	"OpenSymlinkRace":            OpenSymlinkRace,
	"ParallelFileOpen":           ParallelFileOpen,
	"ReadDir":                    ReadDir,
	"ReadDirConsistency":         ReadDirConsistency,
	"RenameOpenDir":              RenameOpenDir,
	"RenameOverwriteDestExist":   RenameOverwriteDestExist,
	"RenameOverwriteDestNoExist": RenameOverwriteDestNoExist,
	"SetattrSymlink":             SetattrSymlink,
	"SymlinkReadlink":            SymlinkReadlink,
	"TruncateFile":               TruncateFile,
	"TruncateNoFile":             TruncateNoFile,
	"XAttr":                      XAttr,
}

All holds a map of all test functions

Functions

func AppendWrite

func AppendWrite(t *testing.T, mnt string)

test open with O_APPEND

func DirSeek

func DirSeek(t *testing.T, mnt string)

DirSeek tests that seeking on a directory works for https://github.com/4831c0/go-fuse/issues/344 .

Go port of xfstests generic/257.

Hint: $ go test ./fs -run TestPosix/DirSeek -v

func DirectIO

func DirectIO(t *testing.T, mnt string)

func Fallocate

func Fallocate(t *testing.T, mnt string)

func FallocateKeepSize

func FallocateKeepSize(t *testing.T, mnt string)

func FcntlFlockLocksFile

func FcntlFlockLocksFile(t *testing.T, mnt string)

func FcntlFlockSetLk

func FcntlFlockSetLk(t *testing.T, mnt string)

func FdLeak

func FdLeak(t *testing.T, mnt string)

func FileBasic

func FileBasic(t *testing.T, mnt string)

func FstatDeleted

func FstatDeleted(t *testing.T, mnt string)

FstatDeleted is similar to NlinkZero, but Fstat()s multiple deleted files in random order and checks that the results match an earlier Stat().

Excercises the fd-finding logic in rawBridge.GetAttr.

func Link(t *testing.T, mnt string)

func LinkUnlinkRename

func LinkUnlinkRename(t *testing.T, mnt string)

LinkUnlinkRename implements rename with a link/unlink sequence

func LseekEnxioCheck

func LseekEnxioCheck(t *testing.T, mnt string)

func LseekHoleSeeksToEOF

func LseekHoleSeeksToEOF(t *testing.T, mnt string)

func MkdirRmdir

func MkdirRmdir(t *testing.T, mnt string)

func NlinkZero

func NlinkZero(t *testing.T, mnt string)

func OpenAt

func OpenAt(t *testing.T, mnt string)

OpenAt tests syscall.Openat().

Hint: $ go test ./fs -run TestPosix/OpenAt -v

func OpenSymlinkRace

func OpenSymlinkRace(t *testing.T, mnt string)

Test if Open() is vulnerable to symlink-race attacks using two goroutines:

goroutine "shuffler": In a loop: * Replace empty file "OpenSymlinkRace" with a symlink pointing to /etc/passwd * Replace back with empty file

goroutine "opener": In a loop: * Open "OpenSymlinkRace" and call Fstat on it. Now there's three cases:

  1. Size=0: we opened the empty file created by shuffler. Normal and uninteresting.
  2. Size>0 but Dev number different: we (this test) opened /etc/passwd ourselves because we resolved the symlink. Normal.
  3. Size>0 and Dev number matches the FUSE mount: go-fuse opened /etc/passwd. The attack has worked.

func ParallelFileOpen

func ParallelFileOpen(t *testing.T, mnt string)

func ReadDir

func ReadDir(t *testing.T, mnt string)

ReadDir creates 110 files one by one, checking that we get the expected entries after each file creation.

func ReadDirConsistency

func ReadDirConsistency(t *testing.T, mnt string)

Creates files, read them back using readdir

func RenameOpenDir

func RenameOpenDir(t *testing.T, mnt string)

func RenameOverwrite

func RenameOverwrite(t *testing.T, mnt string, destExists bool)

func RenameOverwriteDestExist

func RenameOverwriteDestExist(t *testing.T, mnt string)

func RenameOverwriteDestNoExist

func RenameOverwriteDestNoExist(t *testing.T, mnt string)
func SetattrSymlink(t *testing.T, mnt string)
func SymlinkReadlink(t *testing.T, mnt string)

SymlinkReadlink tests basic symlink functionality

func TruncateFile

func TruncateFile(t *testing.T, mnt string)

func TruncateNoFile

func TruncateNoFile(t *testing.T, mnt string)

func XAttr

func XAttr(t *testing.T, mntDir string)

XAttr; they aren't posix but cross-platform enough to put into posixtest/

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL