| 9120e874 Andy McCall | 1 | // Shared test harness: assertion counting and the exit-code convention. |
| 2 | // |
|
| 3 | // The six existing tests each carry their own copy of this. New tests share |
|
| 4 | // one so that a test file is assertions and nothing else -- with many scenario |
|
| 5 | // files planned, a private harness in each would be a great deal of duplicated |
|
| 6 | // bookkeeping. (Converting the existing six is a separate tidy-up; this does |
|
| 7 | // not touch them.) |
|
| 8 | // |
|
| 9 | // The counters have external linkage and live in harness.c rather than being |
|
| 10 | // static in this header. A header-static counter gives every translation unit |
|
| 11 | // its own copy, so the moment a test spans two files -- a shared assertion |
|
| 12 | // helper under tests/support, say -- failures raised in one file would not be |
|
| 13 | // counted by the summary in the other, and the suite would report success |
|
| 14 | // while printing FAIL lines nobody reads on a green run. |
|
| 15 | // |
|
| 16 | // check_eq() exists because "FAIL: ADC sets carry" is not enough to debug a |
|
| 17 | // conformance failure. Knowing it produced 0x81 where the datasheet says 0x80 |
|
| 18 | // is the whole point, so the value-comparing form is the one to reach for. |
|
| 19 | |
|
| 20 | |
|
| 21 | |
|
| 22 | ||
| 23 | |
|
| 24 | |
|
| 25 | |
|
| 26 | extern int x16_failures; |
|
| 27 | extern int x16_checks; |
|
| 28 | extern int x16_divergences; |
|
| 29 | ||
| 30 | void ; |
|
| 31 | ||
| 32 | // Compare two values, reporting both when they differ. |
|
| 33 | void ; |
|
| 34 | ||
| 35 | // For a difference from the hardware that is known, understood and not being |
|
| 36 | // fixed yet. Prints loudly and is counted, but does not fail the build, so |
|
| 37 | // coverage can land before the fix does. |
|
| 38 | // |
|
| 39 | // If it unexpectedly passes, that IS a failure: the marker is now a lie, and |
|
| 40 | // the whole point is that this list only ever shrinks. Delete the marker and |
|
| 41 | // make it an ordinary check. |
|
| 42 | void ; |
|
| 43 | ||
| 44 | // Print the tally and return the process exit status. Never returns the raw |
|
| 45 | // failure count: exit status is masked to 8 bits, so exactly 256 failures |
|
| 46 | // would report success. |
|
| 47 | int ; |
|
| 48 | ||
| 49 | // X16_TEST_HARNESS_H |