30 lines
835 B
Bash
30 lines
835 B
Bash
|
#! /bin/bash
|
||
|
|
||
|
SCRIPTDIR="$(dirname "$0")"
|
||
|
|
||
|
# Call me with the path to the script/program running the server
|
||
|
# Otherwise we try looking in the parent folder (if the tests are a submodule)
|
||
|
if [ -z "$1" ]; then
|
||
|
potential_server="$(readlink -m "$SCRIPTDIR"/server)"
|
||
|
echo $potential_server
|
||
|
if [ -x "$potential_server" ]; then
|
||
|
export FORGEHOOKENDPOINT="$potential_server"
|
||
|
elif [ -x "$(readlink -m "$potential_server"/../../server)" ]; then
|
||
|
export FORGEHOOKENDPOINT="$(readlink -m "$potential_server"/../../server)"
|
||
|
else
|
||
|
echo "test.sh SERVER"
|
||
|
exit 1
|
||
|
fi
|
||
|
else
|
||
|
[ ! -x "$1" ] && echo "Cannot execute "$1"" && exit 2
|
||
|
export FORGEHOOKENDPOINT="$(readlink -m $1)"
|
||
|
fi
|
||
|
|
||
|
ORIGDIR="$(pwd)"
|
||
|
cd "$SCRIPTDIR"
|
||
|
|
||
|
export FORGEHOOK="$(pwd)/tests/mock-forgehook.sh"
|
||
|
bats tests/*.bats
|
||
|
|
||
|
cd "$ORIGDIR"
|