]> arthur.barton.de Git - bup.git/commitdiff
Add portable dev/sort-z; link into t/bin/; use in test-meta.sh
authorRob Browning <rlb@defaultvalue.org>
Thu, 25 Jun 2020 06:48:45 +0000 (01:48 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sun, 5 Jul 2020 16:16:23 +0000 (11:16 -0500)
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 <rlb@defaultvalue.org>
dev/sort-z [new file with mode: 0755]
t/bin/sort-z [new symlink]
t/test-meta.sh

diff --git a/dev/sort-z b/dev/sort-z
new file mode 100755 (executable)
index 0000000..890aa79
--- /dev/null
@@ -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 (symlink)
index 0000000..36ca24a
--- /dev/null
@@ -0,0 +1 @@
+../../dev/sort-z
\ No newline at end of file
index 3af9346cae1ada66403c5f3d667c50274b76ed00..73ce11672063c54c188508b7e7afb52ffb5fbb44 100755 (executable)
@@ -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