Skip to content

Commit

Permalink
Organize the workspace of test crates a bit better
Browse files Browse the repository at this point in the history
Using workspace = true (Rust 1.64+)
  • Loading branch information
bluss committed Aug 1, 2024
1 parent 14c8123 commit 11ba0d0
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ jobs:
- beta
- nightly
- 1.64.0 # MSRV
- 1.66.0 # MSRV
- 1.68.0 # MSRV

name: tests/${{ matrix.rust }}
steps:
Expand Down
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.
File renamed without changes.
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 All @@ -22,8 +22,8 @@ default-features = false
version = "1.0.40"

[dev-dependencies.rmp-serde]
version = "0.14.0"
version = "1.3"

[dependencies.ron]
version = "0.5.1"
version = "0.8.1"
optional = true
File renamed without changes.
File renamed without changes.
19 changes: 12 additions & 7 deletions scripts/all-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,20 @@ CHANNEL=$2

cargo build --verbose --no-default-features
# Testing both dev and release profiles helps find bugs, especially in low level code
cargo test --verbose --no-default-features
cargo test --release --verbose --no-default-features
cargo test --verbose --no-default-features --lib
cargo test --release --verbose --no-default-features --lib
cargo build --verbose --features "$FEATURES"
cargo test --verbose --features "$FEATURES"
cargo test --verbose --features "$FEATURES" --lib
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 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 --manifest-path=xtest-blas/Cargo.toml --verbose --features openblas-system
# cargo test --manifest-path=xtest-numeric/Cargo.toml --verbose
# cargo test --manifest-path=xtest-numeric/Cargo.toml --verbose --features 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")

0 comments on commit 11ba0d0

Please sign in to comment.