Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 33 additions & 4 deletions tests/dev/security-gate-concurrency-cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -1499,10 +1499,13 @@ def test_output_limits(work: Path) -> None:
)


def residual_flood_fixture(work: Path) -> tuple[Path, Path, Path]:
def residual_flood_fixture(work: Path) -> tuple[Path, Path, Path, Path, Path, Path]:
work.mkdir(parents=True, exist_ok=True)
completion = work / "descendant-flood-completed"
group_file = work / "residual-flood.group"
started = work / "residual-flood.started"
arm = work / "residual-flood.arm"
ready = work / "residual-flood.ready"
flood = write_script(
work,
"residual-flood.sh",
Expand All @@ -1522,10 +1525,27 @@ def residual_flood_fixture(work: Path) -> tuple[Path, Path, Path]:
: > "$FLOOD_COMPLETION"
exit 0
}
trap '' TERM
: > "$FLOOD_STARTED"
while [ ! -f "$FLOOD_ARM" ]; do sleep 0.002; done
trap flood TERM
: > "$FLOOD_READY"
while :; do sleep 1; done
) &
exit 0
for ((attempt = 0; attempt < 500; attempt++)); do
if [ -f "$FLOOD_STARTED" ]; then
: > "$FLOOD_ARM"
for ((ready_attempt = 0; ready_attempt < 500; ready_attempt++)); do
if [ -f "$FLOOD_READY" ]; then
exit 0
fi
sleep 0.002
done
exit 125
fi
sleep 0.002
done
exit 125
""",
)
return (
Expand All @@ -1536,11 +1556,14 @@ def residual_flood_fixture(work: Path) -> tuple[Path, Path, Path]:
),
completion,
group_file,
started,
arm,
ready,
)


def test_residual_cleanup_output_limit(work: Path) -> None:
manifest, completion, group_file = residual_flood_fixture(work)
manifest, completion, group_file, started, arm, ready = residual_flood_fixture(work)
small_helper = transformed_helper(
work,
"residual-output-limit",
Expand All @@ -1566,8 +1589,11 @@ def test_residual_cleanup_output_limit(work: Path) -> None:
1,
helper=small_helper,
extra_env={
"FLOOD_ARM": str(arm),
"FLOOD_COMPLETION": str(completion),
"GROUP_FILE": str(group_file),
"FLOOD_READY": str(ready),
"FLOOD_STARTED": str(started),
},
)
check(result.rc == 125, "residual descendant output overflow returns infrastructure")
Expand Down Expand Up @@ -1911,14 +1937,17 @@ def test_sensitivity_mutants(work: Path) -> None:
if residual_mutant is not None:
fixture_work = work / "mutant-residual-output"
fixture_work.mkdir(parents=True, exist_ok=True)
manifest, completion, group_file = residual_flood_fixture(fixture_work)
manifest, completion, group_file, started, arm, ready = residual_flood_fixture(fixture_work)
result = run_gate(
manifest,
1,
helper=residual_mutant,
extra_env={
"FLOOD_ARM": str(arm),
"FLOOD_COMPLETION": str(completion),
"GROUP_FILE": str(group_file),
"FLOOD_READY": str(ready),
"FLOOD_STARTED": str(started),
},
)
check(
Expand Down
Loading