mirror of
https://github.com/rust-lang/cargo
synced 2024-09-13 21:11:44 +00:00
Fold cargotest into testsuite
Now that there's only one crate with integration tests there's no need to have this be a separate crate, yay!
This commit is contained in:
parent
f55b326e1f
commit
de70bc01db
|
@ -80,7 +80,6 @@ features = [
|
|||
|
||||
[dev-dependencies]
|
||||
bufstream = "0.1"
|
||||
cargotest = { path = "tests/testsuite/cargotest", version = "0.1" }
|
||||
filetime = "0.1"
|
||||
hamcrest = "=0.1.1"
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use cargotest::support::{basic_bin_manifest, execs, project, Project};
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
[package]
|
||||
name = "cargotest"
|
||||
version = "0.1.0"
|
||||
authors = ["Alex Crichton <alex@alexcrichton.com>"]
|
||||
|
||||
[lib]
|
||||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
cargo = { path = "../../.." }
|
||||
filetime = "0.1"
|
||||
flate2 = "1.0"
|
||||
git2 = { version = "0.7", default-features = false }
|
||||
hamcrest = "=0.1.1"
|
||||
hex = "0.3"
|
||||
log = "0.4"
|
||||
serde_json = "1.0"
|
||||
tar = { version = "0.4", default-features = false }
|
||||
url = "1.1"
|
|
@ -2,7 +2,8 @@ use std::fmt;
|
|||
use std::path::{PathBuf, Path};
|
||||
|
||||
use hamcrest::{Matcher, MatchResult, existing_file};
|
||||
use support::paths;
|
||||
|
||||
use cargotest::support::paths;
|
||||
|
||||
pub use self::InstalledExe as has_installed_exe;
|
||||
|
||||
|
|
|
@ -1,23 +1,13 @@
|
|||
#![deny(warnings)]
|
||||
|
||||
extern crate cargo;
|
||||
extern crate filetime;
|
||||
extern crate flate2;
|
||||
extern crate git2;
|
||||
extern crate hamcrest;
|
||||
extern crate hex;
|
||||
#[macro_use]
|
||||
extern crate serde_json;
|
||||
extern crate tar;
|
||||
extern crate url;
|
||||
|
||||
use std::ffi::OsStr;
|
||||
use std::time::Duration;
|
||||
|
||||
use cargo::util::Rustc;
|
||||
use cargo;
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[macro_use]
|
||||
pub mod support;
|
||||
|
||||
pub mod install;
|
||||
|
||||
thread_local!(pub static RUSTC: Rustc = Rustc::new(PathBuf::from("rustc"), None).unwrap());
|
||||
|
@ -95,5 +85,5 @@ pub fn cargo_process() -> cargo::util::ProcessBuilder {
|
|||
}
|
||||
|
||||
pub fn sleep_ms(ms: u64) {
|
||||
std::thread::sleep(Duration::from_millis(ms));
|
||||
::std::thread::sleep(Duration::from_millis(ms));
|
||||
}
|
|
@ -3,7 +3,7 @@ use std::process::Command;
|
|||
use std::sync::{Once, ONCE_INIT};
|
||||
use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering};
|
||||
|
||||
use support::{project, main_file, basic_bin_manifest};
|
||||
use cargotest::support::{project, main_file, basic_bin_manifest};
|
||||
|
||||
pub fn disabled() -> bool {
|
||||
// First, disable if ./configure requested so
|
||||
|
|
|
@ -2,11 +2,11 @@ use std::fs::{self, File};
|
|||
use std::io::prelude::*;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use url::Url;
|
||||
use git2;
|
||||
|
||||
use cargo::util::ProcessError;
|
||||
use support::{ProjectBuilder, Project, project, path2url};
|
||||
use git2;
|
||||
use url::Url;
|
||||
|
||||
use cargotest::support::{ProjectBuilder, Project, project, path2url};
|
||||
|
||||
#[must_use]
|
||||
pub struct RepoBuilder {
|
||||
|
|
|
@ -15,9 +15,8 @@ use hamcrest as ham;
|
|||
use cargo::util::ProcessBuilder;
|
||||
use cargo::util::{ProcessError};
|
||||
|
||||
use support::paths::CargoPathExt;
|
||||
use cargotest::support::paths::CargoPathExt;
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! t {
|
||||
($e:expr) => (match $e {
|
||||
Ok(e) => e,
|
||||
|
@ -110,10 +109,6 @@ impl ProjectBuilder {
|
|||
self.root.root()
|
||||
}
|
||||
|
||||
pub fn build_dir(&self) -> PathBuf {
|
||||
self.root.build_dir()
|
||||
}
|
||||
|
||||
pub fn target_debug_dir(&self) -> PathBuf {
|
||||
self.root.target_debug_dir()
|
||||
}
|
||||
|
@ -218,7 +213,7 @@ impl Project {
|
|||
}
|
||||
|
||||
pub fn process<T: AsRef<OsStr>>(&self, program: T) -> ProcessBuilder {
|
||||
let mut p = ::process(program);
|
||||
let mut p = ::cargotest::process(program);
|
||||
p.cwd(self.root());
|
||||
return p
|
||||
}
|
||||
|
@ -406,11 +401,6 @@ impl Execs {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn with_neither_contains<S: ToString>(mut self, expected: S) -> Execs {
|
||||
self.expect_neither_contains.push(expected.to_string());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_json(mut self, expected: &str) -> Execs {
|
||||
self.expect_json = Some(expected.split("\n\n").map(|obj| {
|
||||
obj.parse().unwrap()
|
||||
|
@ -803,31 +793,6 @@ pub fn execs() -> Execs {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ShellWrites {
|
||||
expected: String
|
||||
}
|
||||
|
||||
impl fmt::Display for ShellWrites {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "`{}` written to the shell", self.expected)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ham::Matcher<&'a [u8]> for ShellWrites {
|
||||
fn matches(&self, actual: &[u8])
|
||||
-> ham::MatchResult
|
||||
{
|
||||
let actual = String::from_utf8_lossy(actual);
|
||||
let actual = actual.to_string();
|
||||
ham::expect(actual == self.expected, actual)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn shell_writes<T: fmt::Display>(string: T) -> ShellWrites {
|
||||
ShellWrites { expected: string.to_string() }
|
||||
}
|
||||
|
||||
pub trait Tap {
|
||||
fn tap<F: FnOnce(&mut Self)>(self, callback: F) -> Self;
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@ use std::path::PathBuf;
|
|||
use std::io::prelude::*;
|
||||
use std::fs::{self, File};
|
||||
|
||||
use support::paths;
|
||||
use support::git::{repo, Repository};
|
||||
use cargotest::support::paths;
|
||||
use cargotest::support::git::{repo, Repository};
|
||||
|
||||
use url::Url;
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ use std::fs::{self, File};
|
|||
use std::io::prelude::*;
|
||||
use std::path::{PathBuf, Path};
|
||||
|
||||
use cargo::util::Sha256;
|
||||
use flate2::Compression;
|
||||
use flate2::write::GzEncoder;
|
||||
use git2;
|
||||
|
@ -10,9 +11,8 @@ use hex;
|
|||
use tar::{Builder, Header};
|
||||
use url::Url;
|
||||
|
||||
use support::paths;
|
||||
use support::git::repo;
|
||||
use cargo::util::Sha256;
|
||||
use cargotest::support::paths;
|
||||
use cargotest::support::git::repo;
|
||||
|
||||
pub fn registry_path() -> PathBuf { paths::root().join("registry") }
|
||||
pub fn registry() -> Url { Url::from_file_path(&*registry_path()).ok().unwrap() }
|
||||
|
|
|
@ -1,22 +1,25 @@
|
|||
extern crate cargo;
|
||||
#[macro_use]
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
extern crate tempdir;
|
||||
extern crate bufstream;
|
||||
extern crate cargo;
|
||||
extern crate filetime;
|
||||
extern crate flate2;
|
||||
extern crate git2;
|
||||
extern crate glob;
|
||||
extern crate flate2;
|
||||
extern crate tar;
|
||||
extern crate hamcrest;
|
||||
extern crate hex;
|
||||
extern crate libc;
|
||||
#[cfg(windows)]
|
||||
extern crate winapi;
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
#[macro_use]
|
||||
extern crate serde_json;
|
||||
extern crate tar;
|
||||
extern crate tempdir;
|
||||
extern crate toml;
|
||||
extern crate url;
|
||||
#[cfg(windows)]
|
||||
extern crate winapi;
|
||||
|
||||
#[macro_use]
|
||||
mod cargotest;
|
||||
|
||||
mod alt_registry;
|
||||
mod bad_config;
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
extern crate cargo;
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use cargotest::support::{project, execs};
|
||||
|
|
Loading…
Reference in a new issue