filesetup

package
v0.0.0-...-683b059 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package filesetup provides file-related utility functions for security tests.

All of the functions in this package panic on error. They are intended to be used to set up environments for testing, not to perform test assertions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDir

func CreateDir(path string, uid int, mode os.FileMode)

CreateDir creates a directory at path owned by uid and with the supplied mode. Panics on error.

func CreateFile

func CreateFile(path, data string, uid int, mode os.FileMode)

CreateFile creates a file at path containing data. The file will be owned by uid and will have the supplied mode. Panics on error.

func CreateSymlink(oldname, newname string, uid int)

CreateSymlink creates a new symbolic link at newname pointing at target oldname. The symbolic link will be owned by uid. Panics on error.

func ReadOnlyRootPartition

func ReadOnlyRootPartition() (bool, error)

ReadOnlyRootPartition returns true if the root partition is mounted read-only. This can be called by tests that inspect filesystem permissions: a false return value indicates that rootfs verification is disabled and that testing is likely to be unreliable.

Types

This section is empty.

Jump to

Keyboard shortcuts

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