diff --git a/qa/zcash/full_test_suite.py b/qa/zcash/full_test_suite.py index 1e80ee210..8293a6b21 100755 --- a/qa/zcash/full_test_suite.py +++ b/qa/zcash/full_test_suite.py @@ -126,13 +126,33 @@ def util_test(): env={'PYTHONPATH': repofile('src/test'), 'srcdir': repofile('src')} ) == 0 +def rust_test(): + target_dir = os.path.join(REPOROOT, 'target', 'x86_64-unknown-linux-gnu') + if not os.path.isdir(target_dir): + arch_dirs = glob(os.path.join(REPOROOT, 'target', 'x86_64-apple-darwin*')) + if arch_dirs: + # Just try the first one; there will only be on in CI + target_dir = arch_dirs[0] + if os.path.isdir(target_dir): + # cargo build --tests will produce a binary named something + # like rustzcash-b38184f84aaf9146 (see also https://github.com/rust-lang/cargo/issues/1924) + # so let's find it and run it. + test_files = glob(os.path.join(target_dir, 'release', 'rustzcash*')) + for candidate in test_files: + if candidate[-2::] != ".d": + # Only one test target to run + return subprocess.call([candidate]) == 0 + + # Didn't manage to run anything + return False # # Tests # STAGES = [ 'check-depends', + 'rust-test', 'btest', 'gtest', 'sec-hard', @@ -145,6 +165,7 @@ STAGES = [ STAGE_COMMANDS = { 'check-depends': ['qa/zcash/test-depends-sources-mirror.py'], + 'rust-test': rust_test, 'btest': [repofile('src/test/test_bitcoin'), '-p'], 'gtest': [repofile('src/zcash-gtest')], 'sec-hard': check_security_hardening, diff --git a/src/Makefile.am b/src/Makefile.am index f26805378..a512029f9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -79,7 +79,7 @@ $(CARGO_CONFIGURED): $(top_srcdir)/.cargo/config.offline endif cargo-build: $(CARGO_CONFIGURED) - $(RUST_ENV_VARS) $(CARGO) build $(RUST_BUILD_OPTS) --manifest-path $(top_srcdir)/Cargo.toml + $(RUST_ENV_VARS) $(CARGO) build --lib --tests $(RUST_BUILD_OPTS) --manifest-path $(top_srcdir)/Cargo.toml if TARGET_WINDOWS LIBRUSTZCASH_WIN=$(top_builddir)/target/$(RUST_TARGET)/release/rustzcash.lib