Commit graph

37 commits

Author SHA1 Message Date
Eric Huss 83571aee56 Minor testsuite organization. 2019-11-24 18:42:45 -08:00
Eric Huss bd73e8dab5 Stabilize cache-messages 2019-09-30 14:04:10 -07:00
Alex Crichton 9115b2c326 Extract support directory to its own crate
Extract out all our test support code to its own standalone crate so it
can be shared between multiple test suites if necessary.
2019-09-16 11:47:09 -07:00
Eric Huss a4e9611453 Fix some formatting for some strings. 2019-07-13 16:00:47 -07:00
Jethro Beekman 0e0d968825 Update #[test] attribute on all tests in the testsuite
sed -i 's/^#\[test\]/#[cargo_test]/' $(rg -l '^#\[test\]')

Manual fixes:
* proc_macro::proc_macro_doctest
2019-06-07 12:41:26 -07:00
Eric Huss 6b07c8da63 cargo fmt 2019-05-20 12:40:20 -07:00
Alex Crichton 127fdfeb89 Implement the Cargo half of pipelined compilation
This commit starts to lay the groundwork for #6660 where Cargo will
invoke rustc in a "pipelined" fashion. The goal here is to execute one
command to produce both an `*.rmeta` file as well as an `*.rlib` file
for candidate compilations. In that case if another rlib depends on that
compilation, then it can start as soon as the `*.rmeta` is ready and not
have to wait for the `*.rlib` compilation.

Initially attempted in #6864 with a pretty invasive refactoring this
iteration is much more lightweight and fits much more cleanly into
Cargo's backend. The approach taken here is to update the
`DependencyQueue` structure to carry a piece of data on each dependency
edge. This edge information represents the artifact that one node
requires from another, and then we a node has no outgoing edges it's
ready to build.

A dependency on a metadata file is modeled as just that, a dependency on
just the metadata and not the full build itself. Most of cargo's backend
doesn't really need to know about this edge information so it's
basically just calculated as we insert nodes into the `DependencyQueue`.
Once that's all in place it's just a few pieces here and there to
identify compilations that *can* be pipelined and then they're wired up
to depend on the rmeta file instead of the rlib file.
2019-05-08 08:10:26 -07:00
Alexander Regueiro f7c91ba622
Various cosmetic improvements. 2019-02-20 10:58:27 +00:00
Alex Crichton fecb724643 Format with cargo fmt 2018-12-08 03:19:47 -08:00
Dale Wijnand 04ddd4d0fc
Upgrade to Rust 2018 2018-12-06 20:18:35 +01:00
Eric Huss 739c272f05 Use "test" profile for cargo build benchmarks. 2018-11-12 13:10:54 -08:00
kennytm 4779dbfe85
Update the testsuite to include the explicit '--color' flags. 2018-09-12 11:59:08 +08:00
Zach Lute 89f43938fe Print file paths instead of file:// URLs.
This change ensures cargo will output file paths in the expected format
(C:\foo\... on Windows, /foo/... elsewhere). Previously it would output
file:// URLs instead.

To support this change, additional changes were made to the test suite
string processing such that [ROOT] is now replaced with the appropriate
file path root for the platform.

The CWD template was also updated to use [CWD] like other replacement
templates and to do the replacement on the expected value rather than
the actual value to avoid replacing things we don't expect with CWD.
2018-09-07 19:42:59 -07:00
Matthias Krüger 2cd9cce6e3 clippy: resolve all warnings about useless format!() 2018-09-03 11:38:29 +02:00
Dale Wijnand d5fc8dc3a7
Introduce the CWD macro in test output asserting
Avoids dealing with things like CWD changing.
2018-08-30 11:05:29 +02:00
Dale Wijnand 85984a8700
Migrate from tests fom assert_that/execs to .run() 2018-08-28 15:08:12 +02:00
Dale Wijnand 511d4bc503
Collapse multiline ProcessBuilder::arg calls in tests
.. by calling this a bunch of times:

    fastmod --multiline '\.cargo\("([^"]+)"\).[ ]+\.arg\("([^"]+)"\)' '.cargo("${1} ${2}")' tests/testsuite/
2018-08-18 15:12:54 +01:00
Dale Wijnand af4f1392f7
Collapse ProcessBuilder::arg calls in tests
.. with mutliple calls of:

    fastmod --accept-all '\.cargo\("([^"]+)"\)\.arg\("([^"]+)"\)' '.cargo("${1} ${2}")' tests/testsuite/

until no changes are left.
2018-08-18 15:05:45 +01:00
Matthias Krüger 8798bf0d28 fix a bunch of clippy warnings (invocation: cargo clippy --all-targets --all-features -- --cap-lints warn )
Special thanks to dwijnand for helping me with this! :)
2018-08-12 10:00:12 +02:00
Dale Wijnand 16aeb0cd4f
Default test support's Execs to exit code 0 2018-08-03 07:44:42 +01:00
Dale Wijnand 05400b8018
Drop the [/] test output macro 2018-08-02 10:18:48 +01:00
Dale Wijnand ca7d9ee292
Declare one-line files on one line, in test projects 2018-07-25 09:58:50 +01:00
Dale Wijnand ab19c48358
Dedup a bunch more manifest 2018-07-25 00:43:30 +01:00
Dale Wijnand 081e7930d2
Drop now unnecessary basic manifests 2018-07-24 16:33:55 +01:00
Dale Wijnand 43b42d6f4c
Reorganise the testsuite crate module hierarchy
* Collapse the nested cargotest::support module into the cargotest
  module (merge the mod.rs's)
* Rename the cargotest module to support
* Nest the top-level hamcrest module into support
2018-07-22 08:46:44 +01:00
Dale Wijnand 7fe2fbc8a3
Remove the argument from the project test support function
By rewriting the tests, with rerast (https://github.com/google/rerast),
to use the newly introduced "at" method.

First I added the following temporary function to cargotest::support:

    pub fn project_foo() -> ProjectBuilder {
        project("foo")
    }

Then I defined the following rewrite.rs:

    use cargotest::support::{ project, project_foo };

    fn rule1(a: &'static str) {
        replace!(project("foo") => project_foo());
        replace!(project(a) => project_foo().at(a));
    }

Then I ran rerast:

    cargo +nightly rerast --rules_file=rewrite.rs --force --targets tests --file tests/testsuite/main.rs

Finally I searched and replaced the references to project_foo with
argument-less project (a little awkardly on macOS with a git clean).

    find tests -type f -exec sed -i -e 's/project_foo/project/g' {} +
    git clean -d tests
2018-07-20 13:31:50 +01:00
Eric Huss a187ba8a9c Fix cargo rustc for test with implicit binary.
Fixes #5502
2018-05-08 17:23:28 -07:00
Eric Huss b9181ef3b5 Add some more tests. 2018-04-27 13:42:30 -07:00
bors b0a2252063 Auto merge of #5186 - infinity0:stricter-need-dev-deps, r=alexcrichton
Stricter need_dev_deps behaviour

The previous PR (#5012) contained an unnecessary work-around for behaviour of `--all-targets` that was misunderstood. This PR removes that work-around and adds some tests and comments to clarify the behaviour for future contributors, which may help to make easier a future fix for #5177 and #5178.
2018-03-21 14:19:11 +00:00
Ximin Luo 0bc1155753 Split tests, apparently cargo clean does not work well on windows 2018-03-19 18:20:54 +01:00
Aleksey Kladov e5971b935c Slightly improve ergonomics of writing Cargo tests 2018-03-17 00:08:23 +03:00
Ximin Luo 0bf8e541db Add tests for --all-targets 2018-03-15 17:08:40 +01:00
Alex Crichton 1e6828485e cargo fmt 2018-03-14 17:48:23 -07:00
Aleksey Kladov a64df78ea6 Relax tests for windows
On windows, clap prints `cargo.exe` rather than just `cargo`.
2018-03-10 18:46:32 +03:00
Aleksey Kladov 4d3ca92150 Use exit code 1 for command line parsing errors
Note that while we use 101 in majority of cases, sometimes we use 1 as
well.
2018-03-08 23:31:56 +03:00
Aleksey Kladov 8e8e924e3f Move rustc to clap 2018-03-08 23:30:47 +03:00
André Rocha c2ff988c9f Reorganize integration tests as one crate with many modules. Issue #4867. 2018-02-21 13:33:51 -05:00
Renamed from tests/rustc.rs (Browse further)