The json reporter does not print results of benchmarks

未关闭
#2,879 4 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

@pavan591-0 已经在做这个了。

开始于 2024年8月12日。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
cpp
领域
testing

调研方向

使用提供的 C++ 基准测试重现该问题,并将 ./bench -r json 的 JSON 输出与附带的 XML 和 JSON 示例进行比较。跟踪 JSON reporter 的 benchmark-results 路径,然后验证 JSON 报告包含 XML reporter 显示的基准测试结果。

由索引模型根据 Issue 内容生成。

描述

Describe the bug
The json reporter does not print results of benchmarks

Expected result

The xml reporter provides the benchmark results: bench.xml.txt

The json reporter misses the benchmark results: bench.json

Reproduction steps

  1. compile the following code with catch2
  2. run with ./bench -r json > bench.json
#include <catch2/benchmark/catch_benchmark.hpp>
#include <catch2/catch_test_macros.hpp>

#include <cctype>

std::uint64_t Fibonacci(std::uint64_t number)
{
    return number < 2 ? 1 : Fibonacci(number - 1) + Fibonacci(number - 2);
}

TEST_CASE("Fibonacci")
{
    CHECK(Fibonacci(0) == 1);
    // some more asserts..
    CHECK(Fibonacci(5) == 8);
    // some more asserts..

    // now let's benchmark:
    BENCHMARK("Fibonacci 20")
    {
        return Fibonacci(20);
    };

    BENCHMARK("Fibonacci 25")
    {
        return Fibonacci(25);
    };

    BENCHMARK("Fibonacci 30")
    {
        return Fibonacci(30);
    };

    BENCHMARK("Fibonacci 35")
    {
        return Fibonacci(35);
    };
}

Platform information:

  • OS: Ubuntu 22.04
  • Compiler+version: GCC 11.4
  • Catch version: v3.6.0
主要语言
C++
星标
21.6k
派生
3.4k
平均合并
3 天 12 小时
30 天内合并 PR
5

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

catchorg/Catch2 的其他 Issue

查看 catchorg/Catch2 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。