Merge #14630: test_runner: Remove travis specific code
fa43626611
test_runner: Remove travis specific code (MarcoFalke)
Pull request description:
The tests are no longer run on travis, but in a docker, developer machines or a windows vm.
The code was essentially dead for months now. Fix that by explicitly passing in `--ci` to the test runner on our docker and appveyor windows vm.
Tree-SHA512: 5d48693c03e8eb27536658ccf9ba738fe93a72abd4b72c80caac084b5b2cdffa77a1031a671eeefe70b71d63500f55917803d4be54d01849722afdccb700a9e6
This commit is contained in:
commit
750415701c
3 changed files with 26 additions and 18 deletions
|
@ -61,5 +61,5 @@ test_script:
|
||||||
- ps: src\bench_bitcoin.exe -evals=1 -scaling=0
|
- ps: src\bench_bitcoin.exe -evals=1 -scaling=0
|
||||||
- ps: python test\util\bitcoin-util-test.py
|
- ps: python test\util\bitcoin-util-test.py
|
||||||
- cmd: python test\util\rpcauth-test.py
|
- cmd: python test\util\rpcauth-test.py
|
||||||
- cmd: python test\functional\test_runner.py --force --quiet --combinedlogslen=4000
|
- cmd: python test\functional\test_runner.py --ci --force --quiet --combinedlogslen=4000
|
||||||
deploy: off
|
deploy: off
|
||||||
|
|
|
@ -62,6 +62,6 @@ fi
|
||||||
|
|
||||||
if [ "$RUN_FUNCTIONAL_TESTS" = "true" ]; then
|
if [ "$RUN_FUNCTIONAL_TESTS" = "true" ]; then
|
||||||
BEGIN_FOLD functional-tests
|
BEGIN_FOLD functional-tests
|
||||||
DOCKER_EXEC test/functional/test_runner.py --combinedlogslen=4000 --coverage --quiet --failfast ${extended}
|
DOCKER_EXEC test/functional/test_runner.py --ci --combinedlogslen=4000 --coverage --quiet --failfast ${extended}
|
||||||
END_FOLD
|
END_FOLD
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -68,9 +68,6 @@ if os.name != 'nt' or sys.getwindowsversion() >= (10, 0, 14393):
|
||||||
TEST_EXIT_PASSED = 0
|
TEST_EXIT_PASSED = 0
|
||||||
TEST_EXIT_SKIPPED = 77
|
TEST_EXIT_SKIPPED = 77
|
||||||
|
|
||||||
# 20 minutes represented in seconds
|
|
||||||
TRAVIS_TIMEOUT_DURATION = 20 * 60
|
|
||||||
|
|
||||||
BASE_SCRIPTS = [
|
BASE_SCRIPTS = [
|
||||||
# Scripts that are run by the travis build process.
|
# Scripts that are run by the travis build process.
|
||||||
# Longest test should go first, to favor running tests in parallel
|
# Longest test should go first, to favor running tests in parallel
|
||||||
|
@ -216,6 +213,7 @@ def main():
|
||||||
formatter_class=argparse.RawTextHelpFormatter)
|
formatter_class=argparse.RawTextHelpFormatter)
|
||||||
parser.add_argument('--combinedlogslen', '-c', type=int, default=0, help='print a combined log (of length n lines) from all test nodes and test framework to the console on failure.')
|
parser.add_argument('--combinedlogslen', '-c', type=int, default=0, help='print a combined log (of length n lines) from all test nodes and test framework to the console on failure.')
|
||||||
parser.add_argument('--coverage', action='store_true', help='generate a basic coverage report for the RPC interface')
|
parser.add_argument('--coverage', action='store_true', help='generate a basic coverage report for the RPC interface')
|
||||||
|
parser.add_argument('--ci', action='store_true', help='Run checks and code that are usually only enabled in a continuous integration environment')
|
||||||
parser.add_argument('--exclude', '-x', help='specify a comma-separated-list of scripts to exclude.')
|
parser.add_argument('--exclude', '-x', help='specify a comma-separated-list of scripts to exclude.')
|
||||||
parser.add_argument('--extended', action='store_true', help='run the extended test suite in addition to the basic tests')
|
parser.add_argument('--extended', action='store_true', help='run the extended test suite in addition to the basic tests')
|
||||||
parser.add_argument('--force', '-f', action='store_true', help='run tests even on platforms where they are disabled by default (e.g. windows).')
|
parser.add_argument('--force', '-f', action='store_true', help='run tests even on platforms where they are disabled by default (e.g. windows).')
|
||||||
|
@ -306,25 +304,26 @@ def main():
|
||||||
subprocess.check_call([sys.executable, os.path.join(config["environment"]["SRCDIR"], 'test', 'functional', test_list[0].split()[0]), '-h'])
|
subprocess.check_call([sys.executable, os.path.join(config["environment"]["SRCDIR"], 'test', 'functional', test_list[0].split()[0]), '-h'])
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
check_script_list(config["environment"]["SRCDIR"])
|
check_script_list(src_dir=config["environment"]["SRCDIR"], fail_on_warn=args.ci)
|
||||||
check_script_prefixes()
|
check_script_prefixes()
|
||||||
|
|
||||||
if not args.keepcache:
|
if not args.keepcache:
|
||||||
shutil.rmtree("%s/test/cache" % config["environment"]["BUILDDIR"], ignore_errors=True)
|
shutil.rmtree("%s/test/cache" % config["environment"]["BUILDDIR"], ignore_errors=True)
|
||||||
|
|
||||||
run_tests(
|
run_tests(
|
||||||
test_list,
|
test_list=test_list,
|
||||||
config["environment"]["SRCDIR"],
|
src_dir=config["environment"]["SRCDIR"],
|
||||||
config["environment"]["BUILDDIR"],
|
build_dir=config["environment"]["BUILDDIR"],
|
||||||
tmpdir,
|
tmpdir=tmpdir,
|
||||||
jobs=args.jobs,
|
jobs=args.jobs,
|
||||||
enable_coverage=args.coverage,
|
enable_coverage=args.coverage,
|
||||||
args=passon_args,
|
args=passon_args,
|
||||||
combined_logs_len=args.combinedlogslen,
|
combined_logs_len=args.combinedlogslen,
|
||||||
failfast=args.failfast
|
failfast=args.failfast,
|
||||||
|
runs_ci=args.ci,
|
||||||
)
|
)
|
||||||
|
|
||||||
def run_tests(test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=False, args=None, combined_logs_len=0, failfast=False):
|
def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=False, args=None, combined_logs_len=0, failfast=False, runs_ci):
|
||||||
args = args or []
|
args = args or []
|
||||||
|
|
||||||
# Warn if bitcoind is already running (unix only)
|
# Warn if bitcoind is already running (unix only)
|
||||||
|
@ -359,7 +358,14 @@ def run_tests(test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=Fal
|
||||||
raise
|
raise
|
||||||
|
|
||||||
#Run Tests
|
#Run Tests
|
||||||
job_queue = TestHandler(jobs, tests_dir, tmpdir, test_list, flags)
|
job_queue = TestHandler(
|
||||||
|
num_tests_parallel=jobs,
|
||||||
|
tests_dir=tests_dir,
|
||||||
|
tmpdir=tmpdir,
|
||||||
|
test_list=test_list,
|
||||||
|
flags=flags,
|
||||||
|
timeout_duration=20 * 60 if runs_ci else float('inf'), # in seconds
|
||||||
|
)
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
test_results = []
|
test_results = []
|
||||||
|
|
||||||
|
@ -440,11 +446,12 @@ class TestHandler:
|
||||||
Trigger the test scripts passed in via the list.
|
Trigger the test scripts passed in via the list.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, num_tests_parallel, tests_dir, tmpdir, test_list=None, flags=None):
|
def __init__(self, *, num_tests_parallel, tests_dir, tmpdir, test_list, flags, timeout_duration):
|
||||||
assert(num_tests_parallel >= 1)
|
assert num_tests_parallel >= 1
|
||||||
self.num_jobs = num_tests_parallel
|
self.num_jobs = num_tests_parallel
|
||||||
self.tests_dir = tests_dir
|
self.tests_dir = tests_dir
|
||||||
self.tmpdir = tmpdir
|
self.tmpdir = tmpdir
|
||||||
|
self.timeout_duration = timeout_duration
|
||||||
self.test_list = test_list
|
self.test_list = test_list
|
||||||
self.flags = flags
|
self.flags = flags
|
||||||
self.num_running = 0
|
self.num_running = 0
|
||||||
|
@ -479,7 +486,7 @@ class TestHandler:
|
||||||
time.sleep(.5)
|
time.sleep(.5)
|
||||||
for job in self.jobs:
|
for job in self.jobs:
|
||||||
(name, start_time, proc, testdir, log_out, log_err) = job
|
(name, start_time, proc, testdir, log_out, log_err) = job
|
||||||
if os.getenv('TRAVIS') == 'true' and int(time.time() - start_time) > TRAVIS_TIMEOUT_DURATION:
|
if int(time.time() - start_time) > self.timeout_duration:
|
||||||
# In travis, timeout individual tests (to stop tests hanging and not providing useful output).
|
# In travis, timeout individual tests (to stop tests hanging and not providing useful output).
|
||||||
proc.send_signal(signal.SIGINT)
|
proc.send_signal(signal.SIGINT)
|
||||||
if proc.poll() is not None:
|
if proc.poll() is not None:
|
||||||
|
@ -557,7 +564,7 @@ def check_script_prefixes():
|
||||||
raise AssertionError("Some tests are not following naming convention!")
|
raise AssertionError("Some tests are not following naming convention!")
|
||||||
|
|
||||||
|
|
||||||
def check_script_list(src_dir):
|
def check_script_list(*, src_dir, fail_on_warn):
|
||||||
"""Check scripts directory.
|
"""Check scripts directory.
|
||||||
|
|
||||||
Check that there are no scripts in the functional tests directory which are
|
Check that there are no scripts in the functional tests directory which are
|
||||||
|
@ -567,10 +574,11 @@ def check_script_list(src_dir):
|
||||||
missed_tests = list(python_files - set(map(lambda x: x.split()[0], ALL_SCRIPTS + NON_SCRIPTS)))
|
missed_tests = list(python_files - set(map(lambda x: x.split()[0], ALL_SCRIPTS + NON_SCRIPTS)))
|
||||||
if len(missed_tests) != 0:
|
if len(missed_tests) != 0:
|
||||||
print("%sWARNING!%s The following scripts are not being run: %s. Check the test lists in test_runner.py." % (BOLD[1], BOLD[0], str(missed_tests)))
|
print("%sWARNING!%s The following scripts are not being run: %s. Check the test lists in test_runner.py." % (BOLD[1], BOLD[0], str(missed_tests)))
|
||||||
if os.getenv('TRAVIS') == 'true':
|
if fail_on_warn:
|
||||||
# On travis this warning is an error to prevent merging incomplete commits into master
|
# On travis this warning is an error to prevent merging incomplete commits into master
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
class RPCCoverage():
|
class RPCCoverage():
|
||||||
"""
|
"""
|
||||||
Coverage reporting utilities for test_runner.
|
Coverage reporting utilities for test_runner.
|
||||||
|
|
Loading…
Add table
Reference in a new issue