mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-23 18:21:13 +08:00
feat: verbose 模式 SKIP 行输出跳过原因
This commit is contained in:
@@ -167,7 +167,7 @@ impl RunConfig {
|
||||
\n\
|
||||
--no-skip Run capability-excluded tests and count unsupported compile/runtime results as failures.\n\
|
||||
--no-regalloc Disable the liveness/precise-DCE/RegAlloc compiler chain (vregs stay as physical numbers).\n\
|
||||
--verbose Print one PASS/FAIL/SKIP line per test (for on/off result-set comparison).\n\
|
||||
--verbose Print one PASS/FAIL/SKIP line per test; SKIP lines carry the skip reason (for on/off result-set comparison).\n\
|
||||
--no-fail-list Do not print the per-path FAIL list at the end of the run.\n\
|
||||
--version Print the binary version with the build-time git short hash (freshness self-check), then exit.\n\
|
||||
--supervise Run the suite as single-worker child-process windows with a hard per-test timeout and\n\
|
||||
|
||||
@@ -28,7 +28,7 @@ use harness::{HarnessModuleCache, HarnessPrefixCache, HarnessSources, HARNESS};
|
||||
use heartbeat::write_heartbeat;
|
||||
use judge::{categorize_fail, TestOutcome, TestResult};
|
||||
use oxide_log::{Level, LogConfig, Output, SUBSYSTEM_COUNT};
|
||||
use report::{append_fail_log, first_line, format_fail_categories, format_fail_groupings, format_fail_list};
|
||||
use report::{append_fail_log, format_fail_categories, format_fail_groupings, format_fail_list, verbose_line};
|
||||
use runner::{build_runner_engine, process_path, CURRENT_TEST_PATH};
|
||||
use safe_supervise::run_safe;
|
||||
use stats::RunStats;
|
||||
@@ -129,14 +129,7 @@ fn run_worker_window(
|
||||
// 无漏项、无双计的写序契约)。
|
||||
stats.hb_write_errors += on_heartbeat(i, &result, &stats);
|
||||
if params.verbose {
|
||||
match &result.outcome {
|
||||
TestOutcome::Pass(_) => println!("PASS {}", params.paths[i].display()),
|
||||
TestOutcome::Fail(msg) => {
|
||||
let (cat, _) = categorize_fail(msg);
|
||||
println!("FAIL {} [{}] {}", params.paths[i].display(), cat, first_line(msg));
|
||||
}
|
||||
TestOutcome::Skip(_) => println!("SKIP {}", params.paths[i].display()),
|
||||
}
|
||||
println!("{}", verbose_line(&result.outcome, ¶ms.paths[i]));
|
||||
}
|
||||
tests_since_kernel_reset += 1;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
//! 失败诊断:FailRecord 捕获、FAIL 清单/类别段格式化。
|
||||
//! 全部为纯函数/String builder(可单测),不持有全局状态。
|
||||
|
||||
use crate::judge::{categorize_fail, TestOutcome};
|
||||
use crate::RunStats;
|
||||
use std::collections::HashMap;
|
||||
use std::path::{Path, PathBuf};
|
||||
@@ -34,6 +35,25 @@ pub fn escape_log_field(s: &str) -> String {
|
||||
s.replace(['\t', '\n', '\r'], " ")
|
||||
}
|
||||
|
||||
/// 格式化 verbose 逐测试行:PASS 仅路径,FAIL 为路径加类别加消息首行,
|
||||
/// SKIP 为路径加跳过原因首行。
|
||||
///
|
||||
/// # 边界与前提
|
||||
/// - `^PASS ` / `^FAIL ` / `^SKIP ` 前缀是逐行解析的对外契约;原因追加在路径
|
||||
/// 之后,前缀结构不变,按前缀匹配的行解析不受影响。
|
||||
/// - SKIP 原因取跳过消息首行,与 FAIL 行「路径后方括号标签加消息首行」形态
|
||||
/// 对称;跳过消息是固定原因的集合,本函数不新增任何文案。
|
||||
pub fn verbose_line(outcome: &TestOutcome, path: &Path) -> String {
|
||||
match outcome {
|
||||
TestOutcome::Pass(_) => format!("PASS {}", path.display()),
|
||||
TestOutcome::Fail(msg) => {
|
||||
let (cat, _) = categorize_fail(msg);
|
||||
format!("FAIL {} [{}] {}", path.display(), cat, first_line(msg))
|
||||
}
|
||||
TestOutcome::Skip(msg) => format!("SKIP {} [{}]", path.display(), first_line(msg)),
|
||||
}
|
||||
}
|
||||
|
||||
/// 类别计数降序的打印版(返回 String,可单测);`vm: other`/`compile: other`/`other`
|
||||
/// 碎片桶附带 ≤5 条样本(`路径 消息首行`)。空类别返回空串。
|
||||
pub fn format_fail_categories(stats: &RunStats, paths: &[PathBuf]) -> String {
|
||||
@@ -241,6 +261,30 @@ mod tests {
|
||||
assert_eq!(escape_log_field("a\tb\nc\rd"), "a b c d");
|
||||
}
|
||||
|
||||
/// verbose 逐测试行三臂格式钉:PASS 仅路径、FAIL 为类别加消息首行、
|
||||
/// SKIP 为原因首行(多行消息取首行);`^PASS ` / `^FAIL ` / `^SKIP `
|
||||
/// 前缀契约不变。
|
||||
#[test]
|
||||
fn verbose_line_pins_three_arm_formats() {
|
||||
let path = PathBuf::from("built-ins/Promise/t.js");
|
||||
assert_eq!(
|
||||
verbose_line(&TestOutcome::Pass("ok".into()), &path),
|
||||
"PASS built-ins/Promise/t.js"
|
||||
);
|
||||
assert_eq!(
|
||||
verbose_line(&TestOutcome::Fail("vm error: TypeError: x is not callable".into()), &path),
|
||||
"FAIL built-ins/Promise/t.js [vm: not callable] vm error: TypeError: x is not callable"
|
||||
);
|
||||
assert_eq!(
|
||||
verbose_line(&TestOutcome::Skip("compile error: not yet supported: SpreadElement".into()), &path),
|
||||
"SKIP built-ins/Promise/t.js [compile error: not yet supported: SpreadElement]"
|
||||
);
|
||||
assert_eq!(
|
||||
verbose_line(&TestOutcome::Skip("staging tests excluded\nsecond line".into()), &path),
|
||||
"SKIP built-ins/Promise/t.js [staging tests excluded]"
|
||||
);
|
||||
}
|
||||
|
||||
/// `not callable` 调用点提取:带/不带 `vm error: ` 前缀均可定位,
|
||||
/// 无前缀 / 无后缀 / 中间空一律回退 `(none)`。
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user