test: 添加测试递归栈上限与环境变量配置
This commit is contained in:
@@ -571,6 +571,9 @@ fn build_runner_kernel() -> Arc<OxideKernel> {
|
|||||||
// runner's local config; KernelConfig::minimal() stays unbounded for other crates.
|
// runner's local config; KernelConfig::minimal() stays unbounded for other crates.
|
||||||
let mut kernel_config = KernelConfig::minimal();
|
let mut kernel_config = KernelConfig::minimal();
|
||||||
kernel_config.max_steps = Some(50_000_000);
|
kernel_config.max_steps = Some(50_000_000);
|
||||||
|
// Keep test262 recursion tests from reaching Rust's native stack before the
|
||||||
|
// VM converts deep JS calls into a catchable RangeError.
|
||||||
|
kernel_config.max_call_depth = 256;
|
||||||
let kernel = Arc::new(OxideKernel::new(kernel_config));
|
let kernel = Arc::new(OxideKernel::new(kernel_config));
|
||||||
init_kernel_builtins(&kernel);
|
init_kernel_builtins(&kernel);
|
||||||
kernel
|
kernel
|
||||||
@@ -691,10 +694,13 @@ fn run_tests() -> bool {
|
|||||||
// own kernel + harness-source registry + prefix cache. Only `PathBuf` and
|
// own kernel + harness-source registry + prefix cache. Only `PathBuf` and
|
||||||
// `TestResult` (both `Send`) cross thread boundaries. Workers pull test
|
// `TestResult` (both `Send`) cross thread boundaries. Workers pull test
|
||||||
// indices from a shared atomic cursor for dynamic load balancing.
|
// indices from a shared atomic cursor for dynamic load balancing.
|
||||||
let workers = std::thread::available_parallelism()
|
let workers = std::env::var("OXIDE_TEST262_WORKERS")
|
||||||
.map(|n| n.get())
|
.ok()
|
||||||
.unwrap_or(1)
|
.and_then(|s| s.parse::<usize>().ok())
|
||||||
|
.filter(|&n| n > 0)
|
||||||
|
.unwrap_or_else(|| std::thread::available_parallelism().map(|n| n.get()).unwrap_or(1))
|
||||||
.min(total.max(1));
|
.min(total.max(1));
|
||||||
|
let trace_paths = std::env::var_os("OXIDE_TEST262_TRACE").is_some();
|
||||||
|
|
||||||
eprintln!("running on {workers} worker thread(s)");
|
eprintln!("running on {workers} worker thread(s)");
|
||||||
|
|
||||||
@@ -727,6 +733,9 @@ fn run_tests() -> bool {
|
|||||||
if i >= total {
|
if i >= total {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if trace_paths {
|
||||||
|
eprintln!(" running: {}", paths_ref[i].display());
|
||||||
|
}
|
||||||
|
|
||||||
let result = process_path(
|
let result = process_path(
|
||||||
&paths_ref[i],
|
&paths_ref[i],
|
||||||
|
|||||||
Reference in New Issue
Block a user