forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiBe12d32fTahinli6 days ago3982 commits

gen-fast-profile.sh52 lines, 2.0 KiBHistoryRawDownload
1#!/usr/bin/env bash
2# Print the nextest `default-filter` for the [profile.fast] block in .config/nextest.toml.
3#
4# Source: per-test timing TSVs from the Phase 0 baseline
5# (crate, binary, test, status, exec_time_s). Every row with exec_time_s >= THRESHOLD
6# is excluded. Unit tests (binary "unittests ...") match by exact name; integration
7# tests match by name suffix, because they moved under tests/it/ (binary `it`).
8#
9# Usage: scripts/gen-fast-profile.sh [THRESHOLD] [TSV...]
10# THRESHOLD defaults to 20 (seconds). TSVs default to lanes/testcut/{av1,rest,folded}.tsv; folded.tsv lists Phase 1
11# table tests whose folded members were heavy (estimated seconds).
12set -euo pipefail
13
14root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
15threshold="${1:-20}"
16shift || true
17if [ "$#" -eq 0 ]; then
18 set -- "$root/lanes/testcut/av1.tsv" "$root/lanes/testcut/rest.tsv" "$root/lanes/testcut/folded.tsv"
19fi
20
21awk -F'\t' -v thr="$threshold" '
22 FNR == 1 { next } # header of each TSV
23 $5 + 0 < thr { next }
24 {
25 crate = $1; bin = $2; name = $3
26 if (crate !~ /^ec-[a-z0-9-]+$/ || name !~ /^[A-Za-z0-9_:]+$/) {
27 unmapped++
28 print "unmapped: " crate "\t" name >> "/dev/stderr"
29 next
30 }
31 key = crate SUBSEP name
32 if (key in seen) next
33 seen[key] = 1
34 if (bin ~ /^unittests/) clause = "test(=" name ")"
35 else clause = "test(/(^|::)" name "$/)"
36 if (!(crate in groups)) { order[++n] = crate; groups[crate] = clause }
37 else groups[crate] = groups[crate] " | " clause
38 count[crate]++
39 total++
40 }
41 END {
42 printf "not ("
43 for (i = 1; i <= n; i++) {
44 c = order[i]
45 if (i > 1) printf " |\n "
46 printf "(package(%s) & (%s))", c, groups[c]
47 }
48 printf ")\n"
49 for (i = 1; i <= n; i++) printf "excluded %-12s %d\n", order[i], count[order[i]] > "/dev/stderr"
50 printf "excluded total %d, unmapped %d\n", total, unmapped + 0 > "/dev/stderr"
51 }
52' "$@"