feat: --version 嵌入构建期 git 哈希并新增新鲜度检查脚本

This commit is contained in:
2026-09-26 07:04:55 +00:00
parent fe3e84be6b
commit 83ff9bbca1
6 changed files with 114 additions and 2 deletions
+2 -1
View File
@@ -80,12 +80,13 @@ impl RunConfig {
/// 打印用法说明。
pub(crate) fn usage() -> String {
"usage: test262-runner [--no-skip] [--no-regalloc] [--verbose] [--supervise] [--leak-check] [--leak-check-interval=N] [test262-root] [path-filter]\n\
"usage: test262-runner [--no-skip] [--no-regalloc] [--verbose] [--supervise] [--leak-check] [--leak-check-interval=N] [--version] [test262-root] [path-filter]\n\
\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\
--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\
\x20 automatic resume past any hanging/crashing test. A hang or crash is reported by path.\n\
\x20 Combines with [path-filter]: the filter is applied per-test inside each child window.\n\
+5
View File
@@ -74,6 +74,11 @@ fn run_tests() -> bool {
println!("{}", RunConfig::usage());
return true;
}
// 版本自报走 stdout 并成功退出;哈希由构建期注入,无 git 环境缺省 "unknown"。
if args.iter().any(|a| a == "--version") {
println!("test262-runner {} ({})", env!("CARGO_PKG_VERSION"), env!("GIT_COMMIT"));
return true;
}
let config = match RunConfig::parse(&args) {
Ok(config) => config,
Err(msg) => {