Test framework improvement (#1128)
This commit is contained in:
committed by
Ta-Ching Chen
parent
1e8dfa38da
commit
c3177f9ebd
Executable
+67
@@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Set tools for OS compatibility.
|
||||
#
|
||||
# Prerequisite on Mac:
|
||||
# brew install coreutils findutils gnu-sed parallel
|
||||
|
||||
if [ $(uname -s) == 'Darwin' ]; then
|
||||
if command -v gtimeout >/dev/null; then
|
||||
timeout() { gtimeout "$@"; }
|
||||
export -f timeout
|
||||
else
|
||||
echo '"gtimeout" command not found. Try "brew install coreutils".'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if command -v gdate >/dev/null; then
|
||||
date() { gdate "$@"; }
|
||||
export -f date
|
||||
else
|
||||
echo '"gdate" command not found. Try "brew install coreutils".'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if command -v gsed >/dev/null; then
|
||||
sed() { gsed "$@"; }
|
||||
export -f sed
|
||||
else
|
||||
echo '"gsed" command not found. Try "brew install gnu-sed".'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if command -v greadlink >/dev/null; then
|
||||
readlink() { greadlink "$@"; }
|
||||
export -f readlink
|
||||
else
|
||||
echo '"greadlink" command not found. Try "brew install coreutils".'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if command -v gtr >/dev/null; then
|
||||
tr() { gtr "$@"; }
|
||||
export -f tr
|
||||
else
|
||||
echo '"gtr" command not found. Try "brew install coreutils".'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if command -v gxargs >/dev/null; then
|
||||
xargs() { gxargs "$@"; }
|
||||
export -f xargs
|
||||
else
|
||||
echo '"gxargs" command not found. Try "brew install findutils".'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
find_executable() {
|
||||
path=$1; shift
|
||||
find $path -perm +111 -type f "$@"
|
||||
}
|
||||
|
||||
else
|
||||
find_executable() {
|
||||
path=$1; shift
|
||||
find $path -executable -type f "$@"
|
||||
}
|
||||
fi
|
||||
Reference in New Issue
Block a user