2018-03-13 13:21:17 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
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
|
|
|
|
if [ "$USE_DEBUGGER" -ne "0" ]; then
|
|
|
|
DEBUG_PREFIX=${DEBUGGER}
|
|
|
|
fi
|
|
|
|
|
2020-12-11 20:34:55 +00:00
|
|
|
exec ${DEBUG_PREFIX} "${SOLIDITY_BUILD_DIR}/test/soltest" "${BOOST_OPTIONS[@]}" -- --testpath "${REPO_ROOT}/test" "${SOLTEST_OPTIONS[@]}"
|