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:
mmetc 2022-03-10 13:59:10 +01:00 committed by GitHub
parent bec231c1e6
commit 8120fe7d5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 1 deletions

View file

@ -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
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

View file

@ -54,6 +54,8 @@ setup() {
@test "$FILE expected 1 log line from http server" {
run -0 wc -l <"${MOCK_OUT}"
# wc can pad with spaces on some platforms
run -0 tr -d ' ' < <(output)
assert_output 1
}

View file

@ -15,6 +15,10 @@ TEST_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
check_requirements() {
if ! command -v python3 >/dev/null; then
die "missing required program 'python3'"
fi
if ! command -v nc >/dev/null; then
die "missing required program 'nc' (package 'netcat-openbsd')"
fi