fstesting

package module
v0.0.0-...-8b575cd Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2018 License: MIT Imports: 16 Imported by: 0

README

fstesting - File System testing suite

fstesting is a go package for testing filesystem implementations, in particular file systems that implement the absfs.FileSystem interface.

fstesting is in early development. More to come.

absfs

Check out the absfs repo for more information about the abstract filesystem interface and features like filesystem composition

LICENSE

This project is governed by the MIT License. See LICENSE

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoTest

func AutoTest(startno int, fn func(*Testcase) error) error

GenerateTestcases runs all tests on the `os` package to establish baseline results that can be used to test that `absfs` FileSystems are consistent with native file system support. If not `nil` GenerateTestcases will call `fn` with each generated testcase. If `fn` returns an error then testcase generation will stop and GenerateTestcases will return an the same error and the testcases crated so far. (TODO: many tests still to be added to exercise the entire FileSystem interface)

func CompareErrors

func CompareErrors(err1 error, err2 error) error

func EveryFlag

func EveryFlag() []int

func EveryPermission

func EveryPermission() []os.FileMode

func ForEveryFlag

func ForEveryFlag(fn func(flag int) error) error

func ForEveryPermission

func ForEveryPermission(fn func(mode os.FileMode) error) error

func FsTestDir

func FsTestDir(fs absfs.FileSystem, path string) (testdir string, cleanup func(), err error)

FsTestDir Creates a timestamped folder for filesystem testing, and changes directory to it. Returns the path to the new directory, a cleanup function and an error. The `cleanup` method changes the directory back to the original location and removes testdir and all of it's contents.

Types

type ErrorReport

type ErrorReport struct {
	Op       string
	Path     string
	Err      error
	StackStr string
	TypeStr  string

	ErrStr string
}

func NewErrorReport

func NewErrorReport(op, path string, err error, stackstr string) *ErrorReport

func (*ErrorReport) Equal

func (e *ErrorReport) Equal(r *ErrorReport) bool

func (*ErrorReport) Error

func (e *ErrorReport) Error() string

func (*ErrorReport) Stack

func (e *ErrorReport) Stack() string

func (*ErrorReport) String

func (e *ErrorReport) String() string

func (*ErrorReport) Type

func (e *ErrorReport) Type() string

func (*ErrorReport) TypesEqual

func (e *ErrorReport) TypesEqual(r *ErrorReport) bool

type ErrorString

type ErrorString struct {
	Err string
}

func (*ErrorString) Error

func (e *ErrorString) Error() string

type Testcase

type Testcase struct {
	TestNo       int         `json:"test_no"`
	PreCondition string      `json:"pre_condition"`
	Op           string      `json:"op"`
	Path         string      `json:"path"`
	Flags        int         `json:"flags"`
	Mode         os.FileMode `json:"mode"`

	Errors map[string]*ErrorReport
}

func FsTest

func FsTest(fs absfs.FileSystem, path string, testcase *Testcase) (*Testcase, error)

func (*Testcase) Report

func (t *Testcase) Report() string

Jump to

Keyboard shortcuts

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