Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion docs/05-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ exit code; every sample gets scratch files of its own. The first sample of each
so the shared runtime/corelib cache in `~/.cache/csharpc` is filled once, and the samples listed in
`tests/serial-samples.txt` run alone too: those that observe their neighbours (connecting to a port that
was just closed on purpose, wall-clock windows of a few tens of milliseconds, inotify). Add a sample
there if it flakes only when run next to others. `--repeat` and `--via-il` always run one sample at a
there if it flakes only when run next to others. At most one sample of `tests/heavy-samples.txt` compiles at a time (reflection-based
JSON: 3-4 GiB each for wasm32, and three at once cost CI its runner, #590); others run beside it. `--repeat` and `--via-il` always run one sample at a
time. CI uses 3 on every platform (`jobs_for_platform` in `tools/ci-plan.sh`).

`--via-il` runs the same samples against the same recordings through csc first, as the dotnet pipeline
Expand Down
20 changes: 20 additions & 0 deletions tests/heavy-samples.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Samples whose compilation needs gigabytes (reflection-based System.Text.Json): tests/run.sh runs at most one of them at once when
# CSHARPC_JOBS > 1, next to ordinary samples. Measured on linux-x64 for wasm32-wasip1 at -O2 (#590): 325_json_types 4.0 GiB and
# 317_json_deserialize 3.1 GiB, both still growing at 500 s; three at once exhausted a 16 GB CI runner. One name per line, '#' starts a comment.
1160_json_private_nested_types
1250_json_culture_real
1251_json_culture_synthetic
1295_json_reflection_bcl_member_types
1296_json_reflection_dateonly_timeonly
1301_json_reflection_roots
1313_json_reflection_disabled
315_json_node
316_json_serialize
317_json_deserialize
318_json_options
319_json_converters
320_json_polymorphism
321_json_references
323_json_anonymous_and_file_local
325_json_types
740_json_internal_types
13 changes: 11 additions & 2 deletions tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -279,19 +279,24 @@ JOBS="${CSHARPC_JOBS:-1}"
[[ "$JOBS" =~ ^[1-9][0-9]*$ ]] || { echo "bad CSHARPC_JOBS '$JOBS'" >&2; exit 2; }
# --repeat is for flake hunts, where concurrent neighbours would change what is measured; --via-il has its own build pool.
(( REPEAT > 1 || VIA_IL == 1 )) && JOBS=1
SERIAL=" "
SERIAL=" " HEAVY=" "
if (( JOBS > 1 )); then
while IFS= read -r line || [[ -n "$line" ]]; do
line="${line%%#*}"; line="${line//[[:space:]]/}"
[[ -n "$line" ]] && SERIAL+="$line "
done < "$ROOT/tests/serial-samples.txt"
# At most one of these compiles at a time: three at once run a 16 GB runner out of memory (#590).
while IFS= read -r line || [[ -n "$line" ]]; do
line="${line%%#*}"; line="${line//[[:space:]]/}"
[[ -n "$line" ]] && HEAVY+="$line "
done < "$ROOT/tests/heavy-samples.txt"
# The oracle hook (macOS and Windows) is built into a shared directory on first use: build it
# before several samples need it at once.
platform_oracle_hook || exit 1
fi

run_pass() { # opt rep
local opt="$1" rep="$2" name i n=${#selected[@]} next=0 running=0 res
local opt="$1" rep="$2" name i n=${#selected[@]} next=0 running=0 res heavy=
if (( JOBS <= 1 )); then
for name in "${selected[@]}"; do
run_sample "$name" "$opt" "$rep" "$OUT"
Expand All @@ -316,6 +321,10 @@ run_pass() { # opt rep
while (( running > 0 )); do reap; done
else
while (( running >= JOBS )); do reap; done
if [[ "$HEAVY" == *" $name "* ]]; then
while [[ -n "$heavy" && ! -f "$res/$heavy.rc" && -d "$res/w$heavy" ]] && (( running > 0 )); do reap; done
heavy=$i
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heavy gate skips serial samples

Medium Severity

The one-heavy gate sits in the non-serial branch. Every multi-gigabyte JSON sample except 1313_json_reflection_disabled is already in tests/serial-samples.txt, so those compiles still drain the queue and never update heavy. Ordinary samples still do not run beside them.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 9262900. Configure here.

fi
mkdir -p "$res/w$i"
(
Expand Down
Loading