2020-02-20 05:49:20 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# bat-extras | Copyright (C) 2019 eth-p | MIT License
|
|
|
|
#
|
|
|
|
# Repository: https://github.com/eth-p/bat-extras
|
|
|
|
# Issues: https://github.com/eth-p/bat-extras/issues
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
LIB="${HERE}/lib"
|
|
|
|
source "${LIB}/opt.sh"
|
|
|
|
# -----------------------------------------------------------------------------
|
2020-04-01 02:40:55 +02:00
|
|
|
cd "$HERE" || exit
|
2020-02-20 05:49:20 +01:00
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
export TEST_ENV_LIB="${HERE}/lib"
|
|
|
|
export TEST_ENV_BIN_DIR="${HERE}/src"
|
|
|
|
export TEST_ENV_BIN_SUFFIX=".sh"
|
2020-02-20 06:16:52 +01:00
|
|
|
export TEST_ENV_HOME="${HERE}/test/data"
|
2020-02-20 06:10:56 +01:00
|
|
|
export TEST_ENV_PATH="${HERE}/test/shimexec:${PATH}"
|
2020-02-20 05:49:20 +01:00
|
|
|
export TEST_DIR="${HERE}/test/suite"
|
|
|
|
export TEST_PWD="${HERE}/test/data"
|
|
|
|
export TEST_SHIM_PATH="${HERE}/test/shim"
|
|
|
|
export SNAPSHOT_DIR="${HERE}/test/snapshot"
|
|
|
|
|
|
|
|
OPT_ARGV=()
|
2020-10-29 09:35:47 +01:00
|
|
|
SHIFTOPT_SHORT_OPTIONS="PASS"
|
2020-02-20 05:49:20 +01:00
|
|
|
while shiftopt; do
|
|
|
|
case "$OPT" in
|
2020-03-31 23:51:00 +02:00
|
|
|
--compiled)
|
|
|
|
TEST_ENV_BIN_DIR="${HERE}/bin"
|
|
|
|
TEST_ENV_BIN_SUFFIX=""
|
|
|
|
;;
|
2020-04-28 03:47:34 +02:00
|
|
|
*)
|
|
|
|
if [[ "$OPT_VAL" ]]; then
|
|
|
|
OPT_ARGV+=("${OPT}=${OPT_VAL}")
|
|
|
|
else
|
|
|
|
OPT_ARGV+=("$OPT")
|
|
|
|
fi ;;
|
2020-02-20 05:49:20 +01:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Initialize submodule if it isn't already.
|
2020-02-20 05:52:34 +01:00
|
|
|
if ! [[ -f "${HERE}/.test-framework/bin/best.sh" ]]; then
|
2020-02-20 05:49:20 +01:00
|
|
|
git submodule init '.test-framework'
|
|
|
|
git submodule update
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Run best.
|
|
|
|
exec "${HERE}/.test-framework/bin/best.sh" "${OPT_ARGV[@]}"
|