diff --git a/CODING_STYLE.md b/CODING_STYLE.md index a0fe98644..3f44cd1f9 100644 --- a/CODING_STYLE.md +++ b/CODING_STYLE.md @@ -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. diff --git a/Changelog.md b/Changelog.md index afeef7aa5..93661c507 100644 --- a/Changelog.md +++ b/Changelog.md @@ -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) diff --git a/cmake/EthOptions.cmake b/cmake/EthOptions.cmake index 68d6cb045..6dca5e1be 100644 --- a/cmake/EthOptions.cmake +++ b/cmake/EthOptions.cmake @@ -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() diff --git a/docs/contributing.rst b/docs/contributing.rst index 8327a1e89..5fce8d1a6 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -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 `_ application ``soltest``. +Solidity includes different types of tests, most of them bundled into the `Boost C++ Test Framework `_ 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 `_ to list specific unit tests, and `report-level `_ 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) `_ to show test completion, +- `run_test (-t) `_ to run specific tests cases, and +- `report-level (-r) `_ give a more detailed report. .. note :: diff --git a/scripts/soltest.sh b/scripts/soltest.sh index 00f484a14..d1c41404f 100755 --- a/scripts/soltest.sh +++ b/scripts/soltest.sh @@ -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}