lint: remove redundant test suite uniqueness check #35520

pull l0rinc wants to merge 1 commits into bitcoin:master from l0rinc:l0rinc/remove-redundant-test-suite-lint changing 1 files +3 −41
  1. l0rinc commented at 9:12 PM on June 12, 2026: contributor

    Follow-up to #35451 (review).

    Problem: That duplicate check in test/lint/lint-tests.py is redundant now: CMake already registers each Boost test suite as a CTest test name and rejects duplicates there.

    Fix: Remove the check_unique_test_names path and its now-unused duplicate helper and inline remaining helper into main().

    Reproducers: These throwaway patches pass test/lint/lint-tests.py and fail during CMake test registration.

    <details><summary>Internal `src/test` duplicate</summary>

    diff --git a/src/test/base32_tests.cpp b/src/test/base32_tests.cpp
    index 051a8fcd25..3b50bff724 100644
    --- a/src/test/base32_tests.cpp
    +++ b/src/test/base32_tests.cpp
    @@ -54,3 +54,7 @@ BOOST_AUTO_TEST_CASE(base32_padding)
     }
     
     BOOST_AUTO_TEST_SUITE_END()
    +
    +BOOST_AUTO_TEST_SUITE(base32_tests)
    +BOOST_AUTO_TEST_CASE(base32_duplicate_probe) { BOOST_CHECK(true); }
    +BOOST_AUTO_TEST_SUITE_END()
    

    </details> <details><summary>Internal `src/wallet/test` duplicate</summary>

    diff --git a/src/wallet/test/wallet_rpc_tests.cpp b/src/wallet/test/wallet_rpc_tests.cpp
    index 8bf5eab443..854d010ec0 100644
    --- a/src/wallet/test/wallet_rpc_tests.cpp
    +++ b/src/wallet/test/wallet_rpc_tests.cpp
    @@ -37,5 +37,10 @@ BOOST_AUTO_TEST_CASE(ensure_unique_wallet_name)
         BOOST_CHECK_THROW(TestWalletName("/wallet/foobar", "foo"), UniValue);
     }
     
    +BOOST_AUTO_TEST_SUITE_END()
    +
    +BOOST_FIXTURE_TEST_SUITE(wallet_rpc_tests, BasicTestingSetup)
    +BOOST_AUTO_TEST_CASE(wallet_rpc_duplicate_probe) { BOOST_CHECK(true); }
    +
     BOOST_AUTO_TEST_SUITE_END()
     } // namespace wallet
    

    </details> <details><summary>Cross `src/test` and `src/wallet/test` duplicate</summary>

    diff --git a/src/wallet/test/CMakeLists.txt b/src/wallet/test/CMakeLists.txt
    index 524c7218f4..04628e0327 100644
    --- a/src/wallet/test/CMakeLists.txt
    +++ b/src/wallet/test/CMakeLists.txt
    @@ -8,6 +8,7 @@ target_sources(test_bitcoin
       PRIVATE
         init_test_fixture.cpp
         wallet_test_fixture.cpp
    +    base32_tests.cpp
         db_tests.cpp
         coinselector_tests.cpp
         coinselection_tests.cpp
    diff --git a/src/wallet/test/base32_tests.cpp b/src/wallet/test/base32_tests.cpp
    new file mode 100644
    index 0000000000..da91d87dca
    --- /dev/null
    +++ b/src/wallet/test/base32_tests.cpp
    @@ -0,0 +1,5 @@
    +#include <boost/test/unit_test.hpp>
    +
    +BOOST_AUTO_TEST_SUITE(base32_tests)
    +BOOST_AUTO_TEST_CASE(wallet_cross_duplicate_probe) { BOOST_CHECK(true); }
    +BOOST_AUTO_TEST_SUITE_END()
    

    </details>

    The CMake failures are in the form:

    CMake Error at src/test/CMakeLists.txt:199 (add_test):
      add_test given test NAME "<duplicate_suite>" which already exists in this
      directory.
    
  2. test: remove redundant test suite uniqueness lint
    Duplicate Boost test suite names are already rejected by CMake when the suites are registered as CTest tests.
    Follow-up to https://github.com/bitcoin/bitcoin/pull/35451#discussion_r3403672298.
    
    Co-authored-by: maflcko <6399679+maflcko@users.noreply.github.com>
    946feb3f1f
  3. DrahtBot added the label Tests on Jun 12, 2026
  4. DrahtBot commented at 9:12 PM on June 12, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35520.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK maflcko, sedited

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. hebasto commented at 12:38 PM on June 13, 2026: member

    Problem: That duplicate check in test/lint/lint-tests.py is redundant now: CMake already registers each Boost test suite as a CTest test name and rejects duplicates there.

    Actually, test/lint/lint-tests.py checks all test sources unconditionally, whereas CMake's behaviour depends on the active build options: https://github.com/bitcoin/bitcoin/blob/debac5f2cd16b5e457888c63eec0e3c0bb86330c/src/test/CMakeLists.txt#L175-L181

  6. maflcko commented at 8:30 AM on June 15, 2026: member

    CMake's behaviour depends on the active build options:

    I don't think a dev that writes wallet tests without compiling them will run the linters. Such a dev violates the contribution guidelines, so I don't think we should write code for them, when there is no other benefit. @l0rinc I noticed that your patches are generally corrupt. What is the reason for that. Normally they are missing a newline at the end, but now the cross-dupe-patch is fully corrupt. The correct one would be:

    diff --git a/src/wallet/test/CMakeLists.txt b/src/wallet/test/CMakeLists.txt
    index 524c721..04628e0 100644
    --- a/src/wallet/test/CMakeLists.txt
    +++ b/src/wallet/test/CMakeLists.txt
    @@ -10,2 +10,3 @@ target_sources(test_bitcoin
         wallet_test_fixture.cpp
    +    base32_tests.cpp
         db_tests.cpp
    diff --git a/src/wallet/test/base32_tests.cpp b/src/wallet/test/base32_tests.cpp
    new file mode 100644
    index 0000000..da91d87
    --- /dev/null
    +++ b/src/wallet/test/base32_tests.cpp
    @@ -0,0 +1,5 @@
    +#include <boost/test/unit_test.hpp>
    +
    +BOOST_AUTO_TEST_SUITE(base32_tests)
    +BOOST_AUTO_TEST_CASE(wallet_cross_duplicate_probe) { BOOST_CHECK(true); }
    +BOOST_AUTO_TEST_SUITE_END()
    

    Probably causes by letting an LLM write your pull description?

  7. l0rinc commented at 10:47 AM on June 15, 2026: contributor

    I noticed that your patches are generally corrupt

    I'm doing the patches usually from the CLion IDE. I tested them again and the patches can be applied for me locally. Is it possible it depends on the git version? If others have the same problem I can do them through git directly from now on.

    Probably causes by letting an LLM write your pull description?

    Lol, I proofread them before submitting of course, but they shouldn't change the patches (I always check the diffs).

  8. maflcko commented at 11:09 AM on June 15, 2026: member

    I tested them again and the patches can be applied for me locally

    What are the exact steps you used to apply it? I can not apply it with patch, nor with git.

    sh-5.3$ sha1sum /tmp/a
    7bd6cb4cd4f213ff5f84f3dcfc71fb5d0cdc9003  /tmp/a
    sh-5.3$ git apply /tmp/a
    error: corrupt patch at /tmp/a:10
    sh-5.3$ patch -p1 --dry-run < /tmp/a
    checking file src/wallet/test/CMakeLists.txt
    patch: **** malformed patch at line 10: diff --git a/src/wallet/test/base32_tests.cpp b/src/wallet/test/base32_tests.cpp
    
    

    Also, the LLM explains why they are corrupt:

    This patch is corrupt due to mismatched line counts in the hunk headers:
    
    1. **`CMakeLists.txt`**: The header specifies `@@ -8,6 +8,7 @@` (6 original lines, 7 new lines), but the body only contains 4 original context lines and 1 added line (5 lines total).
    2. **`base32_tests.cpp`**: The header specifies `@@ -0,0 +1,6 @@` (6 new lines), but the body only contains 5 added lines.
    
    Because of these discrepancies, standard patch tools (such as `git apply`) will reject the patch.
    
  9. l0rinc commented at 11:36 AM on June 15, 2026: contributor

    Recreated the patches in the description, the diff is basically a single offset: <img width="592" height="252" alt="image" src="https://github.com/user-attachments/assets/fd9f25b8-4702-42c3-bab4-b414d66e4fc6" />

    It's possible the PR was updated since the creation of the reproducers, thanks for the hint, but note that https://git-scm.com/docs/git-apply#Documentation/git-apply.txt---recount can fix these automatically (seems my git defaults are more lenient).

  10. maflcko commented at 12:31 PM on June 15, 2026: member

    It's possible the PR was updated since the creation of the reproducers, thanks for the hint, but note that https://git-scm.com/docs/git-apply#Documentation/git-apply.txt---recount can fix these automatically (seems my git defaults are more lenient).

    TIL. Though, I think it is more dev-friendly to share properly formatted patches, so my recommendation would be to disable the recount option locally on your side. Unrelated note: If you want the patches to be shorter, you can use git diff -U1 (or --unified=1) for smaller context. Though, with less context --unified=0, by default git will also reject the patch.

    Either way:

    lgtm ACK 946feb3f1fa00a94f23ec21209a084e424d5eb26

  11. sedited approved
  12. sedited commented at 12:22 PM on June 16, 2026: contributor

    ACK 946feb3f1fa00a94f23ec21209a084e424d5eb26

  13. sedited merged this on Jun 16, 2026
  14. sedited closed this on Jun 16, 2026


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-06-20 23:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me