--- name: split-scripted-test description: Split a long scripted test (unittest/scripts/auto/*/scripts/*_norecord.py) into N parallel chunk groups for run_unit_tests.py, or rebalance the groups of a test that is already split, so every group takes about the same time. Use when asked to split, shard, parallelize, balance or rebalance a scripted test, change its number of groups, or find out why one group of a split test is slower than the others. --- # Splitting and balancing a scripted test `scripts/run_unit_tests.py` (the `rut` task) runs a test listed in `_SPLIT_TEST_GROUPS` as N tasks with `GROUP_ID` = 1..N. A chunk whose header ends in `(G)` runs only in group G; a chunk with no suffix runs in every group. The goal is N groups, in file order (group 1 first … group N last), that finish at the same time. Every group must still pass on its own. The mechanics are in `scripts/balance_chunk_groups.py`, and its docstring is the reference for them. This skill covers the procedure and the judgement calls that the script can't make. ## Tools - **Timing collection is automatic.** `shell_script_tester.cc` records every executed chunk to `$CHUNK_TIMINGS_FILE`. `run_unit_tests.py` sets that variable for every task and merges the results of **passing** tasks into `test-chunk-times.txt`, next to the `-t` file (`unittest/`). Chunks that run in every group are averaged. - **`balance_chunk_groups.py