Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckError ¶
CheckError is a helper function for tests It is common to check if an err is expected in the form of errStr, then there should be an actual error reported. This is an if and only if condition that needs to be verified.
func Command ¶
Command returns an exec.Cmd appropriate for testing the u-root command.
Command decides which executable to call based on environment variables: - EXECPATH="executable args" overrides any other test subject. - UROOT_TEST_BUILD=1 will force compiling the u-root command in question.
func IsExitCode ¶
IsExitCode takes err and checks whether it represents the given process exit code.
IsExitCode assumes that `err` is the return value of a successful call to exec.Cmd.Run/Output/CombinedOutput and hence an *exec.ExitError.
func NowLog ¶
func NowLog() string
NowLog returns the current time formatted like the standard log package's timestamp.
func SkipIfInVMTest ¶
SkipIfInVMTest skips a test if it's being executed in a u-root test VM.
See pkg/vmtest/integration.go which starts the VM with the uroot.vmtest in the kernel cmdline.
func SkipIfNotRoot ¶
SkipIfNotRoot skips the calling test if uid != 0.
Types ¶
type FakeStdin ¶
type FakeStdin struct {
// contains filtered or unexported fields
}
FakeStdin implements io.Reader and returns predefined list of answers, suitable for mocking standard input.
func NewFakeStdin ¶
NewFakeStdin creates new FakeStdin value with given answers.
func (*FakeStdin) Count ¶
Count returns how many answers have been read.
This counter overflows and never returns value bigger than the count of given answers.
func (*FakeStdin) Overflowed ¶
Overflowed reports whether more reads happened than expected.