-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify the rustpkg testing story #9003
Comments
See https://github.com/mozilla/rust/wiki/Meeting-weekly-2013-10-08 for what we decided |
OK, preferring to use one crate root ( Can we, likewise, stop building a separate binary for benchmarks, and can we provide a command which can be used to exercise them? That is, unless I'm missing something, there seems to be no |
I'm going to try and work on this the next day or few. |
(I'll probably pester you in IRC, @catamorphism) |
So just to clarify: rustpkg will support two methods of testing: in-crate and separate-crate. In-crate is what is usually used now, passing Is the test crate compiled with |
And rustpkg will test both. |
@killerswan Yes, that would be the right thing to do. @cmr Yes, you're right that it will support those two methods of testing. And yes, the test crate will need to be compiled with |
No, I guess it's not a no-op. I see your point now. That's an interesting question. My gut feeling is for now, we'll just support using Rust's built-in test runner. If somebody wants to do anything more complicated, they'll have to run their test executable manually (not with |
@catamorphism will benchmarking be the same, but with a |
rustpkg doesn't exist anymore, closing |
On IRC, @bjz and @Kimundi pointed out some infelicities with how rustpkg handles the test crate.
kimundi writes: "I think there are 3 ways to have the test suite of a rustpkg package work: in-crate by compiling the crate with rustc --test, out-of-crate by having a test.rs file that 'extern mod's the crate, and hybrid where you have a test.rs file that contains all modules of your crate with 'mod ...;' statements, effectively providing an alternate test crate-root."
Currently, rustpkg is designed to give preference to the last option: having a
test.rs
file that is an alternative crate root for building a test executable.So one question is whether to support all 3 ways with equally good ergonomics in rustpkg. The other question is whether to choose one way that we prefer, and document that that is the preferred method.
kimundi pointing out that the pros and cons of each approach are:
"in-crate: pro: quick and easy, can test private things. cons: clutters the code, change to tests mean recompile the library itself
out-of-crate: pro: can test the public api extensivly, no cluttering the crate code itself, changes to testsuite do not cause the crate to need recompiling. cons: can't test private items, need to do more work to test the public api
hybrid: pro: can test private api, separate test crate from regular crate, can test public api separately without needing to recompile crate. cons: needs to compile the same amount of code as the crate, needs to duplicate crate root."
The text was updated successfully, but these errors were encountered: