Commit 0d1b0c0
committed
test: self-verifying ASSERT_FILTER mode for ItemFilter
The integration test now validates at the data-structure level instead
of grepping rendered output. When ASSERT_FILTER=1 is set alongside
SKIP_LANG_START=1, apply_all() asserts two things:
1. The filter's exclusion set is non-empty (precondition: lang_start
items were present to begin with).
2. No matching items survive in the filtered output (postcondition:
the filter actually worked).
The precondition check is pedantically complete: std::rt::lang_start is
the runtime wrapper rustc generates for every crate with a fn main, so
it will always appear in monomorphized output. Every one of the 29 test
programs has a main function and every expected output contains exactly
11 lang_start references. It would take a fundamental change to rustc's
runtime initialization for this to stop being true; but if it does, the
assertion will tell us the test data is stale rather than silently
passing.
The more realistic failure mode: someone adds a library crate (no main)
to the test suite. The assert message spells this out and gives two
actionable options (skip lib crates in the test target, or gate the
filter on the presence of main).1 parent 474f0b7 commit 0d1b0c0
2 files changed
Lines changed: 46 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | 59 | | |
63 | 60 | | |
64 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
61 | 66 | | |
62 | 67 | | |
63 | 68 | | |
64 | 69 | | |
65 | 70 | | |
| 71 | + | |
66 | 72 | | |
67 | 73 | | |
68 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
69 | 95 | | |
70 | 96 | | |
71 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
72 | 116 | | |
73 | 117 | | |
74 | 118 | | |
| |||
0 commit comments