Skip to content
Open
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
63 changes: 63 additions & 0 deletions .github/workflows/loop-tools-gate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# A loop tool that exists only in one working directory is not in the project.
#
# scripts/tri_loop/cost.py and diffbin.py were written, used to produce numbers
# that were quoted in a pull request, and lost -- never committed, and the working
# copy was later re-cloned. Every figure they had produced became unreproducible
# at once. Six recovery routes came back empty (#2158).
#
# Nothing in CI could tell the difference between a tool that exists and a tool
# that exists nowhere but one untracked directory. This gate is that difference.
# It is deliberately cheap: no build, no compiler, no corpus run, so there is no
# reason for it to be skipped or made optional.
name: loop-tools-gate

on:
pull_request:
paths:
- "scripts/tri"
- "scripts/tri_loop/**"
- "scripts/ci/loop-tools-tracked.sh"
- ".github/workflows/loop-tools-gate.yml"
push:
branches: [master]
paths:
- "scripts/tri"
- "scripts/tri_loop/**"
- "scripts/ci/loop-tools-tracked.sh"

permissions:
contents: read

jobs:
loop-tools-tracked:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# The check reads git index state, so it needs real history rather than
# a detached blob export.
fetch-depth: 1

- name: Every loop tool is present, tracked, and routed
run: bash scripts/ci/loop-tools-tracked.sh

- name: Each loop helper is syntactically loadable
# A tracked tool that cannot be imported is tracked and useless. This is
# a syntax check only and asserts nothing about behaviour.
run: |
for f in scripts/tri_loop/*.py; do
python3 -c "import py_compile,sys; py_compile.compile('$f', doraise=True)" \
&& echo "ok $f" \
|| { echo "BROKEN $f"; exit 1; }
done

- name: The dispatcher runs its helpers without a built compiler
# tri triage and tri damage read the tracker and the spec text and have no
# use for t27c. The dispatcher used to look for the binary first and
# refuse to run them on a machine with no build, so this step exists to
# keep that ordering from coming back. There is no compiler in this job,
# which is the whole point.
run: |
./scripts/tri loop-help
./scripts/tri damage specs >/dev/null || true
echo "ok helpers dispatch with no t27c present"
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_01.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_01

// shape: [[]X",
// 52 line(s) in the corpus share this shape
// first seen: specs/tri/pipeline/builder.t27:14
// signals: doubled-bracket,odd-quote
pub struct Damaged {
items : [[]T",
}
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_02.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_02

// shape: [[]X X",
// 37 line(s) in the corpus share this shape
// first seen: specs/tri/pipeline/spec_writer.t27:14
// signals: doubled-bracket,odd-quote
pub struct Damaged {
field_type : [[]Const u8",
}
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_03.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_03

// shape: [[]X [,
// 10 line(s) in the corpus share this shape
// first seen: specs/tri/pipeline/spec_writer.t27:23
// signals: doubled-bracket
pub struct Damaged {
steps : [[]Const [,
}
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_04.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_04

// shape: [[][,
// 7 line(s) in the corpus share this shape
// first seen: specs/tri/encoding/mime.t27:15
// signals: doubled-bracket
pub struct Damaged {
to : [[][,
}
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_05.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_05

// shape: [[9]X",
// 5 line(s) in the corpus share this shape
// first seen: specs/tri/crypto/hmac.t27:14
// signals: odd-quote
pub struct Damaged {
opad : [[64]U8",
}
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_06.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_06

// shape: [?[]X X",
// 3 line(s) in the corpus share this shape
// first seen: specs/tri/pipeline/spec_writer.t27:36
// signals: doubled-bracket,odd-quote
pub struct Damaged {
error_msg : [?[]Const u8",
}
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_07.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_07

// shape: [X.X([]X X)",
// 2 line(s) in the corpus share this shape
// first seen: specs/tri/encoding/html.t27:15
// signals: odd-quote
pub struct Damaged {
attributes : [std.StringHashMap([]Const u8)",
}
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_08.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_08

// shape: [[9]?X",
// 2 line(s) in the corpus share this shape
// first seen: specs/tri/trees/octree.t27:24
// signals: odd-quote
pub struct Damaged {
children : [[8]?OctNode",
}
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_09.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_09

// shape: [[]?X",
// 1 line(s) in the corpus share this shape
// first seen: specs/tri/graph/dijkstra.t27:15
// signals: doubled-bracket,odd-quote
pub struct Damaged {
parent : [[]?Usize",
}
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_10.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_10

// shape: [X.X(X, []X)",
// 1 line(s) in the corpus share this shape
// first seen: specs/tri/graph/graph.t27:14
// signals: odd-quote
pub struct Damaged {
nodes : [std.HashMap(T, []T)",
}
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_11.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_11

// shape: [[]?*X",
// 1 line(s) in the corpus share this shape
// first seen: specs/tri/trees/b_tree.t27:15
// signals: doubled-bracket,odd-quote
pub struct Damaged {
children : [[]?*BTreeNode",
}
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_12.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_12

// shape: [[][9,
// 1 line(s) in the corpus share this shape
// first seen: specs/tri/trees/quadtree.t27:23
// signals: doubled-bracket
pub struct Damaged {
points : [[][2,
}
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_13.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_13

// shape: [[9]?*X",
// 1 line(s) in the corpus share this shape
// first seen: specs/tri/search/aho_corasick.t27:14
// signals: odd-quote
pub struct Damaged {
children : [[256]?*ACTrieNode",
}
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_14.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_14

// shape: [[]X(X, X)",
// 1 line(s) in the corpus share this shape
// first seen: specs/tri/collections/btree.t27:21
// signals: doubled-bracket,odd-quote
pub struct Damaged {
children : [[]BTreeNode(K, V)",
}
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_15.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_15

// shape: [[]?X(X)",
// 1 line(s) in the corpus share this shape
// first seen: specs/tri/collections/skip_list.t27:15
// signals: doubled-bracket,odd-quote
pub struct Damaged {
forward : [[]?SkipNode(T)",
}
8 changes: 8 additions & 0 deletions bootstrap/tests/fixtures/terminator/eof_generic.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module eof_generic

// End of file inside an unclosed generic argument list. The lexer returns Eof
// for every subsequent call, so a recovery scanner that refuses to accept Eof as
// a terminator has a stationary state on an infinite input, and the loop is a
// consequence of the construction rather than a rare race.
pub struct Hangs {
a : Map<K, Vec<V
4 changes: 4 additions & 0 deletions bootstrap/tests/fixtures/terminator/eof_hazard.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module eof_hazard

pub struct AtEof {
a : Map<K, V
7 changes: 7 additions & 0 deletions bootstrap/tests/fixtures/terminator/field_swallow.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module field_swallow

pub struct Trunc {
a : Map<K,
b : u8,
c : u16
}
14 changes: 14 additions & 0 deletions bootstrap/tests/fixtures/terminator/nested_types.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module nested_types

pub struct Holder {
plain : u8,
generic : Map<Key, Value>,
tuple : (A, B),
nested : Vec<Vec<u8>>,
arr : [4]u16,
last : i32
}

pub fn use_holder(h : Holder) -> u8 {
return h.plain;
}
6 changes: 6 additions & 0 deletions bootstrap/tests/fixtures/terminator/semicolon_phantom.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module semicolon_phantom

pub struct Semi {
a : Map<K, V;
b : u8
}
12 changes: 12 additions & 0 deletions bootstrap/tests/fixtures/terminator/tuple_type.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module tuple_type

// A well-formed tuple type in a struct field. The comma inside the parentheses
// is a type-argument separator, not a field terminator, and this fixture exists
// so that a recovery change which mistakes one for the other is caught on input
// that is not malformed at all.
pub struct Pairs {
single : (A, B),
nested : (A, (B, C)),
with_generic : (Map<K, V>, u8),
last : u16
}
8 changes: 8 additions & 0 deletions bootstrap/tests/fixtures/terminator/unbalanced.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module unbalanced

pub struct Broken {
a : Map<K,
b : u8
}

pub fn f() -> u8 { return 0; }
Loading
Loading