Necessist
Runs tests with statements removed to help identify unnecessary statements
Setup
cd necessist
cargo build --workspace
source env.sh
Usage
- Checkout a clean copy of your target repository. This is important!
cd target-repo
necessist_instrument.sh
cargo necessist
By default, necessist outputs to the console. Passing --sqlite
causes necessist to instead output to a sqlite database. A tool like sqlitebrowser can then be used to filter/sort the results.
Output
Result | Meaning (With the statement removed...) | Silenced with |
---|---|---|
passed | The tests built and passed. | n/a |
timed-out | The tests built but timed-out. | See below. |
failed | The tests built but failed. | See below. |
nonbuildable | The tests did not build. | -qq |
skipped | See below. | -q |
inconclusive | An internal error (e.g., rust-lang/rust#75734) prevented necessist from removing the statement. | n/a |
Silencing timed-out and failed results
- Passing
-qqq
silences timed-out and failed results for all statements except local (let) bindings. - Passing
-qqqq
silences timed-out and failed results entirely.
Skipped statements
Necessist will not attempt to remove a statement if any of the following conditions apply.
- The statement is an invocation of a whitelisted macro.
--skip-calls regex
is passed and the statement is a function call, macro invocation, or method call matchingregex
.--skip-controls
is passed and the statement is abreak
orcontinue
.--skip-locals
is passed and the statement is a local (let
) binding.
Whitelisted macros
assert
assert_eq
assert_ne
panic
unimplemented
unreachable
References
- Groce, A., Ahmed, I., Jensen, C., McKenney, P.E., Holmes, J.: How verified (or tested) is my code? Falsification-driven verification and testing. Autom. Softw. Eng. 25, 917โ960 (2018). A preprint is available here. See Section 2.3.