Repository: rust-ndarray/ndarray
Pull request #1408 (2024-08-02 12:31:57)

Organize tests in workspace (cont.)
Further normalization, using crates/ and naming directories exactly as their respective crates.

Also exclude blas-tests from default members, because it depends on selecting a blas backend. 


Patch:
diff --git a/Cargo.toml b/Cargo.toml
index c0c8f877..f1a7d428 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -80,9 +80,14 @@ portable-atomic-util = { version = "0.2.0", features = [ "alloc" ] }
 [workspace]
 members = [
     "ndarray-rand",
-    "extra-tests/serialization",
-    "extra-tests/blas",
-    "extra-tests/numeric",
+    "crates/*",
+]
+default-members = [
+    ".",
+    "ndarray-rand",
+    "crates/numeric-tests",
+    "crates/serialization-tests",
+    # exclude blas-tests that depends on BLAS install
 ]
 
 [workspace.dependencies]
diff --git a/README.rst b/README.rst
index 3fb692b6..a95ca320 100644
--- a/README.rst
+++ b/README.rst
@@ -107,7 +107,7 @@ How to use with cargo
 ::
 
     [dependencies]
-    ndarray = "0.15.0"
+    ndarray = "0.16.0"
 
 How to enable BLAS integration
 ------------------------------
@@ -127,8 +127,8 @@ An example configuration using system openblas is shown below. Note that only
 end-user projects (not libraries) should select provider::
 
     [dependencies]
-    ndarray = { version = "0.15.0", features = ["blas"] }
-    blas-src = { version = "0.8", features = ["openblas"] }
+    ndarray = { version = "0.16.0", features = ["blas"] }
+    blas-src = { version = "0.10", features = ["openblas"] }
     openblas-src = { version = "0.10", features = ["cblas", "system"] }
 
 Using system-installed dependencies can save a long time building dependencies.
@@ -149,6 +149,7 @@ there is no tight coupling to the ``blas-src`` version, so version selection is
 =========== ============ ================ ==============
 ``ndarray`` ``blas-src`` ``openblas-src`` ``netlib-src``
 =========== ============ ================ ==============
+0.16        0.10         0.10             0.8
 0.15        0.8          0.10             0.8
 0.15        0.7          0.9              0.8
 0.14        0.6.1        0.9.0


Test patch:
diff --git a/extra-tests/blas/Cargo.toml b/crates/blas-tests/Cargo.toml
similarity index 100%
rename from extra-tests/blas/Cargo.toml
rename to crates/blas-tests/Cargo.toml
diff --git a/extra-tests/blas/src/lib.rs b/crates/blas-tests/src/lib.rs
similarity index 100%
rename from extra-tests/blas/src/lib.rs
rename to crates/blas-tests/src/lib.rs
diff --git a/extra-tests/blas/tests/oper.rs b/crates/blas-tests/tests/oper.rs
similarity index 100%
rename from extra-tests/blas/tests/oper.rs
rename to crates/blas-tests/tests/oper.rs
diff --git a/extra-tests/numeric/Cargo.toml b/crates/numeric-tests/Cargo.toml
similarity index 100%
rename from extra-tests/numeric/Cargo.toml
rename to crates/numeric-tests/Cargo.toml
diff --git a/extra-tests/numeric/src/lib.rs b/crates/numeric-tests/src/lib.rs
similarity index 100%
rename from extra-tests/numeric/src/lib.rs
rename to crates/numeric-tests/src/lib.rs
diff --git a/extra-tests/numeric/tests/accuracy.rs b/crates/numeric-tests/tests/accuracy.rs
similarity index 100%
rename from extra-tests/numeric/tests/accuracy.rs
rename to crates/numeric-tests/tests/accuracy.rs
diff --git a/extra-tests/serialization/Cargo.toml b/crates/serialization-tests/Cargo.toml
similarity index 85%
rename from extra-tests/serialization/Cargo.toml
rename to crates/serialization-tests/Cargo.toml
index 76bf66bf..8e7056b8 100644
--- a/extra-tests/serialization/Cargo.toml
+++ b/crates/serialization-tests/Cargo.toml
@@ -12,7 +12,7 @@ test = false
 ndarray = { workspace = true, features = ["serde"] }
 
 serde = { version = "1.0.100", default-features = false }
-ron = { version = "0.8.1", optional = true }
+ron = { version = "0.8.1" }
 
 [dev-dependencies]
 serde_json = { version = "1.0.40" }
@@ -20,7 +20,3 @@ serde_json = { version = "1.0.40" }
 rmp = { version = "=0.8.10" }
 # Old version to work with Rust 1.64+
 rmp-serde = { version = "0.14" }
-
-[features]
-default = ["ron"]
-
diff --git a/extra-tests/serialization/src/lib.rs b/crates/serialization-tests/src/lib.rs
similarity index 100%
rename from extra-tests/serialization/src/lib.rs
rename to crates/serialization-tests/src/lib.rs
diff --git a/extra-tests/serialization/tests/serialize.rs b/crates/serialization-tests/tests/serialize.rs
similarity index 99%
rename from extra-tests/serialization/tests/serialize.rs
rename to crates/serialization-tests/tests/serialize.rs
index 95e93e4f..6e6fb4d6 100644
--- a/extra-tests/serialization/tests/serialize.rs
+++ b/crates/serialization-tests/tests/serialize.rs
@@ -6,7 +6,6 @@ extern crate serde_json;
 
 extern crate rmp_serde;
 
-#[cfg(feature = "ron")]
 extern crate ron;
 
 use ndarray::{arr0, arr1, arr2, s, ArcArray, ArcArray2, ArrayD, IxDyn};
@@ -179,7 +178,6 @@ fn serial_many_dim_serde_msgpack()
 }
 
 #[test]
-#[cfg(feature = "ron")]
 fn serial_many_dim_ron()
 {
     use ron::de::from_str as ron_deserialize;
diff --git a/extra-tests/README.md b/extra-tests/README.md
deleted file mode 100644
index 5b5b78b5..00000000
--- a/extra-tests/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-
-# Extra Tests
-
-These are test crates whose settings, features and dependencies should be
-separate from the main crate.
diff --git a/scripts/all-tests.sh b/scripts/all-tests.sh
index ca40c210..6f1fdf73 100755
--- a/scripts/all-tests.sh
+++ b/scripts/all-tests.sh
@@ -6,19 +6,24 @@ set -e
 FEATURES=$1
 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 build --verbose --features "$FEATURES"
-cargo test --verbose --features "$FEATURES"
-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
+QC_FEAT=--features=ndarray-rand/quickcheck
+
+# build check with no features
+cargo build -v --no-default-features
+
+# ndarray with no features
+cargo test -p ndarray -v --no-default-features
+# all with features
+cargo test -v --features "$FEATURES" $QC_FEAT
+# all with features and release (ignore test crates which is already optimized)
+cargo test -v -p ndarray -p ndarray-rand --release --features "$FEATURES" $QC_FEAT --lib --tests
+
+# BLAS tests
 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
 
+# Examples
 cargo test --examples
+
+# Benchmarks
 ([ "$CHANNEL" != "nightly" ] || cargo bench --no-run --verbose --features "$FEATURES")
diff --git a/scripts/cross-tests.sh b/scripts/cross-tests.sh
index f28623b4..683a901d 100755
--- a/scripts/cross-tests.sh
+++ b/scripts/cross-tests.sh
@@ -7,8 +7,7 @@ FEATURES=$1
 CHANNEL=$2
 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 -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
+QC_FEAT=--features=ndarray-rand/quickcheck
+
+cross build -v --features="$FEATURES" $QC_FEAT --target=$TARGET
+cross test -v --no-fail-fast --features="$FEATURES" $QC_FEAT --target=$TARGET