diff options
author | MarcoFalke <falke.marco@gmail.com> | 2018-04-01 18:28:14 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2018-04-01 18:28:22 -0400 |
commit | 9beded58606606b00e70ae76020ac433569b901e (patch) | |
tree | bd1c20a260e57c6ab84943f33b1e1ebfa609aac4 /contrib/devtools | |
parent | fa5825d610e92ea0f8abe509516f03ad59e824f3 (diff) | |
parent | db983beba6fec910722bacc0d67c7ae98ba566fa (diff) |
Merge #12719: tests: Add note about test suite naming convention in developer-notes.md
db983beba6 tests: Add lint-tests.sh which checks the test suite naming convention (practicalswift)
5fd864fe8a tests: Rename test suits not following the test suite naming convention (practicalswift)
7b4a296a71 tests: Add note about test suite naming convention (practicalswift)
Pull request description:
Changes:
* Add note about test suite naming convention
* Fix exceptions
* Add regression test
Rationale:
* Consistent naming of test suites makes programmatic test running of specific tests/subsets of tests easier
* Explicit is better than implicit
Before this commit:
```
$ contrib/devtools/lint-tests.sh
The test suite in file src/test/foo_tests.cpp should be named
"foo_tests". Please make sure the following test suites follow
that convention:
src/test/blockchain_tests.cpp:BOOST_FIXTURE_TEST_SUITE(blockchain_difficulty_tests, BasicTestingSetup)
src/test/prevector_tests.cpp:BOOST_FIXTURE_TEST_SUITE(PrevectorTests, TestingSetup)
src/wallet/test/coinselector_tests.cpp:BOOST_FIXTURE_TEST_SUITE(coin_selection_tests, WalletTestingSetup)
src/wallet/test/crypto_tests.cpp:BOOST_FIXTURE_TEST_SUITE(wallet_crypto, BasicTestingSetup)
$
```
After this commit:
```
$ contrib/devtools/lint-tests.sh
$
```
Tree-SHA512: 7258ab9a6b9b8fc1939efadc619e2f2f02cfce8034c7f2e5dc5ecc769aa12e17f6fb8e363817feaf15c026c5b958b2574525b8d2d3f6be69658679bf8ceea9e9
Diffstat (limited to 'contrib/devtools')
-rwxr-xr-x | contrib/devtools/lint-tests.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/contrib/devtools/lint-tests.sh b/contrib/devtools/lint-tests.sh new file mode 100755 index 0000000000..dd1a3ebdc4 --- /dev/null +++ b/contrib/devtools/lint-tests.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# +# Copyright (c) 2018 The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. +# +# Check the test suite naming convention + +NAMING_INCONSISTENCIES=$(git grep -E '^BOOST_FIXTURE_TEST_SUITE\(' -- \ + "src/test/**.cpp" "src/wallet/test/**.cpp" | \ + grep -vE '/(.*?)\.cpp:BOOST_FIXTURE_TEST_SUITE\(\1, .*\)$') +if [[ ${NAMING_INCONSISTENCIES} != "" ]]; then + echo "The test suite in file src/test/foo_tests.cpp should be named" + echo "\"foo_tests\". Please make sure the following test suites follow" + echo "that convention:" + echo + echo "${NAMING_INCONSISTENCIES}" + exit 1 +fi |