diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2016-04-29 14:23:15 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2016-05-12 08:52:20 -0700 |
| commit | bb9062a2967a5b772788aa14f742d8927ac040ba (patch) | |
| tree | 26600100ee45d6ec7c95f4961954f8b8d4f6bd89 /src/rustc | |
| parent | 8d65591cf249a64bffa14ed49cb196af4eabac3c (diff) | |
| download | rust-bb9062a2967a5b772788aa14f742d8927ac040ba.tar.gz rust-bb9062a2967a5b772788aa14f742d8927ac040ba.zip | |
rustbuild: Add support for crate tests + doctests
This commit adds support to rustbuild to run crate unit tests (those defined by `#[test]`) as well as documentation tests. All tests are powered by `cargo test` under the hood. Each step requires the `libtest` library is built for that corresponding stage. Ideally the `test` crate would be a dev-dependency, but for now it's just easier to ensure that we sequence everything in the right order. Currently no filtering is implemented, so there's not actually a method of testing *only* libstd or *only* libcore, but rather entire swaths of crates are tested all at once. A few points of note here are: * The `coretest` and `collectionstest` crates are just listed as `[[test]]` entires for `cargo test` to naturally pick up. This mean that `cargo test -p core` actually runs all the tests for libcore. * Libraries that aren't tested all mention `test = false` in their `Cargo.toml` * Crates aren't currently allowed to have dev-dependencies due to rust-lang/cargo#860, but we can likely alleviate this restriction once workspaces are implemented. cc #31590
Diffstat (limited to 'src/rustc')
| -rw-r--r-- | src/rustc/Cargo.toml | 2 | ||||
| -rw-r--r-- | src/rustc/libc_shim/Cargo.toml | 1 | ||||
| -rw-r--r-- | src/rustc/std_shim/Cargo.toml | 2 | ||||
| -rw-r--r-- | src/rustc/test_shim/Cargo.toml | 2 |
4 files changed, 7 insertions, 0 deletions
diff --git a/src/rustc/Cargo.toml b/src/rustc/Cargo.toml index 7431c35efba..24499cb8f08 100644 --- a/src/rustc/Cargo.toml +++ b/src/rustc/Cargo.toml @@ -13,6 +13,8 @@ path = "rustdoc.rs" [profile.release] opt-level = 2 +[profile.bench] +opt-level = 2 # These options are controlled from our rustc wrapper script, so turn them off # here and have them controlled elsewhere. diff --git a/src/rustc/libc_shim/Cargo.toml b/src/rustc/libc_shim/Cargo.toml index a7860b50e08..8fc713e0f1b 100644 --- a/src/rustc/libc_shim/Cargo.toml +++ b/src/rustc/libc_shim/Cargo.toml @@ -15,6 +15,7 @@ build = "build.rs" [lib] name = "libc" path = "../../liblibc/src/lib.rs" +test = false [dependencies] core = { path = "../../libcore" } diff --git a/src/rustc/std_shim/Cargo.toml b/src/rustc/std_shim/Cargo.toml index 1ce3937157d..5602ef866b8 100644 --- a/src/rustc/std_shim/Cargo.toml +++ b/src/rustc/std_shim/Cargo.toml @@ -30,6 +30,8 @@ path = "lib.rs" [profile.release] opt-level = 2 +[profile.bench] +opt-level = 2 # These options are controlled from our rustc wrapper script, so turn them off # here and have them controlled elsewhere. diff --git a/src/rustc/test_shim/Cargo.toml b/src/rustc/test_shim/Cargo.toml index bf576650486..87f2ccd51e8 100644 --- a/src/rustc/test_shim/Cargo.toml +++ b/src/rustc/test_shim/Cargo.toml @@ -14,6 +14,8 @@ path = "lib.rs" [profile.release] opt-level = 2 +[profile.bench] +opt-level = 2 # These options are controlled from our rustc wrapper script, so turn them off # here and have them controlled elsewhere. |
