61 Commits

Author SHA1 Message Date
Eric Huss
f344f73063 Fix test target_in_environment_contains_lower_case 2021-02-23 19:51:42 -08:00
Eric Huss
0564466f45 Combine target env tests. 2021-02-14 11:32:18 -08:00
Nick Flueckiger
4234077bc2 Re-add backticks 2021-02-14 13:15:35 +01:00
Nick Flueckiger
d3aed3585e Update wording and use if let 2021-02-14 13:00:20 +01:00
Nick Flueckiger
86c6e42741 Fix windows test case 2021-02-14 00:20:21 +01:00
Nick Flueckiger
c86310210c Update windows check 2021-02-13 23:20:43 +01:00
Nick Flueckiger
6af31941f3 Adapt implementation with reviewer suggestions and requested changes 2021-02-13 21:17:18 +01:00
Nick Flueckiger
6ea8abc805 Correct target 2021-02-13 12:19:00 +01:00
Nick Flueckiger
dd4b95fb9f Lint 2021-02-13 12:14:24 +01:00
Nick Flueckiger
a7ae6352a3 Exclude test on windows 2021-02-13 11:59:38 +01:00
Nick Flueckiger
11c82a8af8 Implement uppercase env map for key case mismatch 2021-02-13 11:46:13 +01:00
Eric Huss
6f8c7d5a87 Normalize raw string indentation. 2020-09-26 17:59:58 -07:00
bors
f03698b3f9 Auto merge of #8629 - EmbarkStudios:master, r=ehuss
Fix bug with PathAndArg config values

This fixes an issue I noticed when trying to specify a target runner via the [`CARGO_TARGET_{triplet}_RUNNER`](https://doc.rust-lang.org/cargo/reference/config.html#targettriplerunner) environment variable, expecting it to override the value in our `.cargo/config.toml` file, which was giving quite strange errors until I figured out that cargo was actually merging the config file's values with the environment's values.

This change adds a small hack to use and `UnmergedStringList` from `PathAndArgs` instead of just plain `StringList`, which uses the type in the deserializer to determine if `Config::get_list_or_string` should merge the values from the config file(s) with the environment as it was doing before, or else only use the environment to the exclusion of the config file(s) if the key was set in the environment.

I also added a test for this to confirm both the bug and the fix.
2020-08-18 16:52:45 +00:00
Jake Shadle
ddc7090f49 Remove debug only code 2020-08-17 19:53:16 +02:00
Jake Shadle
a9a154f783 Fix bug with PathAndArg config values 2020-08-17 19:23:49 +02:00
Eric Huss
18bc90cd0e Show full error context on cargo run error. 2020-08-17 08:55:37 -07:00
Eric Huss
fd258634c9 Improvements to StringList config handling. 2020-02-16 15:29:59 -08:00
Eric Huss
35b924db5a Fix CARGO_TARGET_triple_LINKER environment variable. 2020-01-02 11:50:00 -08:00
Eric Huss
00a47302dd Fixes for some test errors on Windows. 2019-12-19 09:44:02 -08:00
Eric Huss
381251aa1f Config refactoring. 2019-12-19 09:44:01 -08:00
Matthias Krüger
34f2d4710b fix a couple of typos 2019-12-11 15:31:26 +01:00
Eric Huss
83571aee56 Minor testsuite organization. 2019-11-24 18:42:45 -08:00
Dan Aloni
375a46f18b Merge remote-tracking branch 'origin/master' into custom-profile-pr-rfc 2019-09-18 08:56:13 +03: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
Dan Aloni
27da33c67d Merge remote-tracking branch 'origin/master' into custom-profile-pr-rfc 2019-07-28 09:24:31 +03:00
Alex Crichton
c2354b9a11 Setup CI with Azure Pipelines 2019-07-23 09:09:41 -07:00
Eric Huss
a4e9611453 Fix some formatting for some strings. 2019-07-13 16:00:47 -07: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
e25f6a4255 tests: fix finished line for 'cargo test' 2019-06-07 21:47:45 +03:00
Alex Crichton
f16efff150 Run cargo fmt 2019-04-10 10:42:07 -07:00
Eric Huss
0b2b10b73c Cleanup: Misc. 2019-03-26 19:06:08 -07:00
Eric Huss
e7124ba262 Testsuite: Make cwd() relative to project root.
It's a fairly common pattern, and it seemed natural to me.
2019-03-20 16:34:56 -07: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
Dale Wijnand
dc6b5be30d
Simplify tool_paths::absolute_tools test
... by reusing the new [ROOT] macro.
2018-11-18 14:45:28 +00:00
Zach Lute
ad6bc8e4c4 Fixed CWD templates in tool_path tests. 2018-09-09 16:51:23 -07:00
Zach Lute
b020d3789a Resolve merge conflicts with test string changes. 2018-09-09 16:48:57 -07:00
Jorge Aparicio
6a12aa56e4 add support for target.'cfg(..)'.runner
`cfg` can be used to reduce the number of `runner`s one needs to type in
`.cargo/config`. So instead of writing this:

``` toml
[target.thumbv6m-none-eabi]
runner = "arm-none-eabi-gdb"

[target.thumbv7m-none-eabi]
runner = "arm-none-eabi-gdb"

[target.thumbv7em-none-eabi]
runner = "arm-none-eabi-gdb"

[target.thumbv7em-none-eabihf]
runner = "arm-none-eabi-gdb"
```

one can write:

``` toml
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
runner = "arm-none-eabi-gdb"
```

Handling of edge cases:

- When `target.$triple.runner` matches it will be chosen regardless of the
  existence of others `target.'cfg(..)'.runner`s.

- If more than one `target.'cfg(..)'.runner` matches the target the command will
  fail.

closes #5946
2018-09-08 14:25:45 +02: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
bors
a78f5aaa84 Auto merge of #5904 - dwijnand:backslash, r=alexcrichton
Remove backslash management in 2 tool_paths tests

With #5851 this is no longer necessary
2018-08-19 16:18:59 +00:00
Dale Wijnand
0152f26405
Move .env/.masquerade_as_nightly_cargo to collapse some more p.cargo calls 2018-08-18 21:34:09 +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
9d9883b26c
Single slash root on Windows 2018-08-18 12:20:00 +01:00
Dale Wijnand
4c9d42e0c7
Remove backslash management in 2 tool_paths tests 2018-08-18 10:19:39 +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
f53f2b0e94
Fix tests that have failing commands w/o specifying the exit code 2018-08-03 07:45:21 +01:00