From e220175d0fe2ad062b24bb2a28caf22a69df6e82 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Thu, 2 Sep 2021 10:30:23 +0200 Subject: [PATCH] merge bitcoin#22861: Update test README and lint script --- Makefile.am | 2 +- ci/lint/04_install.sh | 1 - configure.ac | 2 +- contrib/containers/ci/Dockerfile | 1 - doc/fuzzing.md | 3 +++ src/Makefile.test.include | 4 ++-- test/README.md | 13 ++++++++----- test/config.ini.in | 2 +- test/util/{bitcoin-util-test.py => test_runner.py} | 0 9 files changed, 16 insertions(+), 12 deletions(-) rename test/util/{bitcoin-util-test.py => test_runner.py} (100%) diff --git a/Makefile.am b/Makefile.am index 62fb5f5572..0794ac8c02 100644 --- a/Makefile.am +++ b/Makefile.am @@ -252,7 +252,7 @@ EXTRA_DIST += \ test/fuzz EXTRA_DIST += \ - test/util/bitcoin-util-test.py \ + test/util/test_runner.py \ test/util/data/bitcoin-util-test.json \ test/util/data/blanktxv1.hex \ test/util/data/blanktxv1.json \ diff --git a/ci/lint/04_install.sh b/ci/lint/04_install.sh index 84c19172bb..63fd3fc9c4 100755 --- a/ci/lint/04_install.sh +++ b/ci/lint/04_install.sh @@ -14,7 +14,6 @@ update-alternatives --install /usr/bin/clang-format-diff clang-format-diff $(whi ${CI_RETRY_EXE} pip3 install codespell==2.0.0 ${CI_RETRY_EXE} pip3 install flake8==3.8.3 ${CI_RETRY_EXE} pip3 install vulture==2.3 -${CI_RETRY_EXE} pip3 install yq ${CI_RETRY_EXE} pip3 install mypy==0.781 SHELLCHECK_VERSION=v0.8.0 diff --git a/configure.ac b/configure.ac index 922af556f3..499f539ceb 100644 --- a/configure.ac +++ b/configure.ac @@ -1923,7 +1923,7 @@ AC_CONFIG_LINKS([contrib/filter-lcov.py:contrib/filter-lcov.py]) AC_CONFIG_LINKS([contrib/macdeploy/background.tiff:contrib/macdeploy/background.tiff]) AC_CONFIG_LINKS([test/functional/test_runner.py:test/functional/test_runner.py]) AC_CONFIG_LINKS([test/fuzz/test_runner.py:test/fuzz/test_runner.py]) -AC_CONFIG_LINKS([test/util/bitcoin-util-test.py:test/util/bitcoin-util-test.py]) +AC_CONFIG_LINKS([test/util/test_runner.py:test/util/test_runner.py]) AC_CONFIG_LINKS([test/util/rpcauth-test.py:test/util/rpcauth-test.py]) dnl boost's m4 checks do something really nasty: they export these vars. As a diff --git a/contrib/containers/ci/Dockerfile b/contrib/containers/ci/Dockerfile index f80a1b5174..9fc318d913 100644 --- a/contrib/containers/ci/Dockerfile +++ b/contrib/containers/ci/Dockerfile @@ -80,7 +80,6 @@ RUN pip3 install \ pyzmq \ vulture==2.3 \ mypy==0.781 \ - yq \ multiprocess # dash_hash diff --git a/doc/fuzzing.md b/doc/fuzzing.md index a942b7d425..317dec2661 100644 --- a/doc/fuzzing.md +++ b/doc/fuzzing.md @@ -16,6 +16,9 @@ $ FUZZ=process_message src/test/fuzz/fuzz # abort fuzzing using ctrl-c ``` +There is also a runner script to execute all fuzz targets. Refer to +`./test/fuzz/test_runner.py --help` for more details. + ## Fuzzing harnesses and output [`process_message`](https://github.com/dashpay/dash/blob/develop/src/test/fuzz/process_message.cpp) is a fuzzing harness for the [`ProcessMessage(...)` function (`net_processing`)](https://github.com/dashpay/dash/blob/develop/src/net_processing.cpp). The available fuzzing harnesses are found in [`src/test/fuzz/`](https://github.com/dashpay/dash/tree/develop/src/test/fuzz). diff --git a/src/Makefile.test.include b/src/Makefile.test.include index cb8b740404..7583a616b9 100644 --- a/src/Makefile.test.include +++ b/src/Makefile.test.include @@ -375,8 +375,8 @@ check-unit: $(BITCOIN_TESTS:.cpp=.cpp.test) check-local: check-unit if BUILD_BITCOIN_TX - @echo "Running test/util/bitcoin-util-test.py..." - $(PYTHON) $(top_builddir)/test/util/bitcoin-util-test.py + @echo "Running test/util/test_runner.py..." + $(PYTHON) $(top_builddir)/test/util/test_runner.py endif @echo "Running test/util/rpcauth-test.py..." $(PYTHON) $(top_builddir)/test/util/rpcauth-test.py diff --git a/test/README.md b/test/README.md index f2b0c34141..14c6982da4 100644 --- a/test/README.md +++ b/test/README.md @@ -5,20 +5,24 @@ etc. This directory contains the following sets of tests: +- [fuzz](/test/fuzz) A runner to execute all fuzz targets from + [/src/test/fuzz](/src/test/fuzz). - [functional](/test/functional) which test the functionality of dashd and dash-qt by interacting with them through the RPC and P2P interfaces. -- [util](/test/util) which tests the dash utilities, currently only -dash-tx. +- [util](/test/util) which tests the utilities (dash-tx, ...). - [lint](/test/lint/) which perform various static analysis checks. -The util tests are run as part of `make check` target. The functional +The util tests are run as part of `make check` target. The fuzz tests, functional tests and lint scripts can be run as explained in the sections below. # Running tests locally Before tests can be run locally, Dash Core must be built. See the [building instructions](/doc#building) for help. +## Fuzz tests + +See [/doc/fuzzing.md](/doc/fuzzing.md) ### Functional tests @@ -297,7 +301,7 @@ For ways to generate more granular profiles, see the README in ### Util tests -Util tests can be run locally by running `test/util/bitcoin-util-test.py`. +Util tests can be run locally by running `test/util/test_runner.py`. Use the `-v` option for verbose output. ### Lint tests @@ -309,7 +313,6 @@ Use the `-v` option for verbose output. | [`lint-python.sh`](lint/lint-python.sh) | [flake8](https://gitlab.com/pycqa/flake8) | [3.8.3](https://github.com/bitcoin/bitcoin/pull/19348) | `pip3 install flake8==3.8.3` | [`lint-python.sh`](lint/lint-python.sh) | [mypy](https://github.com/python/mypy) | [0.781](https://github.com/bitcoin/bitcoin/pull/19348) | `pip3 install mypy==0.781` | [`lint-shell.sh`](lint/lint-shell.sh) | [ShellCheck](https://github.com/koalaman/shellcheck) | [0.7.2](https://github.com/bitcoin/bitcoin/pull/21749) | [details...](https://github.com/koalaman/shellcheck#installing) -| [`lint-shell.sh`](lint/lint-shell.sh) | [yq](https://github.com/kislyuk/yq) | default | `pip3 install yq` | [`lint-spelling.sh`](lint/lint-spelling.sh) | [codespell](https://github.com/codespell-project/codespell) | [2.0.0](https://github.com/bitcoin/bitcoin/pull/20817) | `pip3 install codespell==2.0.0` Please be aware that on Linux distributions all dependencies are usually available as packages, but could be outdated. diff --git a/test/config.ini.in b/test/config.ini.in index 5601bd8e6a..6359f28df2 100644 --- a/test/config.ini.in +++ b/test/config.ini.in @@ -3,7 +3,7 @@ # file COPYING or http://www.opensource.org/licenses/mit-license.php. # These environment variables are set by the build process and read by -# test/functional/test_runner.py and test/util/bitcoin-util-test.py +# test/*/test_runner.py and test/util/rpcauth-test.py [environment] PACKAGE_NAME=@PACKAGE_NAME@ diff --git a/test/util/bitcoin-util-test.py b/test/util/test_runner.py similarity index 100% rename from test/util/bitcoin-util-test.py rename to test/util/test_runner.py