From dd6794a7cc9a21c942cecf8bcdd5a8f217e197fa Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Thu, 25 Jun 2020 01:48:45 -0500 Subject: [PATCH] Add portable dev/sort-z; link into t/bin/; use in test-meta.sh Add a dev/sort-z wrapper to handle sorting null terminated lines across platforms. Apparently NetBSD supports "-R 000" instead of -z. Add a t/bin for any commands we want to make available to all tests, symlink sort-z there, and add it to the PATH in test-meta.sh. Thanks to Greg Troxel for reporting the problem. Signed-off-by: Rob Browning --- dev/sort-z | 9 +++++++++ t/bin/sort-z | 1 + t/test-meta.sh | 3 ++- 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100755 dev/sort-z create mode 120000 t/bin/sort-z diff --git a/dev/sort-z b/dev/sort-z new file mode 100755 index 0000000..890aa79 --- /dev/null +++ b/dev/sort-z @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +if test "$(uname -s)" = NetBSD; then + exec sort -R 000 "$@" +fi + +exec sort -z "$@" diff --git a/t/bin/sort-z b/t/bin/sort-z new file mode 120000 index 0000000..36ca24a --- /dev/null +++ b/t/bin/sort-z @@ -0,0 +1 @@ +../../dev/sort-z \ No newline at end of file diff --git a/t/test-meta.sh b/t/test-meta.sh index 3af9346..73ce116 100755 --- a/t/test-meta.sh +++ b/t/test-meta.sh @@ -7,6 +7,7 @@ set -o pipefail root_status="$(t/root-status)" || exit $? TOP="$(WVPASS pwd)" || exit $? +export PATH="$TOP/t/bin:$PATH" tmpdir="$(WVPASS wvmktempdir)" || exit $? export BUP_DIR="$tmpdir/bup" @@ -46,7 +47,7 @@ genstat() export PATH="$TOP/bin:$PATH" # pick up bup bup version # Skip atime (test elsewhere) to avoid the observer effect. - WVPASS find . -print0 | WVPASS sort -z \ + WVPASS find . -print0 | WVPASS sort-z \ | WVPASS xargs -0 bup xstat \ --mtime-resolution "$mtime_resolution"ns \ --exclude-fields ctime,atime,size -- 2.39.2