test: 精简 test262 测试输出
This commit is contained in:
@@ -2,7 +2,6 @@ use oxide_compiler::compiler::Compiler;
|
|||||||
use oxide_kernel::kernel::{KernelConfig, OxideKernel};
|
use oxide_kernel::kernel::{KernelConfig, OxideKernel};
|
||||||
use oxide_vm::vm::Vm;
|
use oxide_vm::vm::Vm;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::io::Write;
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
@@ -38,6 +37,7 @@ struct TestMeta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
#[allow(dead_code)]
|
||||||
enum TestOutcome {
|
enum TestOutcome {
|
||||||
Pass(String),
|
Pass(String),
|
||||||
Fail(String),
|
Fail(String),
|
||||||
@@ -45,6 +45,7 @@ enum TestOutcome {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
#[allow(dead_code)]
|
||||||
struct TestResult {
|
struct TestResult {
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
outcome: TestOutcome,
|
outcome: TestOutcome,
|
||||||
@@ -396,14 +397,6 @@ fn main() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let rel = path.strip_prefix(&test262_root).unwrap_or(path);
|
|
||||||
if let Ok(mut f) = std::fs::File::create("test262-crash.log") {
|
|
||||||
let _ = write!(f, "{}\n", rel.display());
|
|
||||||
let _ = f.flush();
|
|
||||||
}
|
|
||||||
eprintln!(" running: {}", rel.display());
|
|
||||||
let _ = std::io::stderr().flush();
|
|
||||||
|
|
||||||
let result = run_test(path, &source, &meta, &kernel);
|
let result = run_test(path, &source, &meta, &kernel);
|
||||||
match &result.outcome {
|
match &result.outcome {
|
||||||
TestOutcome::Pass(_) => stats.pass += 1,
|
TestOutcome::Pass(_) => stats.pass += 1,
|
||||||
@@ -416,49 +409,29 @@ fn main() {
|
|||||||
|
|
||||||
eprintln!();
|
eprintln!();
|
||||||
|
|
||||||
let mut pass_count = 0;
|
let ran = stats.pass + stats.fail;
|
||||||
let mut fail_count = 0;
|
|
||||||
let mut skip_count = 0;
|
|
||||||
|
|
||||||
for r in &results {
|
|
||||||
match &r.outcome {
|
|
||||||
TestOutcome::Pass(msg) => {
|
|
||||||
pass_count += 1;
|
|
||||||
let rel = r.path.strip_prefix(&test262_root).unwrap_or(&r.path);
|
|
||||||
println!("PASS [{:>7}ms] {} -- {msg}", r.duration_ms, rel.display());
|
|
||||||
}
|
|
||||||
TestOutcome::Fail(msg) => {
|
|
||||||
fail_count += 1;
|
|
||||||
let rel = r.path.strip_prefix(&test262_root).unwrap_or(&r.path);
|
|
||||||
println!("FAIL [{:>7}ms] {} -- {msg}", r.duration_ms, rel.display());
|
|
||||||
}
|
|
||||||
TestOutcome::Skip(_msg) => {
|
|
||||||
skip_count += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
println!();
|
println!();
|
||||||
println!("═══════════════════════════════════════");
|
println!("═══════════════════════════════════════");
|
||||||
println!(" test262 results");
|
println!(" test262 results");
|
||||||
println!("═══════════════════════════════════════");
|
println!("═══════════════════════════════════════");
|
||||||
println!(" total : {}", results.len());
|
println!(" total : {}", results.len());
|
||||||
println!(" pass : {pass_count}");
|
println!(" pass : {}", stats.pass);
|
||||||
println!(" fail : {fail_count}");
|
println!(" fail : {}", stats.fail);
|
||||||
println!(" skip : {skip_count}");
|
println!(" skip : {}", stats.skip);
|
||||||
println!(" time : {:?}", Duration::from_millis(stats.total_ms));
|
println!(" time : {:?}", Duration::from_millis(stats.total_ms));
|
||||||
println!(
|
println!(
|
||||||
" pass% : {:.1}% (of ran: {:.1}%)",
|
" pass% : {:.1}% (of ran: {:.1}%)",
|
||||||
pass_count as f64 / results.len() as f64 * 100.0,
|
stats.pass as f64 / results.len() as f64 * 100.0,
|
||||||
if pass_count + fail_count > 0 {
|
if ran > 0 {
|
||||||
pass_count as f64 / (pass_count + fail_count) as f64 * 100.0
|
stats.pass as f64 / ran as f64 * 100.0
|
||||||
} else {
|
} else {
|
||||||
0.0
|
0.0
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
println!("═══════════════════════════════════════");
|
println!("═══════════════════════════════════════");
|
||||||
|
|
||||||
if fail_count > 0 {
|
if stats.fail > 0 {
|
||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user