Browse Source

Replace full-test-suite.sh with a new test suite driver script

This will be the canonical location for the entire Zcash merge test suite.
pull/4/head
Jack Grigg 7 years ago
parent
commit
aadf3aa159
No known key found for this signature in database GPG Key ID: 665DBCD284F7DAFF
  1. 47
      qa/zcash/full-test-suite.sh
  2. 87
      qa/zcash/full_test_suite.py

47
qa/zcash/full-test-suite.sh

@ -1,47 +0,0 @@
#!/bin/bash
#
# Execute all of the automated tests related to Zcash.
#
set -eu
SUITE_EXIT_STATUS=0
REPOROOT="$(readlink -f "$(dirname "$0")"/../../)"
function run_test_phase
{
echo "===== BEGIN: $*"
set +e
eval "$@"
if [ $? -eq 0 ]
then
echo "===== PASSED: $*"
else
echo "===== FAILED: $*"
SUITE_EXIT_STATUS=1
fi
set -e
}
cd "${REPOROOT}"
# Test phases:
run_test_phase "${REPOROOT}/qa/zcash/check-security-hardening.sh"
run_test_phase "${REPOROOT}/qa/zcash/ensure-no-dot-so-in-depends.py"
# If make check fails, show test-suite.log as part of our run_test_phase
# output (and fail the phase with false):
run_test_phase make check '||' \
'{' \
echo '=== ./src/test-suite.log ===' ';' \
cat './src/test-suite.log' ';' \
false ';' \
'}'
exit $SUITE_EXIT_STATUS

87
qa/zcash/full_test_suite.py

@ -0,0 +1,87 @@
#!/usr/bin/env python2
#
# Execute all of the automated tests related to Zcash.
#
import argparse
import os
import subprocess
import sys
REPOROOT = os.path.dirname(
os.path.dirname(
os.path.dirname(
os.path.abspath(__file__)
)
)
)
def repofile(filename):
return os.path.join(REPOROOT, filename)
#
# Tests
#
STAGES = [
'btest',
'gtest',
'sec-hard',
'no-dot-so',
'secp256k1',
'univalue',
'rpc',
]
STAGE_COMMANDS = {
'btest': [repofile('src/test/test_bitcoin'), '-p'],
'gtest': [repofile('src/zcash-gtest')],
'sec-hard': [repofile('qa/zcash/check-security-hardening.sh')],
'no-dot-so': [repofile('qa/zcash/ensure-no-dot-so-in-depends.py')],
'secp256k1': ['make', '-C', repofile('src/secp256k1'), 'check'],
'univalue': ['make', '-C', repofile('src/univalue'), 'check'],
'rpc': [repofile('qa/pull-tester/rpc-tests.sh')],
}
#
# Test driver
#
def run_stage(stage):
print('Running stage %s' % stage)
print('=' * (len(stage) + 14))
print
ret = subprocess.call(STAGE_COMMANDS[stage])
print
print('-' * (len(stage) + 15))
print('Finished stage %s' % stage)
print
return ret == 0
def main():
parser = argparse.ArgumentParser()
parser.add_argument('stage', nargs='*', default=STAGES,
help='One of %s'%STAGES)
args = parser.parse_args()
# Check validity of stages
for s in args.stage:
if s not in STAGES:
print("Invalid stage '%s' (choose from %s)" % (s, STAGES))
sys.exit(1)
# Run the stages
passed = True
for s in args.stage:
passed &= run_stage(s)
if not passed:
sys.exit(1)
if __name__ == '__main__':
main()
Loading…
Cancel
Save