1 #!/bin/bash
2 # The release gate: about ten minutes, not two and a half hours.
3 #
4 # tests/unitrun.sh --phases 0a,0b,2 is the regression sweep: 170 units, every
5 # fixture in the tree, ~2.5 h. That depth is for hunting a regression whose
6 # location is unknown. Once the compiler is expected to work, the question
7 # changes to "does this compiler still build usable code", which is a much
8 # smaller question with a much cheaper answer:
9 #
10 # 1. the bootstrap reproduces itself (phase 2) the compiler's own test
11 # 2. a fixture set that touches every runtime edge ~13 units, ~5 min
12 # the copy rule, the codec/relocation path, the
13 # crypto primitives and their encodings, the
14 # compress and image paths, name parsing, headers
15 # 3. the tree is clean afterwards every unitrun run checks it
16 #
17 # The selection is deliberately one fixture per subsystem, chosen because a
18 # whole subsystem dies at once when the runtime regresses - which is exactly
19 # what the last four rounds kept finding. More than one fixture per subsystem
20 # buys coverage of that subsystem's own edge cases, and the full sweep is still
21 # there for that.
22 #
23 # tests/quickcheck.sh bootstrap + fixtures (~10 min)
24 # tests/quickcheck.sh --fast fixtures only (~5 min)
25 # tests/quickcheck.sh --fixtures skip the fixtures, bootstrap only
26 set -uo pipefail
27 28 SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
29 30 FIXTURES=(
31 hash_basic # sha2/sha3/md5/sha1 + hmac, over the byteorder reads
32 poly1305_aead # ChaCha20-Poly1305, RFC 8439 vectors, binary PutUint*
33 mlkem_vectors # FIPS 203 keygen/encaps/decaps, bigmod limbs
34 asn1_builder_der # DER encoding at offsets
35 asn1_oid_der # OID parsing, string/int conversions
36 jpeg_progressive_cmyk # fdct/idct, the scan destination, the Huffman tables
37 dns_name_roundtrip # dnsmessage header patch, net name compression
38 slice_copy_rule # the copy rule itself: ten assertions about sub-slices
39 rand_fill # crypto/rand and the DRBG fill what they are given
40 mime_header_api # textproto canonicalisation and header folding
41 gosym_pclntab # the codec/relocation path over tables
42 bytes_replacer # the trie builder, generic push/resize
43 bessel_large_x # math/big float formatting through ftoa
44 tls_handshake # the whole record layer: two domains, a real handshake
45 )
46 47 DO_FIXTURES=1
48 DO_SELFHOST=1
49 for arg in "$@"; do
50 case "$arg" in
51 --fast) DO_SELFHOST=0 ;;
52 --fixtures) DO_SELFHOST=0 ;;
53 --bootstrap) DO_FIXTURES=0 ;;
54 -h | --help)
55 sed -n '2,30p' "$0" | sed 's/^# \{0,1\}//'
56 exit 0
57 ;;
58 *)
59 echo "unknown argument: $arg" >&2
60 exit 2
61 ;;
62 esac
63 done
64 65 JOINED="$(IFS=,; echo "${FIXTURES[*]}")"
66 rc=0
67 68 if [ "$DO_SELFHOST" = 1 ]; then
69 echo "=== quickcheck: bootstrap ==="
70 bash "$SCRIPT_DIR/unitrun.sh" -j 1 --phases 2 --force || rc=1
71 fi
72 73 if [ "$DO_FIXTURES" = 1 ]; then
74 echo ""
75 echo "=== quickcheck: fixtures ==="
76 bash "$SCRIPT_DIR/unitrun.sh" -j 4 --phases 0a --units "$JOINED" --force || rc=1
77 fi
78 79 echo ""
80 if [ "$rc" = 0 ]; then
81 echo "quickcheck: OK"
82 else
83 echo "quickcheck: FAILED - run tests/unitrun.sh --phases 0a,0b,2 --force for the full sweep"
84 fi
85 exit "$rc"
86