Add librustzcash tests to the full test suite.

This commit is contained in:
Sean Bowe 2020-03-14 10:58:09 -06:00
parent c7f1ec471e
commit 7767f8e9e0
No known key found for this signature in database
GPG Key ID: 95684257D8F8B031
2 changed files with 22 additions and 1 deletions

View File

@ -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,

View File

@ -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