I'd like to make some changes to my copy of the rust standard library, then run the tests in the source files I changed. I do not need to test the compiler itself. How can I do this without testing a lot of things I am not changing and do not care about?
Here are some things I've already tried. A note - the specific file I want to play around with is libstd/io/net/pipes.rs
in rust 0.12.0.
- I tried
rustc --test pipes.rs
- the imports and options are not set up properly, it seems, and a multitude of errors is the result. - Following the rust test suite documentation, I tried
make check-stage1-std NO_REBUILD=1
, but this failed with "can't find crate for `green`". A person on the #rust-internals irc channel informed me that "make check-stage1 breaks semi-often as it's not the 'official way' to run tests." - Another person on that channel suggested
make check-stage0-std
, which seems to check libstd, but doesn't restrict testing to the file I changed, even if I use theTESTNAME
flag as specified in the rust test suite documentation.
make check-stage1-std NO_REBUILD=1
or... check-stage2-std ...
should work, if you've done a full build previously. They just build the test runner directly without doing the rest of the bootstrap.In any case, the full
std
test runner is built always, since, as you noticed, the imports etc are set up for the full crate.TESTNAME
is the correct way to restrict which tests are run, but there's no way to restrict tests are built.Another option is to pull the test/relevant code into an external file, and yet another is to build the test runner by running
rustc
manually onlibstd/lib.rs
:rustc --test lib.rs
. One could edit the rest of the crate to remove the tests/code you're not interested in.