2018-03-13 13:21:17 +00:00
|
|
|
#!/usr/bin/env bash
|
2020-12-11 19:08:45 +00:00
|
|
|
set -eu
|
2018-03-13 13:21:17 +00:00
|
|
|
|
|
|
|
REPO_ROOT="$(dirname "$0")"/..
|
|
|
|
USE_DEBUGGER=0
|
|
|
|
DEBUGGER="gdb --args"
|
2020-12-11 20:34:55 +00:00
|
|
|
BOOST_OPTIONS=()
|
|
|
|
SOLTEST_OPTIONS=()
|
2020-04-17 13:02:40 +00:00
|
|
|
SOLIDITY_BUILD_DIR=${SOLIDITY_BUILD_DIR:-${REPO_ROOT}/build}
|
2019-04-03 15:04:46 +00:00
|
|
|
|
2021-10-28 09:58:47 +00:00
|
|
|
function usage
|
|
|
|
{
|
2020-04-17 12:32:38 +00:00
|
|
|
echo 2>&1 "
|
2019-04-03 15:04:46 +00:00
|
|
|
Usage: $0 [options] [soltest-options]
|
|
|
|
Runs BOOST C++ unit test program, soltest.
|
|
|
|
|
|
|
|
Options:
|
|
|
|
--debug soltest invocation prefaced with: \"$DEBUGGER\"
|
|
|
|
--debugger *dbg-cmd* soltest prefaced with your own debugger command.
|
|
|
|
--run_test | -t *name* filters test unit(s) to include or exclude from test.
|
|
|
|
This option can be given several times.
|
|
|
|
--boost-options *x* Set BOOST option *x*.
|
|
|
|
--show-progress | -p Set BOOST option --show-progress.
|
|
|
|
|
|
|
|
Important environment variables:
|
|
|
|
|
2020-04-17 13:02:40 +00:00
|
|
|
SOLIDITY_BUILD_DIR: Sets directory where test/soltest should be found.
|
2019-04-03 15:04:46 +00:00
|
|
|
The default is \"${SOLIDITY_BUILD_DIR}\".
|
|
|
|
"
|
|
|
|
}
|
2018-03-13 13:21:17 +00:00
|
|
|
|
|
|
|
while [ $# -gt 0 ]
|
|
|
|
do
|
|
|
|
case "$1" in
|
|
|
|
--debugger)
|
|
|
|
shift
|
|
|
|
DEBUGGER="$1"
|
|
|
|
USE_DEBUGGER=1
|
|
|
|
;;
|
|
|
|
--debug)
|
|
|
|
USE_DEBUGGER=1
|
|
|
|
;;
|
|
|
|
--boost-options)
|
|
|
|
shift
|
2020-12-11 20:34:55 +00:00
|
|
|
BOOST_OPTIONS+=("$1")
|
2018-03-13 13:21:17 +00:00
|
|
|
;;
|
2019-04-03 15:04:46 +00:00
|
|
|
--help)
|
2020-12-11 17:15:16 +00:00
|
|
|
usage
|
2019-04-03 15:04:46 +00:00
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
--run_test | -t )
|
2018-03-13 13:21:17 +00:00
|
|
|
shift
|
2020-12-11 20:34:55 +00:00
|
|
|
BOOST_OPTIONS+=(-t "$1")
|
2018-03-13 13:21:17 +00:00
|
|
|
;;
|
|
|
|
--show-progress | -p)
|
2020-12-11 20:34:55 +00:00
|
|
|
BOOST_OPTIONS+=("$1")
|
2018-03-13 13:21:17 +00:00
|
|
|
;;
|
|
|
|
*)
|
2020-12-11 20:34:55 +00:00
|
|
|
SOLTEST_OPTIONS+=("$1")
|
2018-03-13 13:21:17 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
2020-12-11 17:28:19 +00:00
|
|
|
|
|
|
|
SOLTEST_COMMAND=("${SOLIDITY_BUILD_DIR}/test/soltest" "${BOOST_OPTIONS[@]}" -- --testpath "${REPO_ROOT}/test" "${SOLTEST_OPTIONS[@]}")
|
|
|
|
|
2018-03-13 13:21:17 +00:00
|
|
|
if [ "$USE_DEBUGGER" -ne "0" ]; then
|
2020-12-11 17:28:19 +00:00
|
|
|
# shellcheck disable=SC2086
|
|
|
|
exec ${DEBUGGER} "${SOLTEST_COMMAND[@]}"
|
|
|
|
else
|
|
|
|
exec "${SOLTEST_COMMAND[@]}"
|
2018-03-13 13:21:17 +00:00
|
|
|
fi
|