Procházet zdrojové kódy

Print signal-exits from tests

default_compile_flags
vector-of-bool před 4 roky
rodič
revize
725755b8b7
3 změnil soubory, kde provedl 16 přidání a 4 odebrání
  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 Zobrazit soubor

@@ -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 Zobrazit soubor

@@ -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 Zobrazit soubor

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

/**

Načítá se…
Zrušit
Uložit