feat: verbose 模式 SKIP 行输出跳过原因

This commit is contained in:
2026-10-16 19:38:19 +00:00
parent 550217c086
commit 73f7c0562b
5 changed files with 69 additions and 32 deletions
Generated
+21 -21
View File
@@ -1160,7 +1160,7 @@ dependencies = [
[[package]]
name = "oxide_builtins"
version = "0.20.1"
version = "0.20.3"
dependencies = [
"chrono",
"fast-float",
@@ -1185,7 +1185,7 @@ dependencies = [
[[package]]
name = "oxide_bytecode"
version = "0.20.1"
version = "0.20.3"
dependencies = [
"num-bigint",
"oxide_log",
@@ -1193,7 +1193,7 @@ dependencies = [
[[package]]
name = "oxide_cfg"
version = "0.20.1"
version = "0.20.3"
dependencies = [
"oxide_bytecode",
"oxide_emit",
@@ -1204,7 +1204,7 @@ dependencies = [
[[package]]
name = "oxide_cli"
version = "0.20.1"
version = "0.20.3"
dependencies = [
"ansi_term",
"bumpalo",
@@ -1228,7 +1228,7 @@ dependencies = [
[[package]]
name = "oxide_code_cache"
version = "0.20.1"
version = "0.20.3"
dependencies = [
"lru",
"oxide_bytecode",
@@ -1237,7 +1237,7 @@ dependencies = [
[[package]]
name = "oxide_compiler"
version = "0.20.1"
version = "0.20.3"
dependencies = [
"oxide_bytecode",
"oxide_cfg",
@@ -1258,7 +1258,7 @@ dependencies = [
[[package]]
name = "oxide_dce"
version = "0.20.1"
version = "0.20.3"
dependencies = [
"oxide_bytecode",
"oxide_cfg",
@@ -1272,7 +1272,7 @@ dependencies = [
[[package]]
name = "oxide_emit"
version = "0.20.1"
version = "0.20.3"
dependencies = [
"num-bigint",
"oxc_allocator",
@@ -1288,7 +1288,7 @@ dependencies = [
[[package]]
name = "oxide_engine"
version = "0.20.1"
version = "0.20.3"
dependencies = [
"oxide_bytecode",
"oxide_compiler",
@@ -1300,7 +1300,7 @@ dependencies = [
[[package]]
name = "oxide_fold"
version = "0.20.1"
version = "0.20.3"
dependencies = [
"num-bigint",
"oxide_bytecode",
@@ -1312,7 +1312,7 @@ dependencies = [
[[package]]
name = "oxide_ir"
version = "0.20.1"
version = "0.20.3"
dependencies = [
"oxide_bytecode",
"oxide_log",
@@ -1321,7 +1321,7 @@ dependencies = [
[[package]]
name = "oxide_kernel"
version = "0.20.1"
version = "0.20.3"
dependencies = [
"bumpalo",
"dashmap",
@@ -1335,7 +1335,7 @@ dependencies = [
[[package]]
name = "oxide_liveness"
version = "0.20.1"
version = "0.20.3"
dependencies = [
"oxide_bytecode",
"oxide_cfg",
@@ -1347,7 +1347,7 @@ dependencies = [
[[package]]
name = "oxide_log"
version = "0.20.1"
version = "0.20.3"
dependencies = [
"tracing",
"tracing-appender",
@@ -1356,11 +1356,11 @@ dependencies = [
[[package]]
name = "oxide_net"
version = "0.20.1"
version = "0.20.3"
[[package]]
name = "oxide_parser"
version = "0.20.1"
version = "0.20.3"
dependencies = [
"oxc_allocator",
"oxc_ast",
@@ -1375,7 +1375,7 @@ dependencies = [
[[package]]
name = "oxide_regalloc"
version = "0.20.1"
version = "0.20.3"
dependencies = [
"oxide_bytecode",
"oxide_cfg",
@@ -1391,7 +1391,7 @@ dependencies = [
[[package]]
name = "oxide_runtime_api"
version = "0.20.1"
version = "0.20.3"
dependencies = [
"num-bigint",
"num-traits",
@@ -1404,7 +1404,7 @@ dependencies = [
[[package]]
name = "oxide_test262"
version = "0.20.1"
version = "0.20.3"
dependencies = [
"oxide_bytecode",
"oxide_compiler",
@@ -1424,7 +1424,7 @@ dependencies = [
[[package]]
name = "oxide_types"
version = "0.20.1"
version = "0.20.3"
dependencies = [
"bumpalo",
"dashmap",
@@ -1437,7 +1437,7 @@ dependencies = [
[[package]]
name = "oxide_vm"
version = "0.20.1"
version = "0.20.3"
dependencies = [
"bumpalo",
"chrono",
+1 -1
View File
@@ -25,7 +25,7 @@ members = [
]
[workspace.package]
version = "0.20.2"
version = "0.20.3"
edition = "2021"
license = "MIT"
rust-version = "1.80"
+1 -1
View File
@@ -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\
+2 -9
View File
@@ -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, &params.paths[i]));
}
tests_since_kernel_reset += 1;
+44
View File
@@ -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]