Skip to content

Commit

Permalink
Merge pull request #1405 from rust-ndarray/test-workspace
Browse files Browse the repository at this point in the history
Organize the workspace of test crates a bit better
  • Loading branch information
bluss authored Aug 1, 2024
2 parents a091a12 + f4e424a commit ec0ffa6
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 22 deletions.
13 changes: 12 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,18 @@ opt-level = 2
opt-level = 2

[workspace]
members = ["ndarray-rand", "xtest-serialization", "xtest-blas", "xtest-numeric"]
members = [
"ndarray-rand",
"extra-tests/serialization",
"extra-tests/blas",
"extra-tests/numeric",
]

[workspace.dependencies]
ndarray = { path = "." }
num-traits = { version = "0.2", default-features = false }
num-complex = { version = "0.4", default-features = false }
ndarray-rand = { path = "./ndarray-rand" }

[package.metadata.release]
no-dev-version = true
Expand Down
5 changes: 5 additions & 0 deletions extra-tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

# Extra Tests

These are test crates whose settings, features and dependencies should be
separate from the main crate.
6 changes: 3 additions & 3 deletions xtest-blas/Cargo.toml → extra-tests/blas/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ test = false
[dev-dependencies]
approx = "0.5"
defmac = "0.2"
num-traits = "0.2"
num-complex = { version = "0.4", default-features = false }
num-traits = { workspace = true }
num-complex = { workspace = true }

[dependencies]
ndarray = { path = "..", features = ["approx", "blas"] }
ndarray = { workspace = true, features = ["approx"] }

blas-src = { version = "0.10", optional = true }

Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions xtest-numeric/Cargo.toml → extra-tests/numeric/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ edition = "2018"

[dependencies]
approx = "0.5"
ndarray = { path = "..", features = ["approx"] }
ndarray-rand = { path = "../ndarray-rand" }
ndarray = { workspace = true, features = ["approx"] }
ndarray-rand = { workspace = true }
rand_distr = "0.4"

blas-src = { optional = true, version = "0.10", default-features = false, features = ["openblas"] }
Expand All @@ -19,8 +19,8 @@ version = "0.8.0"
features = ["small_rng"]

[dev-dependencies]
num-traits = { version = "0.2.14", default-features = false }
num-complex = { version = "0.4", default-features = false }
num-traits = { workspace = true }
num-complex = { workspace = true }

[lib]
test = false
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ fn random_matrix_mul<A>(
) -> (Array2<A>, Array2<A>)
where A: LinalgScalar
{
let m = rng.gen_range(15..512);
let k = rng.gen_range(15..512);
let n = rng.gen_range(15..1560);
let m = rng.gen_range(15..128);
let k = rng.gen_range(15..128);
let n = rng.gen_range(15..512);
let a = generator(Ix2(m, k), rng);
let b = generator(Ix2(n, k), rng);
let c = if use_general {
Expand Down Expand Up @@ -261,7 +261,7 @@ fn accurate_mul_with_column_f64()
// pick a few random sizes
let rng = &mut SmallRng::from_entropy();
for i in 0..10 {
let m = rng.gen_range(1..350);
let m = rng.gen_range(1..128);
let k = rng.gen_range(1..350);
let a = gen::<f64, _>(Ix2(m, k), rng);
let b_owner = gen::<f64, _>(Ix2(k, k), rng);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ edition = "2018"
test = false

[dependencies]
ndarray = { path = "..", features = ["serde"] }
ndarray = { workspace = true, features = ["serde"] }

[features]
default = ["ron"]
Expand Down
File renamed without changes.
File renamed without changes.
14 changes: 8 additions & 6 deletions scripts/all-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ cargo test --verbose --no-default-features
cargo test --release --verbose --no-default-features
cargo build --verbose --features "$FEATURES"
cargo test --verbose --features "$FEATURES"
cargo test --manifest-path=ndarray-rand/Cargo.toml --no-default-features --verbose
cargo test --manifest-path=ndarray-rand/Cargo.toml --features quickcheck --verbose
cargo test --manifest-path=xtest-serialization/Cargo.toml --verbose
cargo test --manifest-path=xtest-blas/Cargo.toml --verbose --features openblas-system
cargo test -p ndarray-rand --no-default-features --verbose
cargo test -p ndarray-rand --features ndarray-rand/quickcheck --verbose

cargo test -p serialization-tests -v
cargo test -p blas-tests -v --features blas-tests/openblas-system
cargo test -p numeric-tests -v
cargo test -p numeric-tests -v --features numeric-tests/test_blas

cargo test --examples
cargo test --manifest-path=xtest-numeric/Cargo.toml --verbose
cargo test --manifest-path=xtest-numeric/Cargo.toml --verbose --features test_blas
([ "$CHANNEL" != "nightly" ] || cargo bench --no-run --verbose --features "$FEATURES")
6 changes: 3 additions & 3 deletions scripts/cross-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ TARGET=$3

cross build -v --features="$FEATURES" --target=$TARGET
cross test -v --no-fail-fast --features="$FEATURES" --target=$TARGET
cross test -v --no-fail-fast --target=$TARGET --manifest-path=ndarray-rand/Cargo.toml --features quickcheck
cross test -v --no-fail-fast --target=$TARGET --manifest-path=xtest-serialization/Cargo.toml --verbose
cross test -v --no-fail-fast --target=$TARGET --manifest-path=xtest-numeric/Cargo.toml --release
cross test -v --no-fail-fast --target=$TARGET -p ndarray-rand --features ndarray-rand/quickcheck
cross test -v --no-fail-fast --target=$TARGET -p serialization-tests --verbose
cross test -v --no-fail-fast --target=$TARGET -p numeric-tests --release

0 comments on commit ec0ffa6

Please sign in to comment.