mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-26 06:34:20 +08:00
Keep swap under the test memory cap and continue past OOM kills
This commit is contained in:
@@ -216,14 +216,17 @@ jobs:
|
||||
# Start the corpus immediately beside a serial side queue. One shared
|
||||
# worker budget covers both processes; file and case shard axes stay
|
||||
# separate so every fixture still runs exactly once in each lane.
|
||||
# The tests run in a transient scope capped below the runner's 16 GB:
|
||||
# past 13 GB the kernel kills the scope's largest process, so the job
|
||||
# log names the test instead of the runner itself running out of memory.
|
||||
# The tests run in a transient scope capped below the runner's 16 GB, so
|
||||
# the runner itself keeps memory: past 14 GB of RAM the scope swaps, as
|
||||
# the whole runner did before (a sanitized shard peaks near 16 GB), and
|
||||
# when RAM and swap run out the kernel kills the scope's largest process.
|
||||
# OOMPolicy=continue leaves the rest of the scope running, so vitest
|
||||
# reports the killed worker and the job log names the test.
|
||||
- name: Tests (corpus and integration suites)
|
||||
run: |
|
||||
ulimit -c 0
|
||||
if [ -d /run/systemd/system ]; then
|
||||
exec sudo --preserve-env systemd-run --scope --quiet -p MemoryMax=13G -p MemorySwapMax=0 \
|
||||
exec sudo --preserve-env systemd-run --scope --quiet -p MemoryMax=14G -p OOMPolicy=continue \
|
||||
--uid="$(id -u)" --gid="$(id -g)" -- env PATH="$PATH" HOME="$HOME" node scripts/ci-test.mjs
|
||||
fi
|
||||
node scripts/ci-test.mjs
|
||||
|
||||
@@ -298,7 +298,7 @@ test("pull requests run the full suite on Linux and the darwin suite on macOS",
|
||||
// runner, and directly elsewhere.
|
||||
const linuxRun = linux.steps.at(-1)!.run as string;
|
||||
expect(linuxRun.startsWith("ulimit -c 0\n")).toBe(true);
|
||||
expect(linuxRun).toContain("systemd-run --scope --quiet -p MemoryMax=13G -p MemorySwapMax=0");
|
||||
expect(linuxRun).toContain("systemd-run --scope --quiet -p MemoryMax=14G -p OOMPolicy=continue");
|
||||
expect(linuxRun).toMatch(/-- env PATH="\$PATH" HOME="\$HOME" node scripts\/ci-test\.mjs\n/);
|
||||
expect(linuxRun.endsWith("fi\nnode scripts/ci-test.mjs\n")).toBe(true);
|
||||
expect(macos.steps.at(-1)!.run).toBe("node scripts/ci-test.mjs");
|
||||
|
||||
Reference in New Issue
Block a user