test: Fix BlockToJsonVerbose benchmark #20998

pull martinus wants to merge 1 commits into bitcoin:master from martinus:2021-01-fix-BlockToJsonVerbose-single-benchmark-run changing 1 files +3 −0
  1. martinus commented at 9:32 AM on January 24, 2021: contributor

    Currently it was not possible to run just the BlockToJsonVerbose benchmark because it did not set up everything it needed, running bench_bitcoin -filter=BlockToJsonVerbose caused this assert to fail:

    bench_bitcoin: chainparams.cpp:506: const CChainParams& Params(): Assertion `globalChainParams' failed.
    

    Initializing TestingSetup fixes this.

  2. Fix BlockToJsonVerbose benchmark
    Currently it was not possible to run just the BlockToJsonVerboes benchmarsk because it did not set up everything it needed, running `bench_bitcoin -filter=BlockToJsonVerbose` caused this assert to fail:
    
    ```
    bench_bitcoin: chainparams.cpp:506: const CChainParams& Params(): Assertion `globalChainParams' failed.
    ```
    
    Initializing TestingSetup fixes this.
    7487bc9900
  3. MarcoFalke commented at 9:50 AM on January 24, 2021: member

    Concept ACK. Globals are really the stick-in-the-mud when it comes to testing.

  4. MarcoFalke renamed this:
    Fix BlockToJsonVerbose benchmark
    test: Fix BlockToJsonVerbose benchmark
    on Jan 24, 2021
  5. DrahtBot added the label Tests on Jan 24, 2021
  6. martinus commented at 11:13 AM on January 24, 2021: contributor

    Concept ACK. Globals are really the stick-in-the-mud when it comes to testing.

    I've now created a little script that runs each benchmark in a separate process, and the same for unit tests, and it looks like BlockToJsonVerbose was the only one that did not work. So it's not so bad :)

  7. theStack approved
  8. theStack commented at 1:58 PM on January 24, 2021: member

    Tested ACK 7487bc9900d28e1b5361cba882fd8783aafc7092 🐎 Thanks for fixing!

  9. MarcoFalke merged this on Jan 25, 2021
  10. MarcoFalke closed this on Jan 25, 2021

  11. in src/bench/rpc_blockchain.cpp:17 in 7487bc9900
      12 |  
      13 |  #include <univalue.h>
      14 |  
      15 |  static void BlockToJsonVerbose(benchmark::Bench& bench)
      16 |  {
      17 | +    TestingSetup test_setup{};
    


    MarcoFalke commented at 10:42 AM on January 25, 2021:

    Doesn't matter here, but it would be good to specify -nodebuglogfile to be on the safe side


    MarcoFalke commented at 10:44 AM on January 25, 2021:

    Fixed in #21003

  12. sidhujag referenced this in commit ed44630b9a on Jan 25, 2021
  13. 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: 2026-04-26 12:14 UTC

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