hook.php/bin/test.sh

42 lines
952 B
Bash
Raw Normal View History

#! /usr/bin/env bash
SCRIPTDIR="$(dirname "$0")"
BASEDIR="$(realpath "$SCRIPTDIR"/..)"
ORIGDIR="$(pwd)"
2022-02-23 23:14:35 +00:00
if [ ! -f "$BASEDIR"/specs/forgehook/test.sh ]; then
echo "Submodule not cloned yet. Doing it now"
cd "$BASEDIR"
git submodule init
if ! git submodule update; then
echo "Failed to download submodules. Are you connected to the internet?"
exit 1
fi
fi
# If bin/server succeeds, it contains a path to the executable
# Otherwise it may contain build error messages
server="$("$BASEDIR"/bin/server)"
# Try to detect a whck override
if [ -f "$BASEDIR"/bin/whck ]; then
whck="$BASEDIR"/bin/whck
elif which "whck"; then
whck="$(which "whck")"
else
whck=""
2022-02-22 18:13:52 +00:00
fi
if [ $? -eq 0 ]; then
# Let test_web.sh figure out the path to whck
2022-02-23 23:14:35 +00:00
"$BASEDIR"/specs/forgehook/test.sh "$server" "$whck"
status=$?
else
status=1
echo "Build failed. OUTPUT:"
echo "$output"
fi
cd "$ORIGDIR"
exit $status