Merge pull request #6462 from rocky/soltest-enhancements

Soltest enhancements
This commit is contained in:
chriseth 2019-04-18 15:20:56 +02:00 committed by GitHub
commit a018147c66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 46 additions and 9 deletions

View File

@ -46,6 +46,8 @@ foo->bar(someLongVariableName,
cout << "some very long string that contains completely irrelevant text that talks about this and that and contains the words \"lorem\" and \"ipsum\"" << endl;
```
To set indentation and tab width settings uniformly, the repository contains an [EditorConfig](https://editorconfig.org/) [`.editorconfig`](https://github.com/ethereum/solidity/blob/develop/.editorconfig) file, which describes some of the styles used and which is recognized by many IDE's and editors.
## 1. Namespaces
1. No `using namespace` declarations in header files.

View File

@ -30,10 +30,9 @@ Bugfixes:
libraries. This affected code generation.
* Yul: Properly register functions and disallow shadowing between function variables and variables in the outside scope.
Build System:
* Soltest: Add commandline option `--test` / `-t` to isoltest which takes a string that allows filtering unit tests.
* soltest.sh: allow environment variable ``SOLIDITY_BUILD_DIR`` to specify build folder and add ``--help`` usage.
### 0.5.7 (2019-03-26)

View File

@ -1,3 +1,6 @@
# CMAKE macros to set default CMAKE options and to show the
# resulting configuration.
macro(configure_project)
set(NAME ${PROJECT_NAME})
@ -22,7 +25,7 @@ endmacro()
macro(print_config NAME)
message("")
message("------------------------------------------------------------------------")
message("-- Configuring ${NAME}")
message("-- Configuring ${NAME} ${PROJECT_VERSION}")
message("------------------------------------------------------------------------")
message("-- CMake Version ${CMAKE_VERSION}")
message("-- CMAKE_BUILD_TYPE Build type ${CMAKE_BUILD_TYPE}")
@ -36,6 +39,9 @@ endif()
if (SUPPORT_TOOLS)
message("-- TOOLS Build tools ${TOOLS}")
endif()
message("------------------------------------------------------------------ flags")
message("-- OSSFUZZ ${OSSFUZZ}")
message("-- LLL ${LLL}")
message("------------------------------------------------------------------------")
message("")
endmacro()

View File

@ -74,12 +74,18 @@ The ``./scripts/tests.sh`` script executes most Solidity tests and
runs ``aleth`` automatically if it is in the path. The script does not download it,
so you need to install it first. Please read on for the details.
Solidity includes different types of tests, most of them bundled into the `C++ Boost Test Framework <https://www.boost.org/doc/libs/1_69_0/libs/test/doc/html/index.html>`_ application ``soltest``.
Solidity includes different types of tests, most of them bundled into the `Boost C++ Test Framework <https://www.boost.org/doc/libs/1_69_0/libs/test/doc/html/index.html>`_ application ``soltest``.
Some of them require the ``aleth`` client in testing mode, others require ``libz3``.
To run a basic set of tests that require neither ``aleth`` nor ``libz3``, run
``./scripts/soltest.sh --no-ipc --no-smt``. This script runs ``./build/test/soltest``
internally. ``./build/test/soltest --help`` has extensive help on all of the options available. See especially `run_test <https://www.boost.org/doc/libs/1_69_0/libs/test/doc/html/boost_test/utf_reference/rt_param_reference/run_test.html>`_ to list specific unit tests, and `report-level <https://www.boost.org/doc/libs/1_69_0/libs/test/doc/html/boost_test/utf_reference/rt_param_reference/report_level.html>`_ give a more detailed report.
``./scripts/soltest.sh --no-ipc --no-smt``.
``./build/test/soltest --help`` has extensive help on all of the options available.
See especially:
- `show_progress (-p) <https://www.boost.org/doc/libs/1_69_0/libs/test/doc/html/boost_test/utf_reference/rt_param_reference/show_progress.html>`_ to show test completion,
- `run_test (-t) <https://www.boost.org/doc/libs/1_69_0/libs/test/doc/html/boost_test/utf_reference/rt_param_reference/run_test.html>`_ to run specific tests cases, and
- `report-level (-r) <https://www.boost.org/doc/libs/1_69_0/libs/test/doc/html/boost_test/utf_reference/rt_param_reference/report_level.html>`_ give a more detailed report.
.. note ::

View File

@ -1,5 +1,4 @@
#!/usr/bin/env bash
set -e
REPO_ROOT="$(dirname "$0")"/..
@ -7,6 +6,27 @@ USE_DEBUGGER=0
DEBUGGER="gdb --args"
BOOST_OPTIONS=
SOLTEST_OPTIONS=
SOLIDITY_BUILD_DIR=${SOLIDITY_BUILD_DIR:-build}
usage() {
echo 2>&1 "
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:
SOLIDITY_BUILD_DIR: Sets directory under the repository root of where test/soltest should be found.
The default is \"${SOLIDITY_BUILD_DIR}\".
"
}
while [ $# -gt 0 ]
do
@ -23,7 +43,11 @@ do
shift
BOOST_OPTIONS="${BOOST_OPTIONS} $1"
;;
-t)
--help)
usage
exit 0
;;
--run_test | -t )
shift
BOOST_OPTIONS="${BOOST_OPTIONS} -t $1"
;;
@ -40,4 +64,4 @@ if [ "$USE_DEBUGGER" -ne "0" ]; then
DEBUG_PREFIX=${DEBUGGER}
fi
exec ${DEBUG_PREFIX} ${REPO_ROOT}/build/test/soltest ${BOOST_OPTIONS} -- --testpath ${REPO_ROOT}/test ${SOLTEST_OPTIONS}
exec ${DEBUG_PREFIX} ${REPO_ROOT}/${SOLIDITY_BUILD_DIR}/test/soltest ${BOOST_OPTIONS} -- --testpath ${REPO_ROOT}/test ${SOLTEST_OPTIONS}