Skip to content

Commit

Permalink
Shared the test suite into multiple binaries
Browse files Browse the repository at this point in the history
Compiling everything in one binary was getting annoying as it just took forever
to build, instead shard it all up so we can build just particular test suites at
a time.
  • Loading branch information
alexcrichton committed May 26, 2016
1 parent 6950bbb commit 0151deb
Show file tree
Hide file tree
Showing 53 changed files with 513 additions and 351 deletions.
22 changes: 22 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,9 @@ winapi = "0.2"
hamcrest = "0.1"
bufstream = "0.1"
filetime = "0.1"
cargotest = { path = "tests/cargotest" }

[[bin]]
name = "cargo"
test = false
doc = false

[[test]]
name = "tests"

[[test]]
name = "resolve"
7 changes: 5 additions & 2 deletions tests/test_bad_config.rs → tests/bad-config.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use support::{project, execs};
use support::registry::Package;
extern crate cargotest;
extern crate hamcrest;

use cargotest::support::{project, execs};
use cargotest::support::registry::Package;
use hamcrest::assert_that;

#[test]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use support::{project, execs, main_file, basic_bin_manifest};
extern crate hamcrest;
extern crate cargotest;

use cargotest::support::{project, execs, main_file, basic_bin_manifest};
use hamcrest::{assert_that};

fn assert_not_a_cargo_toml(command: &str, manifest_path_argument: &str) {
Expand Down
53 changes: 29 additions & 24 deletions tests/test_cargo_bench.rs → tests/bench.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
extern crate cargotest;
extern crate cargo;
extern crate hamcrest;

use std::str;

use support::{project, execs, basic_bin_manifest, basic_lib_manifest};
use support::paths::CargoPathExt;
use hamcrest::{assert_that, existing_file};
use cargo::util::process;
use cargotest::is_nightly;
use cargotest::support::paths::CargoPathExt;
use cargotest::support::{project, execs, basic_bin_manifest, basic_lib_manifest};
use hamcrest::{assert_that, existing_file};

#[test]
fn cargo_bench_simple() {
if !::is_nightly() { return }
if !is_nightly() { return }

let p = project("foo")
.file("Cargo.toml", &basic_bin_manifest("foo"))
Expand Down Expand Up @@ -49,7 +54,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured

#[test]
fn bench_tarname() {
if !::is_nightly() { return }
if !is_nightly() { return }

let prj = project("foo")
.file("Cargo.toml" , r#"
Expand Down Expand Up @@ -84,7 +89,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured

#[test]
fn cargo_bench_verbose() {
if !::is_nightly() { return }
if !is_nightly() { return }

let p = project("foo")
.file("Cargo.toml", &basic_bin_manifest("foo"))
Expand All @@ -111,7 +116,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured

#[test]
fn many_similar_names() {
if !::is_nightly() { return }
if !is_nightly() { return }

let p = project("foo")
.file("Cargo.toml", r#"
Expand Down Expand Up @@ -149,7 +154,7 @@ fn many_similar_names() {

#[test]
fn cargo_bench_failing_test() {
if !::is_nightly() { return }
if !is_nightly() { return }

let p = project("foo")
.file("Cargo.toml", &basic_bin_manifest("foo"))
Expand Down Expand Up @@ -192,7 +197,7 @@ thread '<main>' panicked at 'assertion failed: \

#[test]
fn bench_with_lib_dep() {
if !::is_nightly() { return }
if !is_nightly() { return }

let p = project("foo")
.file("Cargo.toml", r#"
Expand Down Expand Up @@ -252,7 +257,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured

#[test]
fn bench_with_deep_lib_dep() {
if !::is_nightly() { return }
if !is_nightly() { return }

let p = project("bar")
.file("Cargo.toml", r#"
Expand Down Expand Up @@ -308,7 +313,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured

#[test]
fn external_bench_explicit() {
if !::is_nightly() { return }
if !is_nightly() { return }

let p = project("foo")
.file("Cargo.toml", r#"
Expand Down Expand Up @@ -360,7 +365,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured

#[test]
fn external_bench_implicit() {
if !::is_nightly() { return }
if !is_nightly() { return }

let p = project("foo")
.file("Cargo.toml", r#"
Expand Down Expand Up @@ -409,7 +414,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured

#[test]
fn dont_run_examples() {
if !::is_nightly() { return }
if !is_nightly() { return }

let p = project("foo")
.file("Cargo.toml", r#"
Expand All @@ -429,7 +434,7 @@ fn dont_run_examples() {

#[test]
fn pass_through_command_line() {
if !::is_nightly() { return }
if !is_nightly() { return }

let p = project("foo")
.file("Cargo.toml", r#"
Expand Down Expand Up @@ -476,7 +481,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
// tests in an rlib
#[test]
fn cargo_bench_twice() {
if !::is_nightly() { return }
if !is_nightly() { return }

let p = project("test_twice")
.file("Cargo.toml", &basic_lib_manifest("test_twice"))
Expand All @@ -500,7 +505,7 @@ fn cargo_bench_twice() {

#[test]
fn lib_bin_same_name() {
if !::is_nightly() { return }
if !is_nightly() { return }

let p = project("foo")
.file("Cargo.toml", r#"
Expand Down Expand Up @@ -550,7 +555,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured

#[test]
fn lib_with_standard_name() {
if !::is_nightly() { return }
if !is_nightly() { return }

let p = project("foo")
.file("Cargo.toml", r#"
Expand Down Expand Up @@ -603,7 +608,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured

#[test]
fn lib_with_standard_name2() {
if !::is_nightly() { return }
if !is_nightly() { return }

let p = project("foo")
.file("Cargo.toml", r#"
Expand Down Expand Up @@ -647,7 +652,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured

#[test]
fn bench_dylib() {
if !::is_nightly() { return }
if !is_nightly() { return }

let p = project("foo")
.file("Cargo.toml", r#"
Expand Down Expand Up @@ -744,7 +749,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured

#[test]
fn bench_twice_with_build_cmd() {
if !::is_nightly() { return }
if !is_nightly() { return }

let p = project("foo")
.file("Cargo.toml", r#"
Expand Down Expand Up @@ -790,7 +795,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured

#[test]
fn bench_with_examples() {
if !::is_nightly() { return }
if !is_nightly() { return }

let p = project("testbench")
.file("Cargo.toml", r#"
Expand Down Expand Up @@ -870,7 +875,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured

#[test]
fn test_a_bench() {
if !::is_nightly() { return }
if !is_nightly() { return }

let p = project("foo")
.file("Cargo.toml", r#"
Expand Down Expand Up @@ -910,7 +915,7 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured

#[test]
fn test_bench_no_run() {
if !::is_nightly() { return }
if !is_nightly() { return }

let p = project("foo")
.file("Cargo.toml", r#"
Expand Down Expand Up @@ -940,7 +945,7 @@ fn test_bench_no_run() {

#[test]
fn test_bench_multiple_packages() {
if !::is_nightly() { return }
if !is_nightly() { return }

let p = project("foo")
.file("Cargo.toml", r#"
Expand Down
11 changes: 7 additions & 4 deletions tests/test_cargo_build_auth.rs → tests/build-auth.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
extern crate bufstream;
extern crate git2;
extern crate cargotest;
extern crate hamcrest;

use std::collections::HashSet;
use std::io::prelude::*;
use std::net::TcpListener;
use std::thread;

use bufstream::BufStream;
use git2;

use support::{project, execs};
use support::paths;
use cargotest::support::paths;
use cargotest::support::{project, execs};
use hamcrest::assert_that;

// Test that HTTP auth is offered from `credential.helper`
Expand Down
6 changes: 5 additions & 1 deletion tests/test_cargo_build_lib.rs → tests/build-lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
extern crate cargotest;
extern crate hamcrest;

use std::path::MAIN_SEPARATOR as SEP;
use support::{basic_bin_manifest, execs, project, ProjectBuilder};

use cargotest::support::{basic_bin_manifest, execs, project, ProjectBuilder};
use hamcrest::{assert_that};

fn verbose_output_for_lib(p: &ProjectBuilder) -> String {
Expand Down
Loading

0 comments on commit 0151deb

Please sign in to comment.