cargo/tests/testsuite/main.rs

130 lines
2.4 KiB
Rust
Raw Normal View History

#![warn(rust_2018_idioms)] // while we're getting used to 2018
2018-12-20 01:40:01 +00:00
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
#![allow(clippy::blacklisted_name)]
#![allow(clippy::explicit_iter_loop)]
2019-04-15 20:49:04 +00:00
#![allow(clippy::redundant_closure)]
2020-06-03 22:44:59 +00:00
#![allow(clippy::blocks_in_if_conditions)] // clippy doesn't agree with rustfmt 😂
#![allow(clippy::inefficient_to_string)] // this causes suggestions that result in `(*s).to_string()`
2019-03-27 00:53:53 +00:00
#![warn(clippy::needless_borrow)]
2019-03-27 01:51:13 +00:00
#![warn(clippy::redundant_clone)]
2018-03-16 09:32:31 +00:00
#[macro_use]
extern crate cargo_test_macro;
2019-11-24 17:43:59 +00:00
mod advanced_env;
mod alt_registry;
mod bad_config;
mod bad_manifest_path;
mod bench;
mod build;
mod build_plan;
mod build_script;
mod build_script_env;
2019-05-12 00:35:25 +00:00
mod cache_messages;
mod cargo_alias_config;
mod cargo_command;
mod cargo_features;
mod cargo_targets;
mod cfg;
mod check;
mod clean;
2018-11-12 15:13:13 +00:00
mod collisions;
mod concurrent;
mod config;
2019-11-30 21:55:52 +00:00
mod config_cli;
2019-12-01 18:19:02 +00:00
mod config_include;
2018-03-02 17:44:47 +00:00
mod corrupt_git;
mod cross_compile;
mod cross_publish;
2018-03-24 20:38:48 +00:00
mod custom_target;
mod death;
mod dep_info;
mod directory;
mod doc;
mod edition;
2020-02-18 02:46:48 +00:00
mod error;
mod features;
2019-09-10 22:38:01 +00:00
mod features2;
mod fetch;
mod fix;
mod freshness;
mod generate_lockfile;
mod git;
2019-11-25 02:42:45 +00:00
mod git_auth;
mod git_gc;
mod glob_targets;
mod help;
mod init;
mod install;
2019-03-31 00:33:35 +00:00
mod install_upgrade;
mod jobserver;
mod list_targets;
mod local_registry;
2019-12-10 00:18:12 +00:00
mod locate_project;
mod lockfile_compat;
mod login;
Add support for `-Cembed-bitcode=no` This commit is the Cargo half of support necessary for rust-lang/rust#70458. Today the compiler emits embedded bytecode in rlibs by default, but compresses it. This is both extraneous disk space and wasted build time for almost all builds, so the PR in question there is changing rustc to have a `-Cembed-bitcode` flag which, when enabled, places the bitcode in the object file rather than an auxiliary file (no extra compression), but also enables `-Cembed-bitcode=no` to disable bitcode emission entirely. This Cargo support changes Cargo to pass `-Cembed-bitcode=no` for almost all compilations. Cargo will keep `lto = true` and such working by not passing this flag (and thus allowing bitcode to get embedded), but by default `cargo build` and `cargo build --release` will no longer have any bitcode in rlibs which should result in speedier builds! Most of the changes here were around the test suite and various assertions about the `rustc` command lines we spit out. One test was hard-disabled until we can get `-Cembed-bitcode=no` into nightly, and then we can make it a nightly-only test. The test will then be stable again once `-Cembed-bitcode=no` hits stable. Note that this is intended to land before the upstream `-Cembed-bitcode` change. The thinking is that we'll land everything in rust-lang/rust all at once so there's no build time regressions for anyone. If we were to land the `-Cembed-bitcode` PR first then there would be a build time regression until we land Cargo changes because rustc would be emitting uncompressed bitcode by default and Cargo wouldn't be turning it off.
2020-04-01 18:41:27 +00:00
mod lto;
mod member_discovery;
2018-10-09 13:05:10 +00:00
mod member_errors;
Add support for customizing JSON diagnostics from Cargo Cargo has of #7143 enabled pipelined compilation by default which affects how the compiler is invoked, especially with respect to JSON messages. This, in some testing, has proven to cause quite a few issues with rustbuild's current integration with Cargo. This commit is aimed at adding features to Cargo to solve this issue. This commit adds the ability to customize the stream of JSON messages coming from Cargo. The new feature for Cargo is that it now also mirrors rustc in how you can configure the JSON stream. Multiple `--message-format` arguments are now supported and the value specified is a comma-separated list of directives. In addition to the existing `human`, `short`, and `json` directives these new directives have been added: * `json-render-diagnostics` - instructs Cargo to render rustc diagnostics and only print out JSON messages for artifacts and Cargo things. * `json-diagnostic-short` - indicates that the `rendered` field of rustc diagnostics should use the "short" rendering. * `json-diagnostic-rendered-ansi` - indicates that the `rendered` field of rustc diagnostics should embed ansi color codes. The first option here, `json-render-diagnostics`, will be used by rustbuild unconditionally. Additionally `json-diagnostic-short` will be conditionally used based on the input to rustbuild itself. This should be enough for external tools to customize how Cargo is invoked and how all kinds of JSON diagnostics get printed, and it's thought that we can relatively easily tweak this as necessary to extend it and such.
2019-08-05 16:42:28 +00:00
mod message_format;
2018-06-11 17:44:55 +00:00
mod metabuild;
mod metadata;
2019-11-25 02:42:45 +00:00
mod minimal_versions;
mod multitarget;
mod net_config;
mod new;
mod offline;
2018-04-03 06:51:52 +00:00
mod out_dir;
mod owner;
mod package;
mod package_features;
mod patch;
mod path;
2019-11-25 02:42:45 +00:00
mod paths;
2019-12-24 08:52:57 +00:00
mod pkgid;
mod plugins;
mod proc_macro;
mod profile_config;
mod profile_custom;
mod profile_overrides;
mod profile_targets;
mod profiles;
mod progress;
mod pub_priv;
mod publish;
mod publish_lockfile;
mod read_manifest;
mod registry;
mod rename_deps;
2019-11-25 02:42:45 +00:00
mod replace;
mod required_features;
mod run;
mod rustc;
mod rustc_info_cache;
mod rustdoc;
mod rustdoc_extern_html;
mod rustdocflags;
mod rustflags;
mod search;
mod shell_quoting;
2019-08-01 16:11:22 +00:00
mod standard_lib;
mod test;
2019-09-20 21:11:49 +00:00
mod timings;
mod tool_paths;
2020-03-19 17:51:25 +00:00
mod tree;
mod tree_graph_features;
2020-03-08 22:12:18 +00:00
mod unit_graph;
mod update;
Import the cargo-vendor subcommand into Cargo This commit imports the external [alexcrichton/cargo-vendor repository][repo] into Cargo itself. This means it will no longer be necessary to install the `cargo-vendor` subcommand in order to vendor dependencies. Additionally it'll always support the latest feature set of Cargo as it'll be built into Cargo! All tests were imported as part of this commit, but not all features were imported. Some flags have been left out that were added later in the lifetime of `cargo vendor` which seem like they're more questionable to stabilize. I'm hoping that they can have separate PRs adding their implementation here, and we can make a decision of their stabilization at a later date. The current man page for `cargo vendor -h` will look like: cargo-vendor Vendor all dependencies for a project locally USAGE: cargo vendor [OPTIONS] [--] [path] OPTIONS: -q, --quiet No output printed to stdout --manifest-path <PATH> Path to Cargo.toml --no-delete Don't delete older crates in the vendor directory -s, --sync <TOML>... Additional `Cargo.toml` to sync and vendor --respect-source-config Respect `[source]` config in `.cargo/config` -v, --verbose Use verbose output (-vv very verbose/build.rs output) --color <WHEN> Coloring: auto, always, never --frozen Require Cargo.lock and cache are up to date --locked Require Cargo.lock is up to date -Z <FLAG>... Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details -h, --help Prints help information ARGS: <path> Where to vendor crates (`vendor` by default) This cargo subcommand will vendor all crates.io and git dependencies for a project into the specified directory at `<path>`. After this command completes the vendor directory specified by `<path>` will contain all remote sources from dependencies specified. Additionally manifest beyond the default one can be specified with the `-s` option. The `cargo vendor` command will also print out the configuration necessary to use the vendored sources, which when needed is then encoded into `.cargo/config`. Since this change is not importing 100% of the functionality of the existing `cargo vendor` this change does run a risk of being a breaking change for any folks using such functionality. Executing `cargo vendor` will favor the built-in command rather than an external subcommand, causing unimplemented features to become errors about flag usage. [repo]: https://github.com/alexcrichton/cargo-vendor
2019-04-23 00:54:27 +00:00
mod vendor;
mod verify_project;
mod version;
mod warn_on_failure;
mod workspaces;
mod yank;
#[cargo_test]
fn aaa_trigger_cross_compile_disabled_check() {
// This triggers the cross compile disabled check to run ASAP, see #5141
cargo_test_support::cross_compile::disabled();
}