From fbf6ce62df3243013a5f61dada3c8d9f9835bb04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Rocha?= Date: Thu, 8 Feb 2018 01:13:17 +0100 Subject: [PATCH 1/2] Reorganize integration tests as one crate with many modules. Issue #4867. --- Cargo.toml | 6 +- .../alt_registry.rs} | 3 - .../bad_config.rs} | 3 - .../bad_manifest_path.rs} | 3 - tests/{ => testsuite}/bench.rs | 4 - tests/{ => testsuite}/build.rs | 6 -- .../build_auth.rs} | 7 +- .../{build-lib.rs => testsuite/build_lib.rs} | 0 .../build_script.rs} | 3 - .../build_script_env.rs} | 3 - tests/{ => testsuite}/cargo.rs | 4 - tests/{ => testsuite}/cargo_alias_config.rs | 2 - .../cargo_features.rs} | 3 - tests/{ => testsuite}/cargotest/Cargo.toml | 2 +- tests/{ => testsuite}/cargotest/install.rs | 0 tests/{ => testsuite}/cargotest/lib.rs | 0 .../cargotest/support/cross_compile.rs | 0 .../{ => testsuite}/cargotest/support/git.rs | 0 .../{ => testsuite}/cargotest/support/mod.rs | 0 .../cargotest/support/paths.rs | 0 .../cargotest/support/publish.rs | 0 .../cargotest/support/registry.rs | 0 tests/{ => testsuite}/cfg.rs | 4 - tests/{ => testsuite}/check-style.sh | 0 tests/{ => testsuite}/check.rs | 4 - tests/{ => testsuite}/clean.rs | 3 - tests/{ => testsuite}/concurrent.rs | 6 +- tests/{ => testsuite}/config.rs | 3 - .../cross_compile.rs} | 4 - .../cross_publish.rs} | 6 -- tests/{ => testsuite}/death.rs | 5 -- tests/{dep-info.rs => testsuite/dep_info.rs} | 3 - tests/{ => testsuite}/directory.rs | 8 +- tests/{ => testsuite}/doc.rs | 5 +- tests/{ => testsuite}/features.rs | 4 - tests/{ => testsuite}/fetch.rs | 3 - tests/{ => testsuite}/freshness.rs | 3 - .../generate_lockfile.rs} | 3 - tests/{ => testsuite}/git.rs | 6 +- tests/{ => testsuite}/init.rs | 6 +- tests/{ => testsuite}/install.rs | 5 +- tests/{ => testsuite}/jobserver.rs | 3 - tests/testsuite/lib.rs | 82 +++++++++++++++++++ .../local_registry.rs} | 4 - .../lockfile_compat.rs} | 3 - tests/{ => testsuite}/login.rs | 7 +- tests/{ => testsuite}/metadata.rs | 3 - .../net_config.rs} | 3 - tests/{ => testsuite}/new.rs | 6 +- tests/{ => testsuite}/overrides.rs | 3 - tests/{ => testsuite}/package.rs | 9 +- tests/{ => testsuite}/patch.rs | 6 +- tests/{ => testsuite}/path.rs | 6 +- tests/{ => testsuite}/plugins.rs | 3 - .../proc_macro.rs} | 3 - tests/{ => testsuite}/profiles.rs | 3 - tests/{ => testsuite}/publish.rs | 5 -- .../read_manifest.rs} | 3 - tests/{ => testsuite}/registry.rs | 5 -- .../required_features.rs} | 3 - tests/{ => testsuite}/resolve.rs | 3 - tests/{ => testsuite}/run.rs | 4 - tests/{ => testsuite}/rustc.rs | 3 - tests/{ => testsuite}/rustdoc.rs | 3 - tests/{ => testsuite}/rustdocflags.rs | 3 - tests/{ => testsuite}/rustflags.rs | 3 - tests/{ => testsuite}/search.rs | 6 +- .../small_fd_limits.rs} | 6 +- tests/{ => testsuite}/test.rs | 5 +- .../tool_paths.rs} | 3 - .../verify_project.rs} | 3 - tests/{ => testsuite}/version.rs | 5 +- .../warn_on_failure.rs} | 3 - tests/{ => testsuite}/workspaces.rs | 4 - 74 files changed, 107 insertions(+), 237 deletions(-) rename tests/{alt-registry.rs => testsuite/alt_registry.rs} (99%) rename tests/{bad-config.rs => testsuite/bad_config.rs} (99%) rename tests/{bad-manifest-path.rs => testsuite/bad_manifest_path.rs} (99%) rename tests/{ => testsuite}/bench.rs (99%) rename tests/{ => testsuite}/build.rs (99%) rename tests/{build-auth.rs => testsuite/build_auth.rs} (98%) rename tests/{build-lib.rs => testsuite/build_lib.rs} (100%) rename tests/{build-script.rs => testsuite/build_script.rs} (99%) rename tests/{build-script-env.rs => testsuite/build_script_env.rs} (98%) rename tests/{ => testsuite}/cargo.rs (98%) rename tests/{ => testsuite}/cargo_alias_config.rs (98%) rename tests/{cargo-features.rs => testsuite/cargo_features.rs} (99%) rename tests/{ => testsuite}/cargotest/Cargo.toml (92%) rename tests/{ => testsuite}/cargotest/install.rs (100%) rename tests/{ => testsuite}/cargotest/lib.rs (100%) rename tests/{ => testsuite}/cargotest/support/cross_compile.rs (100%) rename tests/{ => testsuite}/cargotest/support/git.rs (100%) rename tests/{ => testsuite}/cargotest/support/mod.rs (100%) rename tests/{ => testsuite}/cargotest/support/paths.rs (100%) rename tests/{ => testsuite}/cargotest/support/publish.rs (100%) rename tests/{ => testsuite}/cargotest/support/registry.rs (100%) rename tests/{ => testsuite}/cfg.rs (99%) rename tests/{ => testsuite}/check-style.sh (100%) rename tests/{ => testsuite}/check.rs (99%) rename tests/{ => testsuite}/clean.rs (99%) rename tests/{ => testsuite}/concurrent.rs (99%) rename tests/{ => testsuite}/config.rs (93%) rename tests/{cross-compile.rs => testsuite/cross_compile.rs} (99%) rename tests/{cross-publish.rs => testsuite/cross_publish.rs} (96%) rename tests/{ => testsuite}/death.rs (98%) rename tests/{dep-info.rs => testsuite/dep_info.rs} (97%) rename tests/{ => testsuite}/directory.rs (99%) rename tests/{ => testsuite}/doc.rs (99%) rename tests/{ => testsuite}/features.rs (99%) rename tests/{ => testsuite}/fetch.rs (90%) rename tests/{ => testsuite}/freshness.rs (99%) rename tests/{generate-lockfile.rs => testsuite/generate_lockfile.rs} (99%) rename tests/{ => testsuite}/git.rs (99%) rename tests/{ => testsuite}/init.rs (99%) rename tests/{ => testsuite}/install.rs (99%) rename tests/{ => testsuite}/jobserver.rs (99%) create mode 100644 tests/testsuite/lib.rs rename tests/{local-registry.rs => testsuite/local_registry.rs} (99%) rename tests/{lockfile-compat.rs => testsuite/lockfile_compat.rs} (99%) rename tests/{ => testsuite}/login.rs (98%) rename tests/{ => testsuite}/metadata.rs (99%) rename tests/{net-config.rs => testsuite/net_config.rs} (96%) rename tests/{ => testsuite}/new.rs (99%) rename tests/{ => testsuite}/overrides.rs (99%) rename tests/{ => testsuite}/package.rs (99%) rename tests/{ => testsuite}/patch.rs (99%) rename tests/{ => testsuite}/path.rs (99%) rename tests/{ => testsuite}/plugins.rs (99%) rename tests/{proc-macro.rs => testsuite/proc_macro.rs} (99%) rename tests/{ => testsuite}/profiles.rs (99%) rename tests/{ => testsuite}/publish.rs (99%) rename tests/{read-manifest.rs => testsuite/read_manifest.rs} (98%) rename tests/{ => testsuite}/registry.rs (99%) rename tests/{required-features.rs => testsuite/required_features.rs} (99%) rename tests/{ => testsuite}/resolve.rs (99%) rename tests/{ => testsuite}/run.rs (99%) rename tests/{ => testsuite}/rustc.rs (99%) rename tests/{ => testsuite}/rustdoc.rs (99%) rename tests/{ => testsuite}/rustdocflags.rs (98%) rename tests/{ => testsuite}/rustflags.rs (99%) rename tests/{ => testsuite}/search.rs (99%) rename tests/{small-fd-limits.rs => testsuite/small_fd_limits.rs} (97%) rename tests/{ => testsuite}/test.rs (99%) rename tests/{tool-paths.rs => testsuite/tool_paths.rs} (99%) rename tests/{verify-project.rs => testsuite/verify_project.rs} (97%) rename tests/{ => testsuite}/version.rs (94%) rename tests/{warn-on-failure.rs => testsuite/warn_on_failure.rs} (98%) rename tests/{ => testsuite}/workspaces.rs (99%) diff --git a/Cargo.toml b/Cargo.toml index 265a0ad1553..830424778c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -79,7 +79,7 @@ features = [ [dev-dependencies] bufstream = "0.1" -cargotest = { path = "tests/cargotest", version = "0.1" } +cargotest = { path = "tests/testsuite/cargotest", version = "0.1" } filetime = "0.1" hamcrest = "=0.1.1" @@ -87,3 +87,7 @@ hamcrest = "=0.1.1" name = "cargo" test = false doc = false + +[[test]] +name = "testsuite" +path = "tests/testsuite/lib.rs" \ No newline at end of file diff --git a/tests/alt-registry.rs b/tests/testsuite/alt_registry.rs similarity index 99% rename from tests/alt-registry.rs rename to tests/testsuite/alt_registry.rs index 7d3f911557e..467995a10e5 100644 --- a/tests/alt-registry.rs +++ b/tests/testsuite/alt_registry.rs @@ -1,6 +1,3 @@ -extern crate cargotest; -extern crate hamcrest; - use cargotest::ChannelChanger; use cargotest::support::registry::{self, Package, alt_api_path}; use cargotest::support::{paths, project, execs}; diff --git a/tests/bad-config.rs b/tests/testsuite/bad_config.rs similarity index 99% rename from tests/bad-config.rs rename to tests/testsuite/bad_config.rs index 87717578c2a..dc6f8a75a26 100644 --- a/tests/bad-config.rs +++ b/tests/testsuite/bad_config.rs @@ -1,6 +1,3 @@ -extern crate cargotest; -extern crate hamcrest; - use cargotest::support::{project, execs}; use cargotest::support::registry::Package; use hamcrest::assert_that; diff --git a/tests/bad-manifest-path.rs b/tests/testsuite/bad_manifest_path.rs similarity index 99% rename from tests/bad-manifest-path.rs rename to tests/testsuite/bad_manifest_path.rs index 2dc0d5b266f..5673f0076ba 100644 --- a/tests/bad-manifest-path.rs +++ b/tests/testsuite/bad_manifest_path.rs @@ -1,6 +1,3 @@ -extern crate hamcrest; -extern crate cargotest; - use cargotest::support::{project, execs, main_file, basic_bin_manifest}; use hamcrest::{assert_that}; diff --git a/tests/bench.rs b/tests/testsuite/bench.rs similarity index 99% rename from tests/bench.rs rename to tests/testsuite/bench.rs index 947f920e32c..8ab6a126f68 100644 --- a/tests/bench.rs +++ b/tests/testsuite/bench.rs @@ -1,7 +1,3 @@ -extern crate cargotest; -extern crate cargo; -extern crate hamcrest; - use std::str; use cargo::util::process; diff --git a/tests/build.rs b/tests/testsuite/build.rs similarity index 99% rename from tests/build.rs rename to tests/testsuite/build.rs index 14237e4c9b1..5c95fc04b0b 100644 --- a/tests/build.rs +++ b/tests/testsuite/build.rs @@ -1,9 +1,3 @@ -extern crate cargo; -#[macro_use] -extern crate cargotest; -extern crate hamcrest; -extern crate tempdir; - use std::env; use std::fs::{self, File}; use std::io::prelude::*; diff --git a/tests/build-auth.rs b/tests/testsuite/build_auth.rs similarity index 98% rename from tests/build-auth.rs rename to tests/testsuite/build_auth.rs index 5420de7bca3..53ec0d4f1d0 100644 --- a/tests/build-auth.rs +++ b/tests/testsuite/build_auth.rs @@ -1,13 +1,10 @@ -extern crate bufstream; -extern crate git2; -extern crate cargotest; -extern crate hamcrest; - +use std; use std::collections::HashSet; use std::io::prelude::*; use std::net::TcpListener; use std::thread; +use git2; use bufstream::BufStream; use cargotest::support::paths; use cargotest::support::{project, execs}; diff --git a/tests/build-lib.rs b/tests/testsuite/build_lib.rs similarity index 100% rename from tests/build-lib.rs rename to tests/testsuite/build_lib.rs diff --git a/tests/build-script.rs b/tests/testsuite/build_script.rs similarity index 99% rename from tests/build-script.rs rename to tests/testsuite/build_script.rs index 32ff94e9f98..d88a0b5db56 100644 --- a/tests/build-script.rs +++ b/tests/testsuite/build_script.rs @@ -1,6 +1,3 @@ -extern crate cargotest; -extern crate hamcrest; - use std::env; use std::fs::{self, File}; use std::io::prelude::*; diff --git a/tests/build-script-env.rs b/tests/testsuite/build_script_env.rs similarity index 98% rename from tests/build-script-env.rs rename to tests/testsuite/build_script_env.rs index 610301cfb9e..6afe2a7a97d 100644 --- a/tests/build-script-env.rs +++ b/tests/testsuite/build_script_env.rs @@ -1,6 +1,3 @@ -extern crate cargotest; -extern crate hamcrest; - use std::fs::File; use cargotest::sleep_ms; diff --git a/tests/cargo.rs b/tests/testsuite/cargo.rs similarity index 98% rename from tests/cargo.rs rename to tests/testsuite/cargo.rs index 55de7b9c7d6..d33a2b2a607 100644 --- a/tests/cargo.rs +++ b/tests/testsuite/cargo.rs @@ -1,7 +1,3 @@ -extern crate cargo; -extern crate cargotest; -extern crate hamcrest; - use std::env; use std::fs::{self, File}; use std::io::prelude::*; diff --git a/tests/cargo_alias_config.rs b/tests/testsuite/cargo_alias_config.rs similarity index 98% rename from tests/cargo_alias_config.rs rename to tests/testsuite/cargo_alias_config.rs index 0f1a9583486..6bd1633a9d0 100644 --- a/tests/cargo_alias_config.rs +++ b/tests/testsuite/cargo_alias_config.rs @@ -1,5 +1,3 @@ -extern crate cargotest; -extern crate hamcrest; use cargotest::support::{project, execs, basic_bin_manifest}; use hamcrest::{assert_that}; diff --git a/tests/cargo-features.rs b/tests/testsuite/cargo_features.rs similarity index 99% rename from tests/cargo-features.rs rename to tests/testsuite/cargo_features.rs index 9d3246c4d8f..8ac5fb35159 100644 --- a/tests/cargo-features.rs +++ b/tests/testsuite/cargo_features.rs @@ -1,6 +1,3 @@ -extern crate cargotest; -extern crate hamcrest; - use cargotest::ChannelChanger; use cargotest::support::{project, execs}; use hamcrest::assert_that; diff --git a/tests/cargotest/Cargo.toml b/tests/testsuite/cargotest/Cargo.toml similarity index 92% rename from tests/cargotest/Cargo.toml rename to tests/testsuite/cargotest/Cargo.toml index 5f1b6a49856..89fbdfa0be6 100644 --- a/tests/cargotest/Cargo.toml +++ b/tests/testsuite/cargotest/Cargo.toml @@ -7,7 +7,7 @@ authors = ["Alex Crichton "] path = "lib.rs" [dependencies] -cargo = { path = "../.." } +cargo = { path = "../../.." } filetime = "0.1" flate2 = "1.0" git2 = { version = "0.6", default-features = false } diff --git a/tests/cargotest/install.rs b/tests/testsuite/cargotest/install.rs similarity index 100% rename from tests/cargotest/install.rs rename to tests/testsuite/cargotest/install.rs diff --git a/tests/cargotest/lib.rs b/tests/testsuite/cargotest/lib.rs similarity index 100% rename from tests/cargotest/lib.rs rename to tests/testsuite/cargotest/lib.rs diff --git a/tests/cargotest/support/cross_compile.rs b/tests/testsuite/cargotest/support/cross_compile.rs similarity index 100% rename from tests/cargotest/support/cross_compile.rs rename to tests/testsuite/cargotest/support/cross_compile.rs diff --git a/tests/cargotest/support/git.rs b/tests/testsuite/cargotest/support/git.rs similarity index 100% rename from tests/cargotest/support/git.rs rename to tests/testsuite/cargotest/support/git.rs diff --git a/tests/cargotest/support/mod.rs b/tests/testsuite/cargotest/support/mod.rs similarity index 100% rename from tests/cargotest/support/mod.rs rename to tests/testsuite/cargotest/support/mod.rs diff --git a/tests/cargotest/support/paths.rs b/tests/testsuite/cargotest/support/paths.rs similarity index 100% rename from tests/cargotest/support/paths.rs rename to tests/testsuite/cargotest/support/paths.rs diff --git a/tests/cargotest/support/publish.rs b/tests/testsuite/cargotest/support/publish.rs similarity index 100% rename from tests/cargotest/support/publish.rs rename to tests/testsuite/cargotest/support/publish.rs diff --git a/tests/cargotest/support/registry.rs b/tests/testsuite/cargotest/support/registry.rs similarity index 100% rename from tests/cargotest/support/registry.rs rename to tests/testsuite/cargotest/support/registry.rs diff --git a/tests/cfg.rs b/tests/testsuite/cfg.rs similarity index 99% rename from tests/cfg.rs rename to tests/testsuite/cfg.rs index 370ae36f7d3..dbdbddcac93 100644 --- a/tests/cfg.rs +++ b/tests/testsuite/cfg.rs @@ -1,7 +1,3 @@ -extern crate cargo; -extern crate cargotest; -extern crate hamcrest; - use std::str::FromStr; use std::fmt; diff --git a/tests/check-style.sh b/tests/testsuite/check-style.sh similarity index 100% rename from tests/check-style.sh rename to tests/testsuite/check-style.sh diff --git a/tests/check.rs b/tests/testsuite/check.rs similarity index 99% rename from tests/check.rs rename to tests/testsuite/check.rs index 2f0ea0f4e2e..864dc2cf7c7 100644 --- a/tests/check.rs +++ b/tests/testsuite/check.rs @@ -1,7 +1,3 @@ -extern crate cargotest; -extern crate hamcrest; -extern crate glob; - use cargotest::is_nightly; use cargotest::support::{execs, project}; use cargotest::support::registry::Package; diff --git a/tests/clean.rs b/tests/testsuite/clean.rs similarity index 99% rename from tests/clean.rs rename to tests/testsuite/clean.rs index 0cf5523710a..bc701a8e27e 100644 --- a/tests/clean.rs +++ b/tests/testsuite/clean.rs @@ -1,6 +1,3 @@ -extern crate hamcrest; -extern crate cargotest; - use std::env; use cargotest::support::{git, project, execs, main_file, basic_bin_manifest}; diff --git a/tests/concurrent.rs b/tests/testsuite/concurrent.rs similarity index 99% rename from tests/concurrent.rs rename to tests/testsuite/concurrent.rs index 27ad4b27e44..1829cfa155a 100644 --- a/tests/concurrent.rs +++ b/tests/testsuite/concurrent.rs @@ -1,7 +1,3 @@ -extern crate cargotest; -extern crate git2; -extern crate hamcrest; - use std::{env, str}; use std::fs::{self, File}; use std::io::Write; @@ -11,6 +7,8 @@ use std::thread; use std::sync::mpsc::channel; use std::time::Duration; +use git2; +use cargotest; use cargotest::install::{has_installed_exe, cargo_home}; use cargotest::support::git; use cargotest::support::registry::Package; diff --git a/tests/config.rs b/tests/testsuite/config.rs similarity index 93% rename from tests/config.rs rename to tests/testsuite/config.rs index 89226ce121c..92b76d52791 100644 --- a/tests/config.rs +++ b/tests/testsuite/config.rs @@ -1,6 +1,3 @@ -extern crate hamcrest; -extern crate cargotest; - use cargotest::support::{project, execs}; use hamcrest::assert_that; diff --git a/tests/cross-compile.rs b/tests/testsuite/cross_compile.rs similarity index 99% rename from tests/cross-compile.rs rename to tests/testsuite/cross_compile.rs index cdb55f307cd..080112e89bb 100644 --- a/tests/cross-compile.rs +++ b/tests/testsuite/cross_compile.rs @@ -1,7 +1,3 @@ -extern crate cargo; -extern crate cargotest; -extern crate hamcrest; - use cargo::util::process; use cargotest::{is_nightly, rustc_host}; use cargotest::support::{project, execs, basic_bin_manifest, cross_compile}; diff --git a/tests/cross-publish.rs b/tests/testsuite/cross_publish.rs similarity index 96% rename from tests/cross-publish.rs rename to tests/testsuite/cross_publish.rs index b971d45a86f..5c9545fcee9 100644 --- a/tests/cross-publish.rs +++ b/tests/testsuite/cross_publish.rs @@ -1,9 +1,3 @@ -extern crate cargo; -extern crate cargotest; -extern crate hamcrest; -extern crate flate2; -extern crate tar; - use std::fs::File; use std::path::PathBuf; use std::io::prelude::*; diff --git a/tests/death.rs b/tests/testsuite/death.rs similarity index 98% rename from tests/death.rs rename to tests/testsuite/death.rs index 3f80e406cbb..e520c4dcdfd 100644 --- a/tests/death.rs +++ b/tests/testsuite/death.rs @@ -1,8 +1,3 @@ -extern crate cargotest; -extern crate libc; -#[cfg(windows)] -extern crate winapi; - use std::fs; use std::io::{self, Read}; use std::net::TcpListener; diff --git a/tests/dep-info.rs b/tests/testsuite/dep_info.rs similarity index 97% rename from tests/dep-info.rs rename to tests/testsuite/dep_info.rs index f2f1f82e061..5bf0bf6adbd 100644 --- a/tests/dep-info.rs +++ b/tests/testsuite/dep_info.rs @@ -1,6 +1,3 @@ -extern crate cargotest; -extern crate hamcrest; - use cargotest::support::{basic_bin_manifest, main_file, execs, project}; use hamcrest::{assert_that, existing_file}; diff --git a/tests/directory.rs b/tests/testsuite/directory.rs similarity index 99% rename from tests/directory.rs rename to tests/testsuite/directory.rs index 6dde10e97e8..089ed8778c5 100644 --- a/tests/directory.rs +++ b/tests/testsuite/directory.rs @@ -1,10 +1,4 @@ -#[macro_use] -extern crate cargotest; -extern crate hamcrest; -#[macro_use] -extern crate serde_derive; -extern crate serde_json; - +use serde_json; use std::collections::HashMap; use std::fs::{self, File}; use std::io::prelude::*; diff --git a/tests/doc.rs b/tests/testsuite/doc.rs similarity index 99% rename from tests/doc.rs rename to tests/testsuite/doc.rs index 25ac13048c9..a2b102a0017 100644 --- a/tests/doc.rs +++ b/tests/testsuite/doc.rs @@ -1,7 +1,4 @@ -extern crate cargotest; -extern crate hamcrest; -extern crate cargo; - +use cargotest; use std::str; use std::fs::{self, File}; use std::io::Read; diff --git a/tests/features.rs b/tests/testsuite/features.rs similarity index 99% rename from tests/features.rs rename to tests/testsuite/features.rs index 0eae4380bbe..4654557237e 100644 --- a/tests/features.rs +++ b/tests/testsuite/features.rs @@ -1,7 +1,3 @@ -#[macro_use] -extern crate cargotest; -extern crate hamcrest; - use std::fs::File; use std::io::prelude::*; diff --git a/tests/fetch.rs b/tests/testsuite/fetch.rs similarity index 90% rename from tests/fetch.rs rename to tests/testsuite/fetch.rs index 8c5e9a59de2..880c57ebdb3 100644 --- a/tests/fetch.rs +++ b/tests/testsuite/fetch.rs @@ -1,6 +1,3 @@ -extern crate cargotest; -extern crate hamcrest; - use cargotest::support::{project, execs}; use hamcrest::assert_that; diff --git a/tests/freshness.rs b/tests/testsuite/freshness.rs similarity index 99% rename from tests/freshness.rs rename to tests/testsuite/freshness.rs index ff127a4f575..6a160eb6252 100644 --- a/tests/freshness.rs +++ b/tests/testsuite/freshness.rs @@ -1,6 +1,3 @@ -extern crate cargotest; -extern crate hamcrest; - use std::fs::{self, File}; use std::io::prelude::*; diff --git a/tests/generate-lockfile.rs b/tests/testsuite/generate_lockfile.rs similarity index 99% rename from tests/generate-lockfile.rs rename to tests/testsuite/generate_lockfile.rs index 2a6459602a9..30b2651bcca 100644 --- a/tests/generate-lockfile.rs +++ b/tests/testsuite/generate_lockfile.rs @@ -1,6 +1,3 @@ -extern crate cargotest; -extern crate hamcrest; - use std::fs::{self, File}; use std::io::prelude::*; diff --git a/tests/git.rs b/tests/testsuite/git.rs similarity index 99% rename from tests/git.rs rename to tests/testsuite/git.rs index 3fa90093fe1..13bffe0553c 100644 --- a/tests/git.rs +++ b/tests/testsuite/git.rs @@ -1,8 +1,4 @@ -extern crate cargo; -extern crate cargotest; -extern crate git2; -extern crate hamcrest; - +use git2; use std::fs::{self, File}; use std::io::prelude::*; use std::net::{TcpListener, TcpStream}; diff --git a/tests/init.rs b/tests/testsuite/init.rs similarity index 99% rename from tests/init.rs rename to tests/testsuite/init.rs index c0b3fcd75f2..5aebd1e69a8 100644 --- a/tests/init.rs +++ b/tests/testsuite/init.rs @@ -1,8 +1,4 @@ -extern crate cargotest; -extern crate cargo; -extern crate tempdir; -extern crate hamcrest; - +use cargotest; use std::fs::{self, File}; use std::io::prelude::*; use std::env; diff --git a/tests/install.rs b/tests/testsuite/install.rs similarity index 99% rename from tests/install.rs rename to tests/testsuite/install.rs index 1ae6806c447..c3da7daa090 100644 --- a/tests/install.rs +++ b/tests/testsuite/install.rs @@ -1,7 +1,4 @@ -extern crate cargo; -extern crate cargotest; -extern crate hamcrest; - +use cargotest; use std::fs::{self, File, OpenOptions}; use std::io::prelude::*; diff --git a/tests/jobserver.rs b/tests/testsuite/jobserver.rs similarity index 99% rename from tests/jobserver.rs rename to tests/testsuite/jobserver.rs index 6803f3fbe51..290f9d7ee68 100644 --- a/tests/jobserver.rs +++ b/tests/testsuite/jobserver.rs @@ -1,6 +1,3 @@ -extern crate cargotest; -extern crate hamcrest; - use std::net::TcpListener; use std::thread; use std::process::Command; diff --git a/tests/testsuite/lib.rs b/tests/testsuite/lib.rs new file mode 100644 index 00000000000..6c26e3a2c63 --- /dev/null +++ b/tests/testsuite/lib.rs @@ -0,0 +1,82 @@ +extern crate cargo; +#[macro_use] +extern crate cargotest; +extern crate hamcrest; +extern crate tempdir; +extern crate bufstream; +extern crate git2; +extern crate glob; +extern crate flate2; +extern crate tar; +extern crate libc; +#[cfg(windows)] +extern crate winapi; +#[macro_use] +extern crate serde_derive; +extern crate serde_json; +extern crate toml; +extern crate url; + + +mod alt_registry; +mod bad_config; +mod bad_manifest_path; +mod bench; +mod build_auth; +mod build_lib; +mod build; +mod build_script_env; +mod build_script; +mod cargo_alias_config; +mod cargo_features; +//mod cargo; +mod cfg; +mod check; +mod clean; +mod concurrent; +mod config; +mod cross_compile; +mod cross_publish; +mod death; +mod dep_info; +mod directory; +mod doc; +mod features; +mod fetch; +mod freshness; +mod generate_lockfile; +mod git; +mod init; +mod install; +mod jobserver; +mod local_registry; +mod lockfile_compat; +mod login; +mod metadata; +mod net_config; +mod new; +mod overrides; +mod package; +mod patch; +mod path; +mod plugins; +mod proc_macro; +mod profiles; +mod publish; +mod read_manifest; +mod registry; +mod required_features; +mod resolve; +mod run; +mod rustc; +mod rustdocflags; +mod rustdoc; +mod rustflags; +mod search; +mod small_fd_limits; +mod test; +mod tool_paths; +mod verify_project; +mod version; +mod warn_on_failure; +mod workspaces; diff --git a/tests/local-registry.rs b/tests/testsuite/local_registry.rs similarity index 99% rename from tests/local-registry.rs rename to tests/testsuite/local_registry.rs index 99e529b83ed..6bafed933af 100644 --- a/tests/local-registry.rs +++ b/tests/testsuite/local_registry.rs @@ -1,7 +1,3 @@ -#[macro_use] -extern crate cargotest; -extern crate hamcrest; - use std::fs::{self, File}; use std::io::prelude::*; diff --git a/tests/lockfile-compat.rs b/tests/testsuite/lockfile_compat.rs similarity index 99% rename from tests/lockfile-compat.rs rename to tests/testsuite/lockfile_compat.rs index c8a16aa2ed4..8cf4f789c84 100644 --- a/tests/lockfile-compat.rs +++ b/tests/testsuite/lockfile_compat.rs @@ -1,6 +1,3 @@ -extern crate cargotest; -extern crate hamcrest; - use cargotest::support::git; use cargotest::support::registry::Package; use cargotest::support::{execs, project, lines_match}; diff --git a/tests/login.rs b/tests/testsuite/login.rs similarity index 98% rename from tests/login.rs rename to tests/testsuite/login.rs index a91bf553f9b..ffe8e5c36da 100644 --- a/tests/login.rs +++ b/tests/testsuite/login.rs @@ -1,12 +1,7 @@ -#[macro_use] -extern crate cargotest; -extern crate cargo; -extern crate hamcrest; -extern crate toml; - use std::io::prelude::*; use std::fs::{self, File}; +use toml; use cargotest::{ChannelChanger, cargo_process}; use cargotest::support::execs; use cargotest::support::registry::registry; diff --git a/tests/metadata.rs b/tests/testsuite/metadata.rs similarity index 99% rename from tests/metadata.rs rename to tests/testsuite/metadata.rs index 71c3545ea95..0156c0f3d7b 100644 --- a/tests/metadata.rs +++ b/tests/testsuite/metadata.rs @@ -1,6 +1,3 @@ -extern crate cargotest; -extern crate hamcrest; - use hamcrest::assert_that; use cargotest::support::registry::Package; use cargotest::support::{project, execs, basic_bin_manifest, basic_lib_manifest, main_file}; diff --git a/tests/net-config.rs b/tests/testsuite/net_config.rs similarity index 96% rename from tests/net-config.rs rename to tests/testsuite/net_config.rs index aeaacafc762..37d9f4aaae7 100644 --- a/tests/net-config.rs +++ b/tests/testsuite/net_config.rs @@ -1,6 +1,3 @@ -extern crate cargotest; -extern crate hamcrest; - use cargotest::support::{project, execs}; use hamcrest::assert_that; diff --git a/tests/new.rs b/tests/testsuite/new.rs similarity index 99% rename from tests/new.rs rename to tests/testsuite/new.rs index 46def76c08a..134cc7244f4 100644 --- a/tests/new.rs +++ b/tests/testsuite/new.rs @@ -1,12 +1,8 @@ -extern crate cargo; -extern crate cargotest; -extern crate hamcrest; -extern crate tempdir; - use std::fs::{self, File}; use std::io::prelude::*; use std::env; +use cargotest; use cargo::util::ProcessBuilder; use cargotest::process; use cargotest::support::{execs, paths}; diff --git a/tests/overrides.rs b/tests/testsuite/overrides.rs similarity index 99% rename from tests/overrides.rs rename to tests/testsuite/overrides.rs index afcd94190fb..3a16004a447 100644 --- a/tests/overrides.rs +++ b/tests/testsuite/overrides.rs @@ -1,6 +1,3 @@ -extern crate cargotest; -extern crate hamcrest; - use cargotest::support::git; use cargotest::support::paths; use cargotest::support::registry::Package; diff --git a/tests/package.rs b/tests/testsuite/package.rs similarity index 99% rename from tests/package.rs rename to tests/testsuite/package.rs index d90e76e95a2..9f86a9054db 100644 --- a/tests/package.rs +++ b/tests/testsuite/package.rs @@ -1,14 +1,9 @@ -#[macro_use] -extern crate cargotest; -extern crate flate2; -extern crate git2; -extern crate hamcrest; -extern crate tar; - +use std; use std::fs::File; use std::io::prelude::*; use std::path::{Path, PathBuf}; +use git2; use cargotest::{cargo_process, process, ChannelChanger}; use cargotest::support::{project, execs, paths, git, path2url, cargo_exe, registry}; use cargotest::support::registry::Package; diff --git a/tests/patch.rs b/tests/testsuite/patch.rs similarity index 99% rename from tests/patch.rs rename to tests/testsuite/patch.rs index c7f6bc1abd3..47ca003206f 100644 --- a/tests/patch.rs +++ b/tests/testsuite/patch.rs @@ -1,11 +1,7 @@ -#[macro_use] -extern crate cargotest; -extern crate hamcrest; -extern crate toml; - use std::fs::{self, File}; use std::io::{Read, Write}; +use toml; use cargotest::support::git; use cargotest::support::paths; use cargotest::support::registry::Package; diff --git a/tests/path.rs b/tests/testsuite/path.rs similarity index 99% rename from tests/path.rs rename to tests/testsuite/path.rs index 4936aee17ae..40795fe7500 100644 --- a/tests/path.rs +++ b/tests/testsuite/path.rs @@ -1,12 +1,8 @@ -extern crate cargo; -#[macro_use] -extern crate cargotest; -extern crate hamcrest; - use std::fs::{self, File}; use std::io::prelude::*; use cargo::util::process; +use cargotest; use cargotest::sleep_ms; use cargotest::support::paths::{self, CargoPathExt}; use cargotest::support::{project, execs, main_file}; diff --git a/tests/plugins.rs b/tests/testsuite/plugins.rs similarity index 99% rename from tests/plugins.rs rename to tests/testsuite/plugins.rs index b464b945f62..ac010ddc961 100644 --- a/tests/plugins.rs +++ b/tests/testsuite/plugins.rs @@ -1,6 +1,3 @@ -extern crate cargotest; -extern crate hamcrest; - use std::fs; use std::env; diff --git a/tests/proc-macro.rs b/tests/testsuite/proc_macro.rs similarity index 99% rename from tests/proc-macro.rs rename to tests/testsuite/proc_macro.rs index 953523ac693..eb5c62e14ca 100644 --- a/tests/proc-macro.rs +++ b/tests/testsuite/proc_macro.rs @@ -1,6 +1,3 @@ -extern crate cargotest; -extern crate hamcrest; - use cargotest::is_nightly; use cargotest::support::{project, execs}; use hamcrest::assert_that; diff --git a/tests/profiles.rs b/tests/testsuite/profiles.rs similarity index 99% rename from tests/profiles.rs rename to tests/testsuite/profiles.rs index b051f114736..5f8298752d8 100644 --- a/tests/profiles.rs +++ b/tests/testsuite/profiles.rs @@ -1,6 +1,3 @@ -extern crate cargotest; -extern crate hamcrest; - use std::env; use cargotest::is_nightly; diff --git a/tests/publish.rs b/tests/testsuite/publish.rs similarity index 99% rename from tests/publish.rs rename to tests/testsuite/publish.rs index 334ade2271c..38e3b06ecf0 100644 --- a/tests/publish.rs +++ b/tests/testsuite/publish.rs @@ -1,8 +1,3 @@ -extern crate cargotest; -extern crate flate2; -extern crate hamcrest; -extern crate tar; - use std::io::prelude::*; use std::fs::{self, File}; use std::io::SeekFrom; diff --git a/tests/read-manifest.rs b/tests/testsuite/read_manifest.rs similarity index 98% rename from tests/read-manifest.rs rename to tests/testsuite/read_manifest.rs index 41ed1420468..010b5bfbcbd 100644 --- a/tests/read-manifest.rs +++ b/tests/testsuite/read_manifest.rs @@ -1,6 +1,3 @@ -extern crate cargotest; -extern crate hamcrest; - use cargotest::support::{project, execs, main_file, basic_bin_manifest}; use hamcrest::{assert_that}; diff --git a/tests/registry.rs b/tests/testsuite/registry.rs similarity index 99% rename from tests/registry.rs rename to tests/testsuite/registry.rs index a5de44f53d5..ddf352865ee 100644 --- a/tests/registry.rs +++ b/tests/testsuite/registry.rs @@ -1,8 +1,3 @@ -#[macro_use] -extern crate cargotest; -extern crate hamcrest; -extern crate url; - use std::fs::{self, File}; use std::io::prelude::*; use std::path::PathBuf; diff --git a/tests/required-features.rs b/tests/testsuite/required_features.rs similarity index 99% rename from tests/required-features.rs rename to tests/testsuite/required_features.rs index 233f7f6f501..c99ff6a5cea 100644 --- a/tests/required-features.rs +++ b/tests/testsuite/required_features.rs @@ -1,6 +1,3 @@ -extern crate cargotest; -extern crate hamcrest; - use cargotest::is_nightly; use cargotest::install::{cargo_home, has_installed_exe}; use cargotest::support::{project, execs}; diff --git a/tests/resolve.rs b/tests/testsuite/resolve.rs similarity index 99% rename from tests/resolve.rs rename to tests/testsuite/resolve.rs index 42a67dd37d0..7d6bc4139ea 100644 --- a/tests/resolve.rs +++ b/tests/testsuite/resolve.rs @@ -1,8 +1,5 @@ #![deny(warnings)] -extern crate hamcrest; -extern crate cargo; - use std::collections::BTreeMap; use hamcrest::{assert_that, equal_to, contains, not}; diff --git a/tests/run.rs b/tests/testsuite/run.rs similarity index 99% rename from tests/run.rs rename to tests/testsuite/run.rs index 96a7bb02ded..793ade04487 100644 --- a/tests/run.rs +++ b/tests/testsuite/run.rs @@ -1,7 +1,3 @@ -extern crate cargo; -extern crate cargotest; -extern crate hamcrest; - use cargo::util::paths::dylib_path_envvar; use cargotest::support::{project, execs, path2url}; use hamcrest::{assert_that, existing_file}; diff --git a/tests/rustc.rs b/tests/testsuite/rustc.rs similarity index 99% rename from tests/rustc.rs rename to tests/testsuite/rustc.rs index da6aced7598..7cc037c2569 100644 --- a/tests/rustc.rs +++ b/tests/testsuite/rustc.rs @@ -1,6 +1,3 @@ -extern crate cargotest; -extern crate hamcrest; - use cargotest::support::{execs, project}; use hamcrest::assert_that; diff --git a/tests/rustdoc.rs b/tests/testsuite/rustdoc.rs similarity index 99% rename from tests/rustdoc.rs rename to tests/testsuite/rustdoc.rs index 570ce6ad8fd..2e5224f3b12 100644 --- a/tests/rustdoc.rs +++ b/tests/testsuite/rustdoc.rs @@ -1,6 +1,3 @@ -extern crate cargotest; -extern crate hamcrest; - use cargotest::support::{execs, project}; use hamcrest::{assert_that}; diff --git a/tests/rustdocflags.rs b/tests/testsuite/rustdocflags.rs similarity index 98% rename from tests/rustdocflags.rs rename to tests/testsuite/rustdocflags.rs index 19c4964263f..dc379ad42db 100644 --- a/tests/rustdocflags.rs +++ b/tests/testsuite/rustdocflags.rs @@ -1,6 +1,3 @@ -extern crate cargotest; -extern crate hamcrest; - use cargotest::support::{project, execs}; use hamcrest::assert_that; diff --git a/tests/rustflags.rs b/tests/testsuite/rustflags.rs similarity index 99% rename from tests/rustflags.rs rename to tests/testsuite/rustflags.rs index ff8fe0aac9a..05e6c0b64c1 100644 --- a/tests/rustflags.rs +++ b/tests/testsuite/rustflags.rs @@ -1,6 +1,3 @@ -extern crate cargotest; -extern crate hamcrest; - use std::io::Write; use std::fs::{self, File}; diff --git a/tests/search.rs b/tests/testsuite/search.rs similarity index 99% rename from tests/search.rs rename to tests/testsuite/search.rs index 4b407739c94..70e00f9cbfe 100644 --- a/tests/search.rs +++ b/tests/testsuite/search.rs @@ -1,13 +1,9 @@ -extern crate cargo; -extern crate cargotest; -extern crate hamcrest; -extern crate url; - use std::fs::{self, File}; use std::io::prelude::*; use std::path::PathBuf; use cargo::util::ProcessBuilder; +use cargotest; use cargotest::support::execs; use cargotest::support::git::repo; use cargotest::support::paths; diff --git a/tests/small-fd-limits.rs b/tests/testsuite/small_fd_limits.rs similarity index 97% rename from tests/small-fd-limits.rs rename to tests/testsuite/small_fd_limits.rs index e997f76fd89..53a2dae8c07 100644 --- a/tests/small-fd-limits.rs +++ b/tests/testsuite/small_fd_limits.rs @@ -1,13 +1,9 @@ -extern crate cargotest; -extern crate git2; -extern crate hamcrest; -extern crate url; - use std::env; use std::ffi::OsStr; use std::path::PathBuf; use std::process::Command; +use git2; use cargotest::support::{execs, project}; use cargotest::support::registry::Package; use cargotest::support::paths; diff --git a/tests/test.rs b/tests/testsuite/test.rs similarity index 99% rename from tests/test.rs rename to tests/testsuite/test.rs index 2a454f043c4..914a06d310a 100644 --- a/tests/test.rs +++ b/tests/testsuite/test.rs @@ -1,11 +1,8 @@ -extern crate cargo; -extern crate cargotest; -extern crate hamcrest; - use std::fs::File; use std::io::prelude::*; use std::str; +use cargo; use cargotest::{sleep_ms, is_nightly, rustc_host}; use cargotest::support::{project, execs, basic_bin_manifest, basic_lib_manifest, cargo_exe}; use cargotest::support::paths::CargoPathExt; diff --git a/tests/tool-paths.rs b/tests/testsuite/tool_paths.rs similarity index 99% rename from tests/tool-paths.rs rename to tests/testsuite/tool_paths.rs index 0d3b5d299ce..f76790ae1c5 100644 --- a/tests/tool-paths.rs +++ b/tests/testsuite/tool_paths.rs @@ -1,6 +1,3 @@ -extern crate cargotest; -extern crate hamcrest; - use cargotest::rustc_host; use cargotest::support::{path2url, project, execs}; use hamcrest::assert_that; diff --git a/tests/verify-project.rs b/tests/testsuite/verify_project.rs similarity index 97% rename from tests/verify-project.rs rename to tests/testsuite/verify_project.rs index 509367ad8c8..ef99f5fc11a 100644 --- a/tests/verify-project.rs +++ b/tests/testsuite/verify_project.rs @@ -1,6 +1,3 @@ -extern crate cargotest; -extern crate hamcrest; - use cargotest::support::{project, execs, main_file, basic_bin_manifest}; use hamcrest::{assert_that}; diff --git a/tests/version.rs b/tests/testsuite/version.rs similarity index 94% rename from tests/version.rs rename to tests/testsuite/version.rs index a63d8700bd4..d9868f222d5 100644 --- a/tests/version.rs +++ b/tests/testsuite/version.rs @@ -1,7 +1,4 @@ -extern crate cargo; -extern crate cargotest; -extern crate hamcrest; - +use cargo; use cargotest::support::{project, execs}; use hamcrest::assert_that; diff --git a/tests/warn-on-failure.rs b/tests/testsuite/warn_on_failure.rs similarity index 98% rename from tests/warn-on-failure.rs rename to tests/testsuite/warn_on_failure.rs index bbd418df609..e6d2a61dba9 100644 --- a/tests/warn-on-failure.rs +++ b/tests/testsuite/warn_on_failure.rs @@ -1,6 +1,3 @@ -extern crate cargotest; -extern crate hamcrest; - use cargotest::support::{project, execs, Project}; use cargotest::support::registry::Package; use hamcrest::assert_that; diff --git a/tests/workspaces.rs b/tests/testsuite/workspaces.rs similarity index 99% rename from tests/workspaces.rs rename to tests/testsuite/workspaces.rs index 77df9744891..1d2bf33fc87 100644 --- a/tests/workspaces.rs +++ b/tests/testsuite/workspaces.rs @@ -1,7 +1,3 @@ -#[macro_use] -extern crate cargotest; -extern crate hamcrest; - use std::env; use std::fs::{self, File}; use std::io::{Read, Write}; From 8ef945666cd53b7b2a446c8a099a14837b470387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Rocha?= Date: Thu, 8 Feb 2018 17:30:58 +0100 Subject: [PATCH 2/2] Adding cargo.rs file tests as cargo_command.rs. --- tests/testsuite/{cargo.rs => cargo_command.rs} | 1 + tests/testsuite/lib.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) rename tests/testsuite/{cargo.rs => cargo_command.rs} (99%) diff --git a/tests/testsuite/cargo.rs b/tests/testsuite/cargo_command.rs similarity index 99% rename from tests/testsuite/cargo.rs rename to tests/testsuite/cargo_command.rs index d33a2b2a607..e6c26cc3505 100644 --- a/tests/testsuite/cargo.rs +++ b/tests/testsuite/cargo_command.rs @@ -4,6 +4,7 @@ use std::io::prelude::*; use std::path::{Path, PathBuf}; use std::str; +use cargo; use cargotest::cargo_process; use cargotest::support::paths::{self, CargoPathExt}; use cargotest::support::{execs, project, Project, basic_bin_manifest}; diff --git a/tests/testsuite/lib.rs b/tests/testsuite/lib.rs index 6c26e3a2c63..3a2e33b11b6 100644 --- a/tests/testsuite/lib.rs +++ b/tests/testsuite/lib.rs @@ -29,7 +29,7 @@ mod build_script_env; mod build_script; mod cargo_alias_config; mod cargo_features; -//mod cargo; +mod cargo_command; mod cfg; mod check; mod clean;