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