Documentation ¶
Index ¶
- Constants
- Variables
- func Du(t *testing.T, fd int) (nBytes int64)
- func ExtractCmdExitCode(err error) int
- func InitFS(t *testing.T, extraArgs ...string) string
- func ListFds(pid int, prefix string) []string
- func Md5fn(filename string) string
- func Md5hex(buf []byte) string
- func Mount(c string, p string, showOutput bool, extraArgs ...string) error
- func MountOrExit(c string, p string, extraArgs ...string)
- func MountOrFatal(t *testing.T, c string, p string, extraArgs ...string)
- func QueryCtlSock(t *testing.T, socketPath string, req ctlsock.RequestStruct) (response ctlsock.ResponseStruct)
- func ResetTmpDir(createDirIV bool)
- func TestMkdirRmdir(t *testing.T, plainDir string)
- func TestRename(t *testing.T, plainDir string)
- func UnmountErr(dir string) (err error)
- func UnmountPanic(dir string)
- func VerifyExistence(path string) bool
- func VerifySize(t *testing.T, path string, want int)
Constants ¶
const GocryptfsBinary = "../../gocryptfs"
GocryptfsBinary is the assumed path to the gocryptfs build.
const UnmountScript = "../fuse-unmount.bash"
UnmountScript is the fusermount/umount compatibility wrapper script
Variables ¶
var DefaultCipherDir string
DefaultCipherDir is TmpDir + "/default-cipher"
var DefaultPlainDir string
DefaultPlainDir is TmpDir + "/default-plain"
var MountInfo map[string]mountInfo
Indexed by mountpoint. Initialized in doInit().
var TmpDir string
TmpDir is a unique temporary directory. "go test" runs package tests in parallel. We create a unique TmpDir in init() so the tests do not interfere.
var X255 string
X255 contains 255 uppercase "X". This can be used as a maximum-length filename.
Functions ¶
func Du ¶
Du returns the disk usage of the file "fd" points to, in bytes. Same as "du --block-size=1".
func ExtractCmdExitCode ¶ added in v1.6.1
ExtractCmdExitCode extracts the exit code from an error value that was returned from exec / cmd.Run()
func InitFS ¶
InitFS creates a new empty cipherdir and calls
gocryptfs -q -init -extpass "echo test" -scryptn=10 $extraArgs $cipherdir
It returns cipherdir without a trailing slash.
func ListFds ¶ added in v1.6.1
ListFds lists the open file descriptors for process "pid". Pass pid=0 for ourselves. Pass a prefix to ignore all paths that do not start with "prefix".
func Mount ¶
Mount CIPHERDIR "c" on PLAINDIR "p" Creates "p" if it does not exist.
Contrary to InitFS(), you MUST passt "-extpass=echo test" (or another way for getting the master key) explicitely.
func MountOrExit ¶
MountOrExit calls Mount() and exits on failure.
Contrary to InitFS(), you MUST passt "-extpass=echo test" (or another way for getting the master key) explicitely.
func MountOrFatal ¶
MountOrFatal calls Mount() and calls t.Fatal() on failure.
Contrary to InitFS(), you MUST passt "-extpass=echo test" (or another way for getting the master key) explicitely.
func QueryCtlSock ¶ added in v1.2.1
func QueryCtlSock(t *testing.T, socketPath string, req ctlsock.RequestStruct) (response ctlsock.ResponseStruct)
QueryCtlSock sends a request to the control socket at "socketPath" and returns the response.
func ResetTmpDir ¶
func ResetTmpDir(createDirIV bool)
ResetTmpDir deletes TmpDir, create new dir tree:
TmpDir |-- DefaultPlainDir *-- DefaultCipherDir
*-- gocryptfs.diriv
func TestMkdirRmdir ¶
TestMkdirRmdir creates and deletes a directory
func TestRename ¶
TestRename creates and renames a file
func UnmountErr ¶
UnmountErr tries to unmount "dir", retrying 10 times, and returns the resulting error.
func UnmountPanic ¶
func UnmountPanic(dir string)
UnmountPanic tries to umount "dir" and panics on error.
func VerifyExistence ¶
VerifyExistence checks in 3 ways that "path" exists: stat, open, readdir. Returns true if the path exists, false otherwise. Panics if the result is inconsistent.
Types ¶
This section is empty.