瀏覽代碼

Print signal-exits from tests

default_compile_flags
vector-of-bool 4 年之前
父節點
當前提交
725755b8b7
共有 3 個文件被更改,包括 16 次插入4 次删除
  1. +14
    -4
      src/dds/build/builder.cpp
  2. +1
    -0
      src/dds/build/plan/exe.cpp
  3. +1
    -0
      src/dds/build/plan/exe.hpp

+ 14
- 4
src/dds/build/builder.cpp 查看文件

@@ -22,6 +22,18 @@ struct state {
bool generate_catch2_main = false;
};

void log_failure(const test_failure& fail) {
spdlog::error("Test '{}' failed! [exitted {}]", fail.executable_path.string(), fail.retc);
if (fail.signal) {
spdlog::error("Test execution received signal {}", fail.signal);
}
if (trim_view(fail.output).empty()) {
spdlog::error("(Test executable produced no output");
} else {
spdlog::error("Test output:\n{}[dds - test output end]", fail.output);
}
}

lm::library
prepare_catch2_driver(test_lib test_driver, const build_params& params, build_env_ref env_) {
fs::path test_include_root = params.out_root / "_catch-2.10.2";
@@ -229,10 +241,8 @@ void builder::build(const build_params& params) const {
auto test_failures = plan.run_all_tests(env, params.parallel_jobs);
spdlog::info("Test execution finished in {:n}ms", sw.elapsed_ms().count());

for (auto& failures : test_failures) {
spdlog::error("Test {} failed! Output:\n{}[dds - test output end]",
failures.executable_path.string(),
failures.output);
for (auto& fail : test_failures) {
log_failure(fail);
}
if (!test_failures.empty()) {
throw_user_error<errc::test_failure>();

+ 1
- 0
src/dds/build/plan/exe.cpp 查看文件

@@ -88,6 +88,7 @@ std::optional<test_failure> link_executable_plan::run_test(build_env_ref env) co
f.executable_path = exe_path;
f.output = res.output;
f.retc = res.retc;
f.signal = res.signal;
return f;
}
}

+ 1
- 0
src/dds/build/plan/exe.hpp 查看文件

@@ -19,6 +19,7 @@ struct test_failure {
fs::path executable_path;
std::string output;
int retc;
int signal;
};

/**

Loading…
取消
儲存