summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2016-12-07 08:18:58 -0500
committerTavian Barnes <tavianator@tavianator.com>2016-12-08 19:52:29 -0500
commit2abb551664cddd24a06975f589ccda31b49e1f9d (patch)
treedd5db6749faa13a95578d308cea9ebe69588f726
parent837c42ea813000e3cd90db7e4012bc2a8aa98822 (diff)
downloadbfs-2abb551664cddd24a06975f589ccda31b49e1f9d.tar.xz
tests: Don't use install -D
-D is a GNU-ism that doesn't work on BSD or macOS.
-rwxr-xr-xtests.sh21
1 files changed, 14 insertions, 7 deletions
diff --git a/tests.sh b/tests.sh
index 781556a..1ee068f 100755
--- a/tests.sh
+++ b/tests.sh
@@ -10,9 +10,16 @@ function cleanup() {
}
trap cleanup EXIT
+# Install a file, creating any parent directories
+function installp() {
+ local target="${@: -1}"
+ mkdir -p "${target%/*}"
+ install "$@"
+}
+
# Like a mythical touch -p
function touchp() {
- install -Dm644 /dev/null "$1"
+ installp -m644 /dev/null "$1"
}
# Creates a simple file+directory structure for tests
@@ -32,12 +39,12 @@ make_basic "$TMP/basic"
# Creates a file+directory structure with various permissions for tests
function make_perms() {
- install -Dm444 /dev/null "$1/r"
- install -Dm222 /dev/null "$1/w"
- install -Dm644 /dev/null "$1/rw"
- install -Dm555 /dev/null "$1/rx"
- install -Dm311 /dev/null "$1/wx"
- install -Dm755 /dev/null "$1/rwx"
+ installp -m444 /dev/null "$1/r"
+ installp -m222 /dev/null "$1/w"
+ installp -m644 /dev/null "$1/rw"
+ installp -m555 /dev/null "$1/rx"
+ installp -m311 /dev/null "$1/wx"
+ installp -m755 /dev/null "$1/rwx"
}
make_perms "$TMP/perms"