Merge #12895: tests: Add note about test suite name uniqueness requirement to developer notes
d1b622b
tests: Add check for test suite name uniqueness in lint-tests.sh (practicalswift)dc8067b
tests: Add note about uniqueness requirement for test suite names (practicalswift)3ebfb2d
tests: Avoid test suite name collision in wallet crypto_tests (MarcoFalke) Pull request description: * Add documentation: Add note about test suite name uniqueness requirement in developer notes * Add regression test: Update `lint-tests.sh` to make it check also for test suite name uniqueness Context: #12894 (`tests: Avoid test suite name collision in wallet crypto_tests`) Tree-SHA512: 3c8502db069ef3d753f534976a86a997b12bac539e808a7285193bf81c9dd8c1b06821c3dd1bdf870ab87722b02c8aa9574c62ace70c2a1b8091785cb8c9aace
This commit is contained in:
commit
d6f10b248a
5 changed files with 23 additions and 7 deletions
|
@ -4,7 +4,9 @@
|
||||||
# Distributed under the MIT software license, see the accompanying
|
# Distributed under the MIT software license, see the accompanying
|
||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
#
|
#
|
||||||
# Check the test suite naming convention
|
# Check the test suite naming conventions
|
||||||
|
|
||||||
|
EXIT_CODE=0
|
||||||
|
|
||||||
NAMING_INCONSISTENCIES=$(git grep -E '^BOOST_FIXTURE_TEST_SUITE\(' -- \
|
NAMING_INCONSISTENCIES=$(git grep -E '^BOOST_FIXTURE_TEST_SUITE\(' -- \
|
||||||
"src/test/**.cpp" "src/wallet/test/**.cpp" | \
|
"src/test/**.cpp" "src/wallet/test/**.cpp" | \
|
||||||
|
@ -15,5 +17,18 @@ if [[ ${NAMING_INCONSISTENCIES} != "" ]]; then
|
||||||
echo "that convention:"
|
echo "that convention:"
|
||||||
echo
|
echo
|
||||||
echo "${NAMING_INCONSISTENCIES}"
|
echo "${NAMING_INCONSISTENCIES}"
|
||||||
exit 1
|
EXIT_CODE=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
TEST_SUITE_NAME_COLLISSIONS=$(git grep -E '^BOOST_FIXTURE_TEST_SUITE\(' -- \
|
||||||
|
"src/test/**.cpp" "src/wallet/test/**.cpp" | cut -f2 -d'(' | cut -f1 -d, | \
|
||||||
|
sort | uniq -d)
|
||||||
|
if [[ ${TEST_SUITE_NAME_COLLISSIONS} != "" ]]; then
|
||||||
|
echo "Test suite names must be unique. The following test suite names"
|
||||||
|
echo "appear to be used more than once:"
|
||||||
|
echo
|
||||||
|
echo "${TEST_SUITE_NAME_COLLISSIONS}"
|
||||||
|
EXIT_CODE=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit ${EXIT_CODE}
|
||||||
|
|
|
@ -72,7 +72,8 @@ code.
|
||||||
- Class names, function names and method names are UpperCamelCase
|
- Class names, function names and method names are UpperCamelCase
|
||||||
(PascalCase). Do not prefix class names with `C`.
|
(PascalCase). Do not prefix class names with `C`.
|
||||||
- Test suite naming convention: The Boost test suite in file
|
- Test suite naming convention: The Boost test suite in file
|
||||||
`src/test/foo_tests.cpp` should be named `foo_tests`.
|
`src/test/foo_tests.cpp` should be named `foo_tests`. Test suite names
|
||||||
|
must be unique.
|
||||||
|
|
||||||
- **Miscellaneous**
|
- **Miscellaneous**
|
||||||
- `++i` is preferred over `i++`.
|
- `++i` is preferred over `i++`.
|
||||||
|
|
|
@ -94,7 +94,7 @@ BITCOIN_TESTS += \
|
||||||
wallet/test/wallet_test_fixture.h \
|
wallet/test/wallet_test_fixture.h \
|
||||||
wallet/test/accounting_tests.cpp \
|
wallet/test/accounting_tests.cpp \
|
||||||
wallet/test/wallet_tests.cpp \
|
wallet/test/wallet_tests.cpp \
|
||||||
wallet/test/crypto_tests.cpp \
|
wallet/test/wallet_crypto_tests.cpp \
|
||||||
wallet/test/coinselector_tests.cpp
|
wallet/test/coinselector_tests.cpp
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ public:
|
||||||
|
|
||||||
typedef std::vector<unsigned char, secure_allocator<unsigned char> > CKeyingMaterial;
|
typedef std::vector<unsigned char, secure_allocator<unsigned char> > CKeyingMaterial;
|
||||||
|
|
||||||
namespace crypto_tests
|
namespace wallet_crypto_tests
|
||||||
{
|
{
|
||||||
class TestCrypter;
|
class TestCrypter;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ namespace crypto_tests
|
||||||
/** Encryption/decryption context with key information */
|
/** Encryption/decryption context with key information */
|
||||||
class CCrypter
|
class CCrypter
|
||||||
{
|
{
|
||||||
friend class crypto_tests::TestCrypter; // for test access to chKey/chIV
|
friend class wallet_crypto_tests::TestCrypter; // for test access to chKey/chIV
|
||||||
private:
|
private:
|
||||||
std::vector<unsigned char, secure_allocator<unsigned char>> vchKey;
|
std::vector<unsigned char, secure_allocator<unsigned char>> vchKey;
|
||||||
std::vector<unsigned char, secure_allocator<unsigned char>> vchIV;
|
std::vector<unsigned char, secure_allocator<unsigned char>> vchIV;
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
|
|
||||||
BOOST_FIXTURE_TEST_SUITE(crypto_tests, BasicTestingSetup)
|
BOOST_FIXTURE_TEST_SUITE(wallet_crypto_tests, BasicTestingSetup)
|
||||||
|
|
||||||
class TestCrypter
|
class TestCrypter
|
||||||
{
|
{
|
Loading…
Reference in a new issue