51 Commits

Author SHA1 Message Date
Dan Aloni
f0896975be Merge remote-tracking branch 'origin/master' into custom-profile-pr-rfc 2019-09-08 21:43:41 +03:00
k-nasa
7176df01d6 Change --all to --workspace 2019-09-03 17:14:34 -07:00
Eric Huss
b41c209af3 Bump toml 0.5.3 2019-08-13 14:56:22 -07:00
Dan Aloni
27da33c67d Merge remote-tracking branch 'origin/master' into custom-profile-pr-rfc 2019-07-28 09:24:31 +03:00
Eric Huss
a4e9611453 Fix some formatting for some strings. 2019-07-13 16:00:47 -07:00
Dan Aloni
2f81adb115 named-profiles: feature gate exemptions
To preserve old `profile` behavior, some cases of `--profile`
should not trigger an error. Plus, the 'check' profile should be
allowed for profile selection tests and `rustc --profile=check`.
2019-06-20 18:32:29 +03:00
Dan Aloni
87183146d9 Merge remote-tracking branch 'origin/master' into custom-profile-pr-rfc 2019-06-20 16:18:42 +03: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
Dan Aloni
a72c405fe5 tests: we now allow a profile.debug 2019-06-01 13:49:51 +03:00
Eric Huss
70e4e87c17 Warn on version req with metadata. 2019-03-31 18:53:54 -07:00
Jonathan Claudius
46b2b78754
Merge branch 'master' into https_all_the_things 2019-02-22 14:21:53 -05:00
Alexander Regueiro
f7c91ba622
Various cosmetic improvements. 2019-02-20 10:58:27 +00:00
Jonathan Claudius
a9480edbc2
Try to get build to fix 2019-01-31 14:52:28 -05:00
Jonathan Claudius
0c3851c017
HTTPS all the things 2019-01-30 15:34:37 -05: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
6ad7794027 Include path to manifest in workspace warnings. 2018-11-07 11:17:29 -08:00
Zach Lute
3492a3905c Replace 'project' with 'package' in many strings and comments. 2018-09-20 23:47:09 -07: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
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
Dale Wijnand
f53f2b0e94
Fix tests that have failing commands w/o specifying the exit code 2018-08-03 07:45:21 +01: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
bors
63a08ee7d5 Auto merge of #5831 - Eh2406:i5684, r=alexcrichton
cargo can silently fix some bad lockfiles (use --locked to disable)

Lock files often get corrupted by git merge. This makes all cargo commands silently fix that kind of corruption.

If you want to be sure that your CI does not change the lock file you have commited
---

Then make sure to use `--locked` in your CI

Edit: original description below

---------------

This is a continuation of @dwijnand work in #5809, and closes #5684

This adds a `ignore_errors` arg to reading a lock file which ignores sections it doesn't understand. Specifically things that depend on versions that don't exist in the lock file. Then all users pass false except for the two that relate to `update` command.

I think the open questions for this pr relate to testing.
- Now that we are passing false in all other commands, do they each need a test for a bad lockfile?
- Do we need a test with a more subtly corrupted lock file, or is this always sufficient for `update` to clean up?
2018-08-01 16:39:58 +00:00
Eh2406
a418364dda remove missing from the package list error and fmt 2018-07-31 15:04:12 -04:00
Kornel Lesiński
5f3e8cbfa2 Hint correct name of profile.debug 2018-07-31 10:18:10 +01:00
Eh2406
86feda12fa cargo update can deal with some bad lockfiles 2018-07-30 12:12:04 -04:00
Dale Wijnand
316622afd6
Test verbose error output for a bad lockfile 2018-07-26 17:14:08 +01:00
Dale Wijnand
fcc3044e83
Suggest "update -p" to fix a bad lockfile 2018-07-26 17:12:09 +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
f8c9928cc1
Rework some test projects to use the "foo" default
Generally that means either switching "foo" and "bar" around (reversing
the arrow), or it means push "foo" to "bar" (and sometimes "bar" to
"baz", etc..) to free up "foo".

For trivia that leaves 80/1222 outliers, therefore 93.4% of test
project use the default. :)
2018-07-21 19:40:45 +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
688a4fa6b3 Warn about unused virtual manifest keys.
Fixes #4243
2018-07-14 09:20:15 -07:00
Aleksey Kladov
ddb9cedf32 Show lockfile parsing errors without --verbose
It is possible to get invalid lockfile after an automatic merge, so it
make sense to print a little bit more details by defaults than just
"failed to parse a lockfile".
2018-07-01 10:29:49 +03:00
Eric Huss
2f7b52259b Config Profiles (RFC 2282 Part 2)
Notes:
- `-Z config-profile` CLI option is required to use.
- Config values no longer reject mixed base types (integer, string, boolean) in order to support the mixed types in profiles.
2018-05-30 17:53:41 -07:00
Eric Huss
7c0b5fae8a Drop num_traits and rely on serde to handle numeric limits. 2018-05-22 15:06:06 -07:00
Eric Huss
d64122454b Typed Config Access
This introduces a new API for accessing config values using serde to
automatically convert to a destination type.  By itself this shouldn't
introduce any behavioral changes (except for some slight wording changes to
error messages).  However, it unlocks the ability to use richer data types in
the future (such as `profile`, or `source`).  Example:

```rust
let p: Option<TomlProfile> = config.get("profile.dev")?;
```

Supports environment variables when fetching structs or maps.  Note that it can
support underscores in env var for struct field names, but not maps.  So for
example, "opt_level" works, but not "serde_json" (example:
`CARGO_PROFILE_DEV_OVERRIDES_serde_OPT_LEVEL`).  I don't have any ideas for a
workaround (though I feel this is an overuse of env vars).

It supports environment variables for lists.  The value in the env var will get
appended to anything in the config.  It uses TOML syntax, and currently only
supports strings.  Example:  `CARGO_FOO=['a', 'b']`.  I did *not* modify
`get_list` to avoid changing behavior, but that can easily be changed.
2018-05-19 11:05:03 -07:00
DarkDrek
ab4b8b9d83 Add option to set user-agent
Fixes #5494
2018-05-12 01:19:00 +02:00
Aleksey Kladov
ecd1e5df0f Tweak error messages
By convention, all errors should start with a lowercase letter
2018-05-03 18:31:23 +03:00
Aleksey Kladov
f1dabb7ec9 Fix the test 2018-05-03 13:22:03 +03:00
Simon Smith
0b530c3086 Add target directory parameter: address suggestions 2018-04-24 02:52:41 -04:00
Aleksey Kladov
9f7618b36c Preprobe info for known crate type
Previously, we've calculated the set of crate types to learn about by
recursively walking the graph of units. However, to actually know
dependencies of a unit exactly, we must know target specific info, and
we don't know it at this moment (in fact, we are trying calculating it).

Note that crate-type calculation is already lazy, we don't have to calc
all crate-types upfront. So, let's just scrape this info once for
well-known crate types, and fill whatever is left lazily.
2018-03-21 10:54:15 +03:00
Aleksey Kladov
b0c181d91c Prettify rustfmted single-line strings 2018-03-14 17:48:44 -07:00
Alex Crichton
1e6828485e cargo fmt 2018-03-14 17:48:23 -07:00