Skip to content

Commit 9d266db

Browse files
author
MarcoFalke
committed
Merge #15943: tests: Fail if RPC has been added without tests
fad0ce5 tests: Fail if RPC has been added without tests (MarcoFalke) Pull request description: Need to be run with --coverage ACKs for commit fad0ce: ryanofsky: utACK fad0ce5. New comment in travis.yml is the only change since last review. Tree-SHA512: b53632dfe9865ec06991bfcba2fd67238bebbb866b355f09624eaf233257b2bca902caac6c24abb358b2f4c1c43f28ca75e30982765911e1a117102df65276d9
2 parents 2d16fb7 + fad0ce5 commit 9d266db

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ jobs:
121121
HOST=x86_64-unknown-linux-gnu
122122
PACKAGES="python3-zmq qtbase5-dev qttools5-dev-tools protobuf-compiler libdbus-1-dev libharfbuzz-dev libprotobuf-dev"
123123
DEP_OPTS="NO_QT=1 NO_UPNP=1 DEBUG=1 ALLOW_HOST_PACKAGES=1"
124+
TEST_RUNNER_EXTRA="--coverage --extended --exclude feature_dbcrash" # Run extended tests so that coverage does not fail, but exclude the very slow dbcrash
124125
GOAL="install"
125126
BITCOIN_CONFIG="--enable-zmq --with-gui=qt5 --enable-glibc-back-compat --enable-reduce-exports --enable-debug CXXFLAGS=\"-g0 -O2\""
126127

.travis/test_06_script_b.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ fi
1616

1717
if [ "$RUN_FUNCTIONAL_TESTS" = "true" ]; then
1818
BEGIN_FOLD functional-tests
19-
DOCKER_EXEC test/functional/test_runner.py --ci --combinedlogslen=4000 --coverage --quiet --failfast
19+
DOCKER_EXEC test/functional/test_runner.py --ci --combinedlogslen=4000 ${TEST_RUNNER_EXTRA} --quiet --failfast
2020
END_FOLD
2121
fi
2222

test/functional/rpc_misc.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,13 @@ def run_test(self):
4646

4747
assert_raises_rpc_error(-8, "unknown mode foobar", node.getmemoryinfo, mode="foobar")
4848

49+
self.log.info("test logging")
50+
assert_equal(node.logging()['qt'], True)
51+
node.logging(exclude=['qt'])
52+
assert_equal(node.logging()['qt'], False)
53+
node.logging(include=['qt'])
54+
assert_equal(node.logging()['qt'], True)
55+
56+
4957
if __name__ == '__main__':
5058
RpcMiscTest().main()

test/functional/test_runner.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,16 +401,18 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=
401401
print_results(test_results, max_len_name, (int(time.time() - start_time)))
402402

403403
if coverage:
404-
coverage.report_rpc_coverage()
404+
coverage_passed = coverage.report_rpc_coverage()
405405

406406
logging.debug("Cleaning up coverage data")
407407
coverage.cleanup()
408+
else:
409+
coverage_passed = True
408410

409411
# Clear up the temp directory if all subdirectories are gone
410412
if not os.listdir(tmpdir):
411413
os.rmdir(tmpdir)
412414

413-
all_passed = all(map(lambda test_result: test_result.was_successful, test_results))
415+
all_passed = all(map(lambda test_result: test_result.was_successful, test_results)) and coverage_passed
414416

415417
# This will be a no-op unless failfast is True in which case there may be dangling
416418
# processes which need to be killed.
@@ -612,8 +614,10 @@ def report_rpc_coverage(self):
612614
if uncovered:
613615
print("Uncovered RPC commands:")
614616
print("".join((" - %s\n" % command) for command in sorted(uncovered)))
617+
return False
615618
else:
616619
print("All RPC commands covered.")
620+
return True
617621

618622
def cleanup(self):
619623
return shutil.rmtree(self.dir)

0 commit comments

Comments
 (0)