mirror of https://github.com/rust-lang/cargo
Extract resolver tests to their own crate
These tests take a good amount of time to run locally and they're also causing a lot of dependencies to get pulled into rust-lang/rust, so let's have a separate crate that we just test on our own CI
This commit is contained in:
parent
e449cb23e3
commit
290a727ad0
|
@ -1,5 +1,4 @@
|
|||
/target
|
||||
/tests/testsuite/support/cargo-test-macro/target
|
||||
target
|
||||
Cargo.lock
|
||||
.cargo
|
||||
/config.stamp
|
||||
|
|
|
@ -42,6 +42,13 @@ matrix:
|
|||
- (cd src/doc && mdbook build --dest-dir ../../target/doc) || travis_terminate 1
|
||||
if: branch != master OR type = pull_request
|
||||
|
||||
- name: resolver tests
|
||||
rust: stable
|
||||
before_script: true
|
||||
script:
|
||||
- cargo test --manifest-path crates/resolver-tests/Cargo.toml
|
||||
if: branch != master OR type = pull_request
|
||||
|
||||
exclude:
|
||||
- rust: stable
|
||||
|
||||
|
|
|
@ -102,9 +102,7 @@ features = [
|
|||
|
||||
[dev-dependencies]
|
||||
bufstream = "0.1"
|
||||
proptest = "0.9.1"
|
||||
varisat = "0.2.1"
|
||||
cargo-test-macro = { "path" = "tests/testsuite/support/cargo-test-macro", version = "0.1.0" }
|
||||
cargo-test-macro = { path = "crates/cargo-test-macro", version = "0.1.0" }
|
||||
|
||||
[[bin]]
|
||||
name = "cargo"
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
[package]
|
||||
name = "resolver-tests"
|
||||
version = "0.1.0"
|
||||
authors = ["Alex Crichton <alex@alexcrichton.com>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
cargo = { path = "../.." }
|
||||
proptest = "0.9.1"
|
||||
lazy_static = "1.3.0"
|
||||
varisat = "0.2.1"
|
||||
atty = "0.2.11"
|
|
@ -4,8 +4,6 @@ use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
|
|||
use std::fmt;
|
||||
use std::time::Instant;
|
||||
|
||||
use crate::support::slow_cpu_multiplier;
|
||||
|
||||
use cargo::core::dependency::Kind;
|
||||
use cargo::core::resolver::{self, Method};
|
||||
use cargo::core::source::{GitReference, SourceId};
|
||||
|
@ -16,9 +14,7 @@ use cargo::util::{CargoResult, Config, Graph, ToUrl};
|
|||
use proptest::collection::{btree_map, vec};
|
||||
use proptest::prelude::*;
|
||||
use proptest::sample::Index;
|
||||
use proptest::strategy::ValueTree;
|
||||
use proptest::string::string_regex;
|
||||
use proptest::test_runner::TestRunner;
|
||||
use varisat::{self, ExtendFormula};
|
||||
|
||||
pub fn resolve(
|
||||
|
@ -182,7 +178,7 @@ pub fn resolve_with_config_raw(
|
|||
|
||||
// The largest test in our suite takes less then 30 sec.
|
||||
// So lets fail the test if we have ben running for two long.
|
||||
assert!(start.elapsed() < slow_cpu_multiplier(60));
|
||||
assert!(start.elapsed().as_secs() < 60);
|
||||
resolve
|
||||
}
|
||||
|
||||
|
@ -493,14 +489,15 @@ impl<T: AsRef<str>, U: AsRef<str>> ToPkgId for (T, U) {
|
|||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! pkg {
|
||||
($pkgid:expr => [$($deps:expr),+ $(,)* ]) => ({
|
||||
let d: Vec<Dependency> = vec![$($deps.to_dep()),+];
|
||||
pkg_dep($pkgid, d)
|
||||
$crate::pkg_dep($pkgid, d)
|
||||
});
|
||||
|
||||
($pkgid:expr) => ({
|
||||
pkg($pkgid)
|
||||
$crate::pkg($pkgid)
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -663,7 +660,7 @@ impl fmt::Debug for PrettyPrintRegistry {
|
|||
}
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
#[test]
|
||||
fn meta_test_deep_pretty_print_registry() {
|
||||
assert_eq!(
|
||||
&format!(
|
||||
|
@ -839,8 +836,11 @@ pub fn registry_strategy(
|
|||
|
||||
/// This test is to test the generator to ensure
|
||||
/// that it makes registries with large dependency trees
|
||||
#[cargo_test]
|
||||
#[test]
|
||||
fn meta_test_deep_trees_from_strategy() {
|
||||
use proptest::strategy::ValueTree;
|
||||
use proptest::test_runner::TestRunner;
|
||||
|
||||
let mut dis = [0; 21];
|
||||
|
||||
let strategy = registry_strategy(50, 20, 60);
|
||||
|
@ -878,8 +878,11 @@ fn meta_test_deep_trees_from_strategy() {
|
|||
|
||||
/// This test is to test the generator to ensure
|
||||
/// that it makes registries that include multiple versions of the same library
|
||||
#[cargo_test]
|
||||
#[test]
|
||||
fn meta_test_multiple_versions_strategy() {
|
||||
use proptest::strategy::ValueTree;
|
||||
use proptest::test_runner::TestRunner;
|
||||
|
||||
let mut dis = [0; 10];
|
||||
|
||||
let strategy = registry_strategy(50, 20, 60);
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -139,8 +139,6 @@ pub mod git;
|
|||
pub mod paths;
|
||||
pub mod publish;
|
||||
pub mod registry;
|
||||
#[macro_use]
|
||||
pub mod resolver;
|
||||
|
||||
/*
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue