mind-body tests: the grace is exact at its boundary, and the child's stderr is the journal
Both found by hand mutation: grace-boundary-late and stderr-not-the-journal had no test. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9dcc73c210
commit
6e2733fb47
2 changed files with 7 additions and 1 deletions
|
|
@ -508,6 +508,10 @@ fn after_the_flush_the_grace_interrupts_exactly_once_and_not_a_second_early() {
|
|||
assert_eq!(on_time.count(&Event::Interrupted), 1);
|
||||
assert_eq!(on_time.ended().0, Cause::Interrupted);
|
||||
|
||||
// Exactly at the grace is the grace: the interrupt comes then, not on the next wait.
|
||||
let exact = carry_with(&Seen::of(&with_run()), vec![Out(at("m1", CEILING_TOKENS)), Idle(grace)], Some(130), true);
|
||||
assert_eq!(exact.ended().0, Cause::Interrupted);
|
||||
|
||||
// A child that ignores it is interrupted once and still waited for.
|
||||
let stubborn = carry_with(&Seen::of(&with_run()), vec![Out(at("m1", CEILING_TOKENS)), Idle(grace), Idle(grace), Idle(grace)], Some(0), false);
|
||||
assert_eq!(stubborn.count(&Event::Interrupted), 1);
|
||||
|
|
|
|||
|
|
@ -236,7 +236,8 @@ mod lane {
|
|||
)
|
||||
};
|
||||
let body = format!(
|
||||
"echo '{first}'\necho '{second}'\nread -t 5 start\nread -t 5 flush\necho \"$start\" >> {record}\necho \"$flush\" >> {record}\necho \"$SELF_RUN_ENV_CANARY\" >> {record}\necho '{{\"type\":\"result\"}}'\nwhile read more; do :; done\nexit 0",
|
||||
"echo journal-line >&2
|
||||
echo '{first}'\necho '{second}'\nread -t 5 start\nread -t 5 flush\necho \"$start\" >> {record}\necho \"$flush\" >> {record}\necho \"$SELF_RUN_ENV_CANARY\" >> {record}\necho '{{\"type\":\"result\"}}'\nwhile read more; do :; done\nexit 0",
|
||||
first = request("msg_1", 100),
|
||||
second = request("msg_2", 299_999),
|
||||
record = bin.path().join("record").display(),
|
||||
|
|
@ -249,6 +250,7 @@ mod lane {
|
|||
assert_eq!(output.status.code(), Some(0), "{stdout}\n{}", String::from_utf8_lossy(&output.stderr));
|
||||
assert_eq!(stdout, "request 1 prefix 101\nrequest 2 prefix 300000\nended: flushed code 0 requests 2 prefix 300000\n");
|
||||
assert!(!all_output(&output).contains(ENV_CANARY), "the unit's environment is the child's, not the bin's output");
|
||||
assert!(String::from_utf8_lossy(&output.stderr).contains("journal-line"), "the child's stderr is the unit's journal");
|
||||
|
||||
let recorded = std::fs::read_to_string(&record).unwrap();
|
||||
let mut lines = recorded.lines();
|
||||
|
|
|
|||
Loading…
Reference in a new issue