build/test.sh

23 lines
568 B
Bash
Raw Normal View History

#! /bin/bash
if ! command -v bats > /dev/null; then
echo "bats testing tool not found. Try sudo apt install bats?"
exit 1
fi
if [ $# -lt 1 ]; then
FORGEBUILD="$(command -v forgebuild)"
if [ ! $? -eq 0 ]; then
echo "forgebuild not found in \$PATH. You can pass a path as argument to this script."
exit 2
fi
else
FORGEBUILD="$(readlink -m "$1")"
if [ ! -x $FORGEBUILD ]; then
echo "File $FORGEBUILD doesn't exist or is not executable."
exit 3
fi
fi
FORGEBUILD="$FORGEBUILD" bats "$(dirname "$0")"/tests