Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upFinalize story for libtest #20603
Conversation
rust-highfive
assigned
nrc
Jan 6, 2015
This comment has been minimized.
This comment has been minimized.
|
r? @nick29581 (rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
rust-highfive
assigned
aturon
and unassigned
nrc
Jan 6, 2015
alexcrichton
force-pushed the
alexcrichton:rustc-bench
branch
from
2f0c0c1
to
2a0f1c1
Jan 6, 2015
This comment has been minimized.
This comment has been minimized.
|
LGTM. @brson are you comfortable with this strategy? |
alexcrichton
force-pushed the
alexcrichton:rustc-bench
branch
from
2a0f1c1
to
15bbe16
Jan 6, 2015
This comment has been minimized.
This comment has been minimized.
|
@aturon I'm not sure yet. |
This comment has been minimized.
This comment has been minimized.
|
I don't know that I'm comfortable stabilizing and standardizing a crate called 'rustc_something'. This is a crate that will need to be implemented and supplied by all Rust implementations. Is the motivation here to save the name |
This comment has been minimized.
This comment has been minimized.
|
My bigger concerns around stability of |
This comment has been minimized.
This comment has been minimized.
|
If we're uncomfortable exposing a good crate name here we could instead inject a 'std test' prelude - this arguably seems better to me anyway since |
alexcrichton
force-pushed the
alexcrichton:rustc-bench
branch
from
15bbe16
to
a800e3e
Jan 7, 2015
This comment has been minimized.
This comment has been minimized.
|
Yeah I was trying to hide the I can think of a few alternatives:
I'd almost personally lean towards option 1... thoughts @brson or @aturon? |
This comment has been minimized.
This comment has been minimized.
|
After some more discussion on IRC, I'm going to withdraw this and continue pursuing a strategy after the alpha release. This means that for the alpha release crates will need to opt-in to the unstable apis provided by the |
alexcrichton commentedJan 6, 2015
One of the last remaining crates to have a stabilization story in the standard
distribution is the libtest library. This library currently provides the backing
infrastructure and test harness used when rustc generates a test execuable via
the
--testcommand line flag.It's well known that libtest is not the end-all-be-all of testing frameworks. It
is intentionally minimal and is currently quite conservative in its scope of
what it tries to accomplish as well as what it implements. A testament to this
is the fact that one very rarely writes
extern crate test, and it almost meansthat the stabilization story need not be considered for the crate at all! The
benchmarking feature of the compiler, however, is quite useful and is one of the
sole reasons for using
extern crate test.When benchmarking, there are a few primary interfaces to the libtest library
that are used:
test::Bencher- the type for a benchmarking harness.test::Bencher::iter- a member function used to run a benchmark.test::black_box- a useful function to hinder optimizations and prevent avalue from being optimized away.
These three pieces of information are the primary targets for the stabilization
in this commit. The rest of the testing infrastructure, while still quite useful
to some projects, is not in scope for stabilization at 1.0 and will remain
#[experimental]for now.The benchmarking pieces have been moved to a new
rustc_benchcrate which willbe part of the standard distribution. In order to write a benchmark one will
need to import the crate via
extern crate rustc_benchand otherwise all usageremains the same. The purpose of this crate is to provide a clear area for these
benchmarking utilities as well as provide a clear name that it is only
intended for use via the compiler
#[bench]attribute. The current interface isquite minimal with only what's necessary as
#[stable].It is most certainly a desire for the compiler to support other testing
frameworks other than the standard libtest. This form of infrastructure (be it a
plugin or a separate interface) is out of scope for 1.0, however, and this
commit does not attempt to resolve it.
Due to the removal of benchmarking items from libtest, this is a breaking
change. To update, rewrite imports of
extern crate testtoextern crate rustc_benchand then rewrite allusestatements as well. The public interfaceof the
Bencherstruct has not changed.[breaking-change]