Skip to content
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

rustbuild: Add support for crate tests + doctests #33282

Merged
merged 2 commits into from May 13, 2016

Conversation

Projects
None yet
5 participants
@alexcrichton
Copy link
Member

alexcrichton commented Apr 29, 2016

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

@alexcrichton

This comment has been minimized.

Copy link
Member Author

alexcrichton commented Apr 29, 2016

r? @brson

@rust-highfive rust-highfive assigned aturon and brson and unassigned aturon Apr 29, 2016

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Apr 29, 2016

r? @aturon

(rust_highfive has picked a reviewer for you, use r? to override)

cargo.args(&build.flags.args);

build.run(&mut cargo);
}

This comment has been minimized.

@brson

brson Apr 29, 2016

Contributor

This is fairly ugly function. Why search the dag like this and run cargo with a bunch of -p flags instead of calling cargo test on every individual crate?

This comment has been minimized.

@alexcrichton

alexcrichton Apr 29, 2016

Author Member

Running cargo test with a bunch of -p flags gives us the ability to compile all the crate tests in parallel (but run them sequentially). Ideally this'd just be cargo test --all, but unfortunately that's not implemented yet :(

Running cargo test on each individual crate would work, but we'd still have to discover the list of crates somewhere and we unfortunately wouldn't get the same parallelism :(

@brson

This comment has been minimized.

Copy link
Contributor

brson commented Apr 29, 2016

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Apr 29, 2016

📌 Commit 58902f5 has been approved by brson

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Apr 29, 2016

⌛️ Testing commit 58902f5 with merge b0e3f7a...

bors added a commit that referenced this pull request Apr 29, 2016

Auto merge of #33282 - alexcrichton:rustbuild-crate-tests, r=brson
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
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Apr 29, 2016

💔 Test failed - auto-win-msvc-64-cargotest

@alexcrichton alexcrichton force-pushed the alexcrichton:rustbuild-crate-tests branch from 58902f5 to 4c42905 Apr 29, 2016

@alexcrichton

This comment has been minimized.

Copy link
Member Author

alexcrichton commented Apr 29, 2016

@bors: r=brson 4c42905

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Apr 30, 2016

⌛️ Testing commit 4c42905 with merge 4f41647...

bors added a commit that referenced this pull request Apr 30, 2016

Auto merge of #33282 - alexcrichton:rustbuild-crate-tests, r=brson
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
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Apr 30, 2016

💔 Test failed - auto-win-gnu-32-opt-rustbuild

@alexcrichton alexcrichton force-pushed the alexcrichton:rustbuild-crate-tests branch from 4c42905 to 7606bfd Apr 30, 2016

@alexcrichton

This comment has been minimized.

Copy link
Member Author

alexcrichton commented Apr 30, 2016

@bors: r=brson 7606bfd

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Apr 30, 2016

⌛️ Testing commit 7606bfd with merge 58a22a2...

bors added a commit that referenced this pull request Apr 30, 2016

Auto merge of #33282 - alexcrichton:rustbuild-crate-tests, r=brson
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
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Apr 30, 2016

💔 Test failed - auto-win-gnu-32-opt-rustbuild

@alexcrichton alexcrichton force-pushed the alexcrichton:rustbuild-crate-tests branch from 7606bfd to f5a73cb May 2, 2016

@alexcrichton

This comment has been minimized.

Copy link
Member Author

alexcrichton commented May 2, 2016

@bors: r=brson f5a73cb

Chalking up another segfault to opt-level=3 ...

@bors

This comment has been minimized.

Copy link
Contributor

bors commented May 3, 2016

⌛️ Testing commit f5a73cb with merge de696cd...

bors added a commit that referenced this pull request May 3, 2016

Auto merge of #33282 - alexcrichton:rustbuild-crate-tests, r=brson
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
@bors

This comment has been minimized.

Copy link
Contributor

bors commented May 3, 2016

💔 Test failed - auto-win-gnu-32-opt-rustbuild

rustbuild: Tighten dependencies of build scripts
Ensure that `rerun-if-changed` is printed for all build scripts to ensure that
they've all got the right list of dependencies.

@alexcrichton alexcrichton force-pushed the alexcrichton:rustbuild-crate-tests branch from f5a73cb to afbcf90 May 11, 2016

@alexcrichton alexcrichton force-pushed the alexcrichton:rustbuild-crate-tests branch 2 times, most recently from 882e878 to d11e3c1 May 11, 2016

@alexcrichton

This comment has been minimized.

Copy link
Member Author

alexcrichton commented May 11, 2016

@bors: r=brson d11e3c1

@bors

This comment has been minimized.

Copy link
Contributor

bors commented May 12, 2016

⌛️ Testing commit d11e3c1 with merge 4d9c301...

bors added a commit that referenced this pull request May 12, 2016

Auto merge of #33282 - alexcrichton:rustbuild-crate-tests, r=brson
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
@bors

This comment has been minimized.

Copy link
Contributor

bors commented May 12, 2016

💔 Test failed - auto-win-msvc-64-opt-rustbuild

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

@alexcrichton alexcrichton force-pushed the alexcrichton:rustbuild-crate-tests branch from d11e3c1 to bb9062a May 12, 2016

@alexcrichton

This comment has been minimized.

Copy link
Member Author

alexcrichton commented May 12, 2016

@bors: r=brson bb9062a

@bors

This comment has been minimized.

Copy link
Contributor

bors commented May 12, 2016

⌛️ Testing commit bb9062a with merge 584f1b5...

bors added a commit that referenced this pull request May 12, 2016

Auto merge of #33282 - alexcrichton:rustbuild-crate-tests, r=brson
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

eddyb added a commit to eddyb/rust that referenced this pull request May 12, 2016

Rollup merge of rust-lang#33282 - alexcrichton:rustbuild-crate-tests,…
… r=brson

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 rust-lang#31590
@bors

This comment has been minimized.

Copy link
Contributor

bors commented May 12, 2016

⛄️ The build was interrupted to prioritize another pull request.

@bors

This comment has been minimized.

Copy link
Contributor

bors commented May 12, 2016

⌛️ Testing commit bb9062a with merge 7c8476a...

bors added a commit that referenced this pull request May 12, 2016

Auto merge of #33282 - alexcrichton:rustbuild-crate-tests, r=brson
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

eddyb added a commit to eddyb/rust that referenced this pull request May 12, 2016

Rollup merge of rust-lang#33282 - alexcrichton:rustbuild-crate-tests,…
… r=brson

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 rust-lang#31590

@eddyb eddyb referenced this pull request May 12, 2016

Closed

Rollup of 21 pull requests #33595

@bors

This comment has been minimized.

Copy link
Contributor

bors commented May 12, 2016

⛄️ The build was interrupted to prioritize another pull request.

bors added a commit that referenced this pull request May 12, 2016

eddyb added a commit to eddyb/rust that referenced this pull request May 12, 2016

Rollup merge of rust-lang#33282 - alexcrichton:rustbuild-crate-tests,…
… r=brson

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 rust-lang#31590

@eddyb eddyb referenced this pull request May 12, 2016

Closed

Rollup of 23 pull requests #33597

bors added a commit that referenced this pull request May 12, 2016

bors added a commit that referenced this pull request May 12, 2016

Auto merge of #33282 - alexcrichton:rustbuild-crate-tests, r=brson
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
@bors

This comment has been minimized.

Copy link
Contributor

bors commented May 12, 2016

⌛️ Testing commit bb9062a with merge 4ec5ce5...

@bors bors merged commit bb9062a into rust-lang:master May 13, 2016

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details

@alexcrichton alexcrichton deleted the alexcrichton:rustbuild-crate-tests branch May 25, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.