fix for /usr/bin/wc on freebsd (#1338)
* fix for /usr/bin/wc on freebsd * check for python3 in bats-test
This commit is contained in:
parent
bec231c1e6
commit
8120fe7d5d
|
@ -279,7 +279,12 @@ it with `run jq <(output)` you can only do it once, because the second time it
|
||||||
will read the output of the `jq` command. But you can construct a list of all
|
will read the output of the `jq` command. But you can construct a list of all
|
||||||
the values you want and check them all in a single step.
|
the values you want and check them all in a single step.
|
||||||
|
|
||||||
See `lib/setup_file.sh` for other tricks we employ.
|
Note that `<(output)` is substituted with the file name of a file descriptor,
|
||||||
|
so `mycmd <(output)` can become `mycmd /dev/fd/23`, `mycmd /tmp//sh-np.hpc7Zs`
|
||||||
|
or `mycmd /proc/self/fd/38` depending on the platform. To have it fed to
|
||||||
|
standard input, use `< <(output)`.
|
||||||
|
|
||||||
|
See the `lib/*.sh` and `bats/*.bats` files for other tricks we employ.
|
||||||
|
|
||||||
## file operations
|
## file operations
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,8 @@ setup() {
|
||||||
|
|
||||||
@test "$FILE expected 1 log line from http server" {
|
@test "$FILE expected 1 log line from http server" {
|
||||||
run -0 wc -l <"${MOCK_OUT}"
|
run -0 wc -l <"${MOCK_OUT}"
|
||||||
|
# wc can pad with spaces on some platforms
|
||||||
|
run -0 tr -d ' ' < <(output)
|
||||||
assert_output 1
|
assert_output 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,10 @@ TEST_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||||
|
|
||||||
|
|
||||||
check_requirements() {
|
check_requirements() {
|
||||||
|
if ! command -v python3 >/dev/null; then
|
||||||
|
die "missing required program 'python3'"
|
||||||
|
fi
|
||||||
|
|
||||||
if ! command -v nc >/dev/null; then
|
if ! command -v nc >/dev/null; then
|
||||||
die "missing required program 'nc' (package 'netcat-openbsd')"
|
die "missing required program 'nc' (package 'netcat-openbsd')"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue