Documentation
¶
Overview ¶
Package testenv checks host capabilities a test needs, so a test runs wherever the host provides them and says why it skipped where the host does not. Only test code imports this package.
Index ¶
- func Bash(t testing.TB) string
- func GrantOthersRead(t testing.TB, path string)
- func InheritOthersRead(testing.TB, string)
- func ReadOnlyDir(t testing.TB, dir string)
- func ScriptCommand(t testing.TB, path string, args ...string) *exec.Cmd
- func Sh(t testing.TB) string
- func Symlink(t testing.TB, oldname, newname string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bash ¶
Bash returns the bash that runs repository scripts, and skips the test when the host has none. On Windows it is Git for Windows' bash: bash.exe on PATH is usually the WSL launcher, which runs the script inside a Linux distribution without the host's toolchains or files.
func GrantOthersRead ¶
GrantOthersRead lets principals other than the owner read the file at path (mode 0644), so an owner-only check must refuse it.
func InheritOthersRead ¶
InheritOthersRead is a no-op on POSIX: a new file's mode is set when it is created, so the directory cannot grant access to it beforehand.
func ReadOnlyDir ¶
ReadOnlyDir lets the current user list and traverse dir but not add or remove its entries (mode 0555) until the test ends. Root ignores permission bits, so the test is skipped there.
func ScriptCommand ¶
ScriptCommand returns a command that runs the repository script at path with args. A POSIX host runs the script directly. Windows cannot run a script by its #! line, so there the command names the interpreter that line selects: bash or sh through Bash or Sh, and python3 as found on PATH. A script with any other interpreter skips the test on Windows.
Types ¶
This section is empty.