From 3ebfb2dadbe63199a4712a46a7e72976d291193b Mon Sep 17 00:00:00 2001
From: MarcoFalke <falke.marco@gmail.com>
Date: Thu, 5 Apr 2018 16:00:39 -0400
Subject: [PATCH 1/3] tests: Avoid test suite name collision in wallet
 crypto_tests

---
 src/Makefile.test.include                                     | 2 +-
 src/wallet/crypter.h                                          | 4 ++--
 src/wallet/test/{crypto_tests.cpp => wallet_crypto_tests.cpp} | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
 rename src/wallet/test/{crypto_tests.cpp => wallet_crypto_tests.cpp} (98%)

diff --git a/src/Makefile.test.include b/src/Makefile.test.include
index 4d0819ab7..76da140b8 100644
--- a/src/Makefile.test.include
+++ b/src/Makefile.test.include
@@ -94,7 +94,7 @@ BITCOIN_TESTS += \
   wallet/test/wallet_test_fixture.h \
   wallet/test/accounting_tests.cpp \
   wallet/test/wallet_tests.cpp \
-  wallet/test/crypto_tests.cpp \
+  wallet/test/wallet_crypto_tests.cpp \
   wallet/test/coinselector_tests.cpp
 endif
 
diff --git a/src/wallet/crypter.h b/src/wallet/crypter.h
index fdeb4cfee..4c0c8ff5e 100644
--- a/src/wallet/crypter.h
+++ b/src/wallet/crypter.h
@@ -67,7 +67,7 @@ public:
 
 typedef std::vector<unsigned char, secure_allocator<unsigned char> > CKeyingMaterial;
 
-namespace crypto_tests
+namespace wallet_crypto_tests
 {
     class TestCrypter;
 }
@@ -75,7 +75,7 @@ namespace crypto_tests
 /** Encryption/decryption context with key information */
 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:
     std::vector<unsigned char, secure_allocator<unsigned char>> vchKey;
     std::vector<unsigned char, secure_allocator<unsigned char>> vchIV;
diff --git a/src/wallet/test/crypto_tests.cpp b/src/wallet/test/wallet_crypto_tests.cpp
similarity index 98%
rename from src/wallet/test/crypto_tests.cpp
rename to src/wallet/test/wallet_crypto_tests.cpp
index d8c0cdf0f..e04c0af1d 100644
--- a/src/wallet/test/crypto_tests.cpp
+++ b/src/wallet/test/wallet_crypto_tests.cpp
@@ -10,7 +10,7 @@
 
 #include <boost/test/unit_test.hpp>
 
-BOOST_FIXTURE_TEST_SUITE(crypto_tests, BasicTestingSetup)
+BOOST_FIXTURE_TEST_SUITE(wallet_crypto_tests, BasicTestingSetup)
 
 class TestCrypter
 {

From dc8067b3e6297884a4861783bcb54a5941b271df Mon Sep 17 00:00:00 2001
From: practicalswift <practicalswift@users.noreply.github.com>
Date: Thu, 5 Apr 2018 22:27:15 +0200
Subject: [PATCH 2/3] tests: Add note about uniqueness requirement for test
 suite names

---
 doc/developer-notes.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/doc/developer-notes.md b/doc/developer-notes.md
index b00cceb98..bbfaf032f 100644
--- a/doc/developer-notes.md
+++ b/doc/developer-notes.md
@@ -72,7 +72,8 @@ code.
   - Class names, function names and method names are UpperCamelCase
     (PascalCase). Do not prefix class names with `C`.
   - 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**
   - `++i` is preferred over `i++`.

From d1b622b5a2dff5d68310bdf4e5d62d74e5391c25 Mon Sep 17 00:00:00 2001
From: practicalswift <practicalswift@users.noreply.github.com>
Date: Thu, 5 Apr 2018 22:26:12 +0200
Subject: [PATCH 3/3] tests: Add check for test suite name uniqueness in
 lint-tests.sh

---
 contrib/devtools/lint-tests.sh | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/contrib/devtools/lint-tests.sh b/contrib/devtools/lint-tests.sh
index dd1a3ebdc..ffc066055 100755
--- a/contrib/devtools/lint-tests.sh
+++ b/contrib/devtools/lint-tests.sh
@@ -4,7 +4,9 @@
 # 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
+# Check the test suite naming conventions
+
+EXIT_CODE=0
 
 NAMING_INCONSISTENCIES=$(git grep -E '^BOOST_FIXTURE_TEST_SUITE\(' -- \
     "src/test/**.cpp" "src/wallet/test/**.cpp" | \
@@ -15,5 +17,18 @@ if [[ ${NAMING_INCONSISTENCIES} != "" ]]; then
     echo "that convention:"
     echo
     echo "${NAMING_INCONSISTENCIES}"
-    exit 1
+    EXIT_CODE=1
 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}