test(portable): fix native stack and process-fixture assumptions
ci/woodpecker/push/woodpecker Pipeline was successful
Linux strict security lane (G-C) / strict isolation escape matrix (push) Canceled after 0s
CI / fmt + clippy + test (Linux x86_64) (push) Canceled after 0s
CI / schema instance validation + consumers (push) Canceled after 0s
CI / runtime contract (macos-latest) (push) Canceled after 0s
CI / runtime contract (windows-latest) (push) Canceled after 0s
CI / release evidence manifest (push) Canceled after 0s
CI / release candidate artifact (macos-latest) (push) Canceled after 0s
CI / release candidate artifact (ubuntu-latest) (push) Canceled after 0s

macOS arm64 aborted in nesting_depth_limit_is_enforced because the test-harness
thread stack is smaller than a production main thread. Run that contract test
on an explicit 8 MiB stack; the 128-level parser bound itself is unchanged.

The stdlib process product test hard-coded /bin/echo, which does not exist on
Windows. Use the test CLI itself as the granted program: the fixture reads
MARQDO_TEST_PROCESS_PROGRAM from the granted env, runs it with --version, and
the harness compares against the same invocation. process.run now forwards
SYSTEMROOT/WINDIR on Windows (process creation/DLL loading, not a capability),
and the bundled stdlib digest is regenerated for the changed test fixture.
This commit is contained in:
cflmy committed 2026-11-21 18:35:33 +08:00
1 parent 3a29fce061
commit b898c419fe
5 files changed
+102 -39

No files matched your search

+21
View File
@@ -1377,8 +1377,29 @@ mod tests {
format!("{}1{}", "(".repeat(depth), ")".repeat(depth))
}
/// Run a deeply recursive parser test on an explicit stack.
///
/// The test harness gives each test thread a small stack on some native
/// platforms (macOS arm64 aborted with a stack overflow at the 128-level
/// nesting check). Production parsing happens on the main thread; pinning
/// this test to 8 MiB keeps the contract test meaningful without depending
/// on the harness default.
fn with_parser_stack<F: FnOnce() + Send + 'static>(body: F) {
std::thread::Builder::new()
.name("parser-nesting-depth".to_string())
.stack_size(8 * 1024 * 1024)
.spawn(body)
.expect("spawn parser nesting thread")
.join()
.expect("parser nesting thread panicked");
}
#[test]
fn nesting_depth_limit_is_enforced() {
with_parser_stack(nesting_depth_limit_is_enforced_body);
}
fn nesting_depth_limit_is_enforced_body() {
assert!(parse_expression(&nested_parens(MAX_NESTING_DEPTH)).is_ok());
let err = parse_expression(&nested_parens(MAX_NESTING_DEPTH + 1)).unwrap_err();
assert_eq!(err.code, "expr.parse");