[tor-commits] [tor/release-0.3.3] tests: Automatically detect Rust crates to test and also pass --verbose.

nickm at torproject.org nickm at torproject.org
Fri Mar 23 15:19:45 UTC 2018


commit 657d5cbbbc09948416bcc4f717cbfb64761a908d
Author: Isis Lovecruft <isis at torproject.org>
Date:   Tue Mar 20 20:46:19 2018 +0000

    tests: Automatically detect Rust crates to test and also pass --verbose.
    
     * FIXES #25560: https://bugs.torproject.org/25560.
---
 changes/bug25560      |  5 +++++
 src/test/include.am   |  2 +-
 src/test/test_rust.sh | 23 +++++++++--------------
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/changes/bug25560 b/changes/bug25560
new file mode 100644
index 000000000..5947fa03a
--- /dev/null
+++ b/changes/bug25560
@@ -0,0 +1,5 @@
+  o Minor bugfixes (testing, rust):
+    - Some of our Rust crates were not having their tests run with `make
+      test-rust` due to a static string in the `src/test/test_rust.sh` script
+      specifying which crates to test.  Rust crates are not automatically
+      detected and tested.  Fixes bug 25560; bugfix on 0.3.3.3-alpha.
diff --git a/src/test/include.am b/src/test/include.am
index 1a49367c6..b768f7447 100644
--- a/src/test/include.am
+++ b/src/test/include.am
@@ -360,4 +360,4 @@ EXTRA_DIST += \
 	src/test/test_workqueue_socketpair.sh
 
 test-rust:
-	$(TESTS_ENVIRONMENT) $(abs_top_srcdir)/src/test/test_rust.sh
+	$(TESTS_ENVIRONMENT) "$(abs_top_srcdir)/src/test/test_rust.sh"
diff --git a/src/test/test_rust.sh b/src/test/test_rust.sh
index 133f2bb94..d87336e70 100755
--- a/src/test/test_rust.sh
+++ b/src/test/test_rust.sh
@@ -1,20 +1,15 @@
 #!/bin/sh
 # Test all Rust crates
 
-crates="protover tor_util smartlist tor_allocate"
-
-exitcode=0
-
 set -e
 
-for crate in $crates; do
-    cd "${abs_top_builddir:-../../..}/src/rust"
-    CARGO_TARGET_DIR="${abs_top_builddir:-../../..}/src/rust/target" \
-      CARGO_HOME="${abs_top_builddir:-../../..}/src/rust" \
-      "${CARGO:-cargo}" test ${CARGO_ONLINE-"--frozen"} \
-      --manifest-path "${abs_top_srcdir:-.}/src/rust/${crate}/Cargo.toml" \
-	|| exitcode=1
-    cd -
-done
+CARGO_TARGET_DIR="${abs_top_builddir:-../../..}/src/rust/target" \
+    CARGO_HOME="${abs_top_builddir:-../../..}/src/rust" \
+    find "${abs_top_srcdir:-../../..}/src/rust" \
+    -mindepth 2 -maxdepth 2 \
+    -type f -name 'Cargo.toml' \
+    -exec "${CARGO:-cargo}" test --all-features ${CARGO_ONLINE-"--frozen"} \
+    --manifest-path '{}' \;
+
+exit $?
 
-exit $exitcode





More information about the tor-commits mailing list