Skip to content

Latest commit

 

History

History
69 lines (48 loc) · 2.25 KB

File metadata and controls

69 lines (48 loc) · 2.25 KB

Testing

Test Runner (nextest)

The default test runner works fine, but it is notably slower and less featureful than nextest.

Fortunately, nextest ships with the nix-shell, so assuming you have already followed the instructions in the README.md, you should be able to run

cargo nextest run

even if you have not installed nextest on your system.

[!WARNING] nextest profiles are not the same thing as cargo profiles. If you want to select a cargo profile when running nextest, use, for example

cargo nextest run --cargo-profile=release

Code Coverage (llvm-cov)

The nix-shell also ships with cargo llvm-cov for collecting code coverage information. Assuming you have followed the README.md, you should be able to run

just coverage

to get code coverage information.

Code coverage reports from CI are uploaded to our codecov page.

If you wish to study coverage data locally, you can run

just coverage
cd ./target/nextest/coverage/html
python3 -m http.server

And then open a web-browser to http://localhost:8000 to view coverage data.

Fuzz testing (bolero)

The dataplane project makes fairly extensive use of fuzz testing. We use the bolero crate for our fuzz tests.

Running the test suite via cargo test or cargo nextest run will run the fuzz tests.

  • The tests (even the fuzz tests) are only run briefly.
  • Coverage information and sanitizers are not enabled.
  • A full fuzzing engine is not set up, so evolutionary feedback is not provided when the tests are run this way.

Note

A just fuzz recipe for running full fuzz tests with libfuzzer or afl is planned for a future PR.