summaryrefslogtreecommitdiff
path: root/test/integration
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2016-08-23 21:47:54 +0200
committerJulian Andres Klode <jak@debian.org>2016-08-26 22:17:55 +0200
commit14e57111df6f8894ed47841b7471837c9d87c264 (patch)
treeaea4770b5c87ae2d2eced3db26443456baa266b6 /test/integration
parent7c1177f6b82aaaf3b7d378ef516b7ccbd47ec07b (diff)
test: Substitute GNU commands for other commands where available
We are simply checking for gnuCMD and gCMD for each command we are interested in. Gbp-Dch: ignore
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/framework20
1 files changed, 18 insertions, 2 deletions
diff --git a/test/integration/framework b/test/integration/framework
index ff0df3226..25cabc9f8 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -31,7 +31,6 @@ if [ "${MSGCOLOR:-YES}" = 'YES' ]; then
fi
fi
-
if [ "$MSGCOLOR" != 'NO' ]; then
CERROR="\033[1;31m" # red
CWARNING="\033[1;33m" # yellow
@@ -276,8 +275,13 @@ find_project_binary_dir() {
fi
}
setupenvironment() {
+ # Next check needs a gnu stat, let's figure that out early.
+ stat=stat
+ if command -v gnustat >/dev/null 2>&1; then
+ stat=gnustat
+ fi
# privilege dropping and testing doesn't work if /tmp isn't world-writeable (as e.g. with libpam-tmpdir)
- if [ -n "$TMPDIR" ] && [ "$(id -u)" = '0' ] && [ "$(stat --format '%a' "$TMPDIR")" != '1777' ]; then
+ if [ -n "$TMPDIR" ] && [ "$(id -u)" = '0' ] && [ "$($stat --format '%a' "$TMPDIR")" != '1777' ]; then
unset TMPDIR
fi
TMPWORKINGDIRECTORY="$(mktemp -d)"
@@ -290,6 +294,18 @@ setupenvironment() {
fi
msgninfo "Preparing environment for ${0##*/} in ${TMPWORKINGDIRECTORY}…"
+ # Setup coreutils on BSD systems
+ mkdir "${TMPWORKINGDIRECTORY}/bin"
+ for prefix in gnu g; do
+ for command in stat touch sed cp tr sha1sum sha256sum md5sum sha512sum grep date wc chmod head readlink tar expr base64; do
+ if command -v $prefix$command 2>/dev/null >/dev/null; then
+ [ -e "${TMPWORKINGDIRECTORY}/bin/$command" ] || ln -sf $(command -v $prefix$command) "${TMPWORKINGDIRECTORY}/bin/$command"
+ fi
+ done
+ done
+ export PATH="${TMPWORKINGDIRECTORY}/bin/:$PATH"
+
+
mkdir -m 700 "${TMPWORKINGDIRECTORY}/downloaded"
if [ "$(id -u)" = '0' ]; then
# relax permissions so that running as root with user switching works