tests: have coins simulation test also use CCoinsViewDB #17669

pull jamesob wants to merge 1 commits into bitcoin:master from jamesob:2019-12-coins-tests changing 1 files +21 −4
  1. jamesob commented at 9:44 PM on December 4, 2019: member

    Before this change, the coins simulation test uses a base view of type CCoinsViewTest, which has no relevance outside of the unittest suite. Might as well reuse this testcase with a more realistic configuration that has CCoinsViewDB (i.e. in-memory leveldb) at the bottom of the view structure.

    This adds explicit use of CCoinsViewDB in the unittest suite.

    Before change

    ./src/test/test_bitcoin --run_test=coins_tests --catch_system_errors=no  21.99s user 0.04s system 99% cpu 22.057 total
    

    After change

    ./src/test/test_bitcoin --run_test=coins_tests --catch_system_errors=no  78.80s user 0.04s system 100% cpu 1:18.82 total
    
  2. fanquake added the label Tests on Dec 4, 2019
  3. DrahtBot commented at 9:57 PM on December 4, 2019: member

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #17487 (coins: allow write to disk without cache drop by jamesob)
    • #15606 ([experimental] UTXO snapshots by jamesob)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  4. laanwj commented at 10:44 AM on December 5, 2019: member

    Concept ACK

  5. in src/test/coins_tests.cpp:219 in 8e28ef639b outdated
     210 | @@ -211,20 +211,22 @@ BOOST_AUTO_TEST_CASE(coins_cache_simulation_test)
     211 |              // Every 100 iterations, flush an intermediate cache
     212 |              if (stack.size() > 1 && InsecureRandBool() == 0) {
     213 |                  unsigned int flushIndex = InsecureRandRange(stack.size() - 1);
     214 | +                if (fake_best_block) stack[flushIndex]->SetBestBlock(InsecureRand256());
    


    dongcarl commented at 6:22 PM on December 9, 2019:

    Perhaps we can add a comment about the particular situations in which fake_best_block is needed, and why it is needed.


    jamesob commented at 8:45 PM on December 11, 2019:

    Thanks for the look; added a comment.

  6. tests: have coins simulation test also use CCoinsViewDB
    Before this change, the coins simulation test uses a base view of type
    CCoinsViewTest, which has no relevance outside of the unittest suite. Might as
    well reuse this testcase with a more realistic configuration that has
    CCoinsViewDB at the bottom of the view structure.
    bee88b8c58
  7. jamesob force-pushed on Dec 11, 2019
  8. jamesob commented at 5:18 PM on January 2, 2020: member

    I think AppVeyor needs a kick?

  9. MarcoFalke closed this on Jan 2, 2020

  10. MarcoFalke reopened this on Jan 2, 2020

  11. MarcoFalke closed this on Jan 2, 2020

  12. MarcoFalke reopened this on Jan 2, 2020

  13. ryanofsky approved
  14. ryanofsky commented at 4:27 PM on April 16, 2020: member

    Code review ACK bee88b8c5887e6beb75f26f0db97888a48fa7e7c

  15. MarcoFalke merged this on Apr 16, 2020
  16. MarcoFalke closed this on Apr 16, 2020

  17. sidhujag referenced this in commit 7dd5683a90 on Apr 16, 2020
  18. Fabcien referenced this in commit 2db657ee05 on Jan 18, 2021
  19. DrahtBot locked this on Feb 15, 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: 2026-04-27 21:14 UTC

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