Skip to content

Latest commit

 

History

History
41 lines (30 loc) · 2.22 KB

README.md

File metadata and controls

41 lines (30 loc) · 2.22 KB

This repository serves to run the libcore, liballoc, and libstd test suites in Miri. This includes unit tests, integration tests, and doc tests, but not rustc ui tests.

Every night, a CI cron job runs the tests against the latest nightly, to make sure we notice when changes in Rust or Miri break a test. (Some libstd tests are excluded since they rely on platform-specific APIs that Miri does not implement.)

Running the tests yourself

To run the tests yourself, make sure you have Miri installed (rustup component add miri) and then run:

./run-test.sh core --lib --tests
./run-test.sh alloc --lib --tests
MIRIFLAGS="-Zmiri-disable-isolation" ./run-test.sh std --lib --tests -- time::

This will run the test suite of the standard library of your current toolchain. --lib --tests means that doc tests are skipped; those should use separate Miri flags as there are some (expected) memory leaks. Use --doc to run only doc tests. For std, we cannot run all tests since they will use networking and file system APIs that we do not support.

If you are working on the standard library and want to check that the tests pass with your modifications, set MIRI_LIB_SRC to the library folder of the checkout you are working in:

MIRI_LIB_SRC=~/path/to/rustc/library ./run-test.sh core --lib --tests

Here, ~/path/to/rustc should be the directory containing x.py. Then the test suite will be compiled from the standard library in that directory. Make sure that is as close to your rustup default toolchain as possible, as the toolchain will still be used to build that standard library and its test suite. If you are getting strange build errors, cargo clean can often fix that.

run-test also accepts parameters that are passed to cargo test and the test runner, and MIRIFLAGS can be used as usual to pass parameters to Miri:

MIRIFLAGS="-Zmiri-ignore-leaks -Zmiri-disable-isolation" ./run-test.sh alloc --doc -- --skip vec

If you want to know how long each test took to execute, add 2>&1 | ts -m -i '%.s ' to the end of the command, or use the test flags -Zunstable-options --report-time (the latter option also requires -Zmiri-disable-isolation in the Miri flags).