bench: fix used file that is not opened #31693

pull rex4539 wants to merge 1 commits into bitcoin:master from rex4539:fix-useClosedFile changing 1 files +21 −10
  1. rex4539 commented at 7:18 pm on January 20, 2025: contributor

    Fixes

    0src/bench/load_external.cpp:57:17: error: Used file that is not opened. [useClosedFile]
    1            if (fwrite(ss.data(), 1, ss.size(), file) != ss.size()) {
    2                ^
    3src/bench/load_external.cpp:61:9: error: Used file that is not opened. [useClosedFile]
    4        fclose(file);
    5        ^
    
  2. DrahtBot commented at 7:18 pm on January 20, 2025: contributor

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

    Code Coverage & Benchmarks

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

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

  3. DrahtBot added the label Tests on Jan 20, 2025
  4. bench: fix used file that is not opened f90c3dde71
  5. in src/bench/load_external.cpp:53 in ae7daab20b outdated
    47@@ -48,18 +48,29 @@ static void LoadExternalBlockFile(benchmark::Bench& bench)
    48     // because that first writes a compact size.
    49     ss << Span{benchmark::data::block413567};
    50 
    51-    // Create the test file.
    52-    {
    53+    // Ensure the directory exists
    54+    if (!fs::exists(testing_setup.get()->m_path_root)) {
    55+    fs::create_directories(testing_setup.get()->m_path_root);
    


    l0rinc commented at 7:26 pm on January 20, 2025:
    formatting is completely off - is this still a draft?

    rex4539 commented at 7:34 pm on January 20, 2025:
    Forgot to format before committing. Should be ok now :)

    l0rinc commented at 7:37 pm on January 20, 2025:
    Did you test it before committing?

    rex4539 commented at 7:56 pm on January 20, 2025:
    I compiled and ran bench_bitcoin.
  6. rex4539 force-pushed on Jan 20, 2025

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: 2025-01-21 03:12 UTC

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