tests: Add missing locks to tests #11623

pull practicalswift wants to merge 1 commits into bitcoin:master from practicalswift:test-locks changing 7 files +60 −10
  1. practicalswift commented at 10:14 pm on November 6, 2017: contributor
    Add missing locks to tests to satisfy lock requirements (such as EXCLUSIVE_LOCKS_REQUIRED(...) (Clang Thread Safety Analysis, see #11226), AssertLockHeld(...) and implicit lock assumptions).
  2. fanquake added the label Tests on Nov 6, 2017
  3. promag commented at 1:07 am on November 7, 2017: member
    utACK 361136d.
  4. in src/test/DoS_tests.cpp:66 in 361136d45e outdated
    65@@ -66,11 +66,14 @@ BOOST_AUTO_TEST_CASE(outbound_slow_chain_eviction)
    66     dummyNode1.fSuccessfullyConnected = true;
    


    laanwj commented at 7:39 am on November 8, 2017:
    In tests where no multi-threading happens (most of them) it would work just as well to just take the necessary locks once in the beginning of each test case. That would make the diff smaller likely. (but maybe explicit is better, I don’t know)

    practicalswift commented at 8:41 am on November 8, 2017:

    @laanwj Do you know which tests in this PR that do not have any multi-threading? What is the best way to identify the tests for which multi-threading happens?

    (Personally I like explicit locking better since that communicates where/why the lock is needed which is helpful for locking newcomers. I’ll happily adjust to consensus however :-))


    laanwj commented at 8:51 am on November 8, 2017:
    Yeah I’d say just keep it like this…
  5. in src/test/miner_tests.cpp:84 in 361136d45e outdated
    80@@ -81,7 +81,7 @@ CBlockIndex CreateBlockIndex(int nHeight)
    81 
    82 bool TestSequenceLocks(const CTransaction &tx, int flags)
    83 {
    84-    LOCK(mempool.cs);
    85+    LOCK2(cs_main, mempool.cs);
    


    MarcoFalke commented at 3:30 pm on November 10, 2017:
    The lock is already acquired in src/test/miner_tests.cpp:208, no?

    practicalswift commented at 4:16 pm on November 10, 2017:
    Good point! Fixed!
  6. MarcoFalke commented at 3:32 pm on November 10, 2017: member
    utACK 361136d45e354e303fb96ce25c4b3945505633ab
  7. tests: Add missing locks to tests
    Add missing locks to tests to satisfy lock requirements (such as
    EXCLUSIVE_LOCKS_REQUIRED(...) (Clang Thread Safety Analysis),
    AssertLockHeld(...) and implicit lock assumptions).
    109a858995
  8. practicalswift force-pushed on Nov 10, 2017
  9. MarcoFalke commented at 4:56 pm on November 10, 2017: member
    re-utACK 109a85899571aa499572e211bb08f05715e8743b
  10. MarcoFalke merged this on Nov 10, 2017
  11. MarcoFalke closed this on Nov 10, 2017

  12. MarcoFalke referenced this in commit ee92243e66 on Nov 10, 2017
  13. promag commented at 4:59 pm on November 10, 2017: member
    re-utACK 109a858.
  14. PastaPastaPasta referenced this in commit a3cd9783af on Dec 27, 2019
  15. PastaPastaPasta referenced this in commit ba8f6a31a2 on Jan 2, 2020
  16. PastaPastaPasta referenced this in commit 675f655722 on Jan 4, 2020
  17. PastaPastaPasta referenced this in commit 76c527d49d on Jan 12, 2020
  18. PastaPastaPasta referenced this in commit a36d0ef602 on Jan 12, 2020
  19. PastaPastaPasta referenced this in commit be7ff9c186 on Jan 12, 2020
  20. PastaPastaPasta referenced this in commit 6db34655f5 on Jan 12, 2020
  21. PastaPastaPasta referenced this in commit 523338304e on Jan 12, 2020
  22. PastaPastaPasta referenced this in commit 2377ac6533 on Jan 12, 2020
  23. PastaPastaPasta referenced this in commit 58adb1c28d on Jan 16, 2020
  24. PastaPastaPasta referenced this in commit e5d9dba3e9 on Jan 22, 2020
  25. PastaPastaPasta referenced this in commit efea72890c on Jan 22, 2020
  26. PastaPastaPasta referenced this in commit 0c4c5ff939 on Jan 29, 2020
  27. PastaPastaPasta referenced this in commit a3ad3120bf on Jan 29, 2020
  28. ckti referenced this in commit 2c0e302702 on Mar 28, 2021
  29. practicalswift deleted the branch on Apr 10, 2021
  30. gades referenced this in commit 386e85aae4 on Jun 30, 2021
  31. gades referenced this in commit 2d10e92600 on Feb 10, 2022
  32. DrahtBot locked this on Aug 16, 2022

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: 2024-10-04 22:12 UTC

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