42 lines
952 B
Bash
Executable File
42 lines
952 B
Bash
Executable File
#! /usr/bin/env bash
|
|
|
|
SCRIPTDIR="$(dirname "$0")"
|
|
BASEDIR="$(realpath "$SCRIPTDIR"/..)"
|
|
ORIGDIR="$(pwd)"
|
|
|
|
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=""
|
|
fi
|
|
|
|
if [ $? -eq 0 ]; then
|
|
# Let test_web.sh figure out the path to whck
|
|
"$BASEDIR"/specs/forgehook/test.sh "$server" "$whck"
|
|
status=$?
|
|
else
|
|
status=1
|
|
echo "Build failed. OUTPUT:"
|
|
echo "$output"
|
|
fi
|
|
|
|
cd "$ORIGDIR"
|
|
exit $status
|