aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2019-05-02 16:48:05 -0400
committerMarcoFalke <falke.marco@gmail.com>2019-05-15 14:27:18 -0400
commitfad0ce59e9154f9b7e61907a71c740a942c60282 (patch)
tree699633db7e46fe8bedb820efc8ad01354abfc559
parent65526fc8666fef35ef908dbc225f706bef642c7e (diff)
tests: Fail if RPC has been added without tests
-rw-r--r--.travis.yml1
-rwxr-xr-x.travis/test_06_script_b.sh2
-rwxr-xr-xtest/functional/rpc_misc.py8
-rwxr-xr-xtest/functional/test_runner.py8
4 files changed, 16 insertions, 3 deletions
diff --git a/.travis.yml b/.travis.yml
index c61fcb2ed0..c281d3ed70 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -121,6 +121,7 @@ jobs:
HOST=x86_64-unknown-linux-gnu
PACKAGES="python3-zmq qtbase5-dev qttools5-dev-tools protobuf-compiler libdbus-1-dev libharfbuzz-dev libprotobuf-dev"
DEP_OPTS="NO_QT=1 NO_UPNP=1 DEBUG=1 ALLOW_HOST_PACKAGES=1"
+ TEST_RUNNER_EXTRA="--coverage --extended --exclude feature_dbcrash" # Run extended tests so that coverage does not fail, but exclude the very slow dbcrash
GOAL="install"
BITCOIN_CONFIG="--enable-zmq --with-gui=qt5 --enable-glibc-back-compat --enable-reduce-exports --enable-debug CXXFLAGS=\"-g0 -O2\""
diff --git a/.travis/test_06_script_b.sh b/.travis/test_06_script_b.sh
index e13abfd52f..0420acb993 100755
--- a/.travis/test_06_script_b.sh
+++ b/.travis/test_06_script_b.sh
@@ -16,7 +16,7 @@ fi
if [ "$RUN_FUNCTIONAL_TESTS" = "true" ]; then
BEGIN_FOLD functional-tests
- DOCKER_EXEC test/functional/test_runner.py --ci --combinedlogslen=4000 --coverage --quiet --failfast
+ DOCKER_EXEC test/functional/test_runner.py --ci --combinedlogslen=4000 ${TEST_RUNNER_EXTRA} --quiet --failfast
END_FOLD
fi
diff --git a/test/functional/rpc_misc.py b/test/functional/rpc_misc.py
index 7bf8e68176..8a3f8c6f06 100755
--- a/test/functional/rpc_misc.py
+++ b/test/functional/rpc_misc.py
@@ -46,5 +46,13 @@ class RpcMiscTest(BitcoinTestFramework):
assert_raises_rpc_error(-8, "unknown mode foobar", node.getmemoryinfo, mode="foobar")
+ self.log.info("test logging")
+ assert_equal(node.logging()['qt'], True)
+ node.logging(exclude=['qt'])
+ assert_equal(node.logging()['qt'], False)
+ node.logging(include=['qt'])
+ assert_equal(node.logging()['qt'], True)
+
+
if __name__ == '__main__':
RpcMiscTest().main()
diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py
index ec5d6f1715..ece0059f74 100755
--- a/test/functional/test_runner.py
+++ b/test/functional/test_runner.py
@@ -401,16 +401,18 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=
print_results(test_results, max_len_name, (int(time.time() - start_time)))
if coverage:
- coverage.report_rpc_coverage()
+ coverage_passed = coverage.report_rpc_coverage()
logging.debug("Cleaning up coverage data")
coverage.cleanup()
+ else:
+ coverage_passed = True
# Clear up the temp directory if all subdirectories are gone
if not os.listdir(tmpdir):
os.rmdir(tmpdir)
- all_passed = all(map(lambda test_result: test_result.was_successful, test_results))
+ all_passed = all(map(lambda test_result: test_result.was_successful, test_results)) and coverage_passed
# This will be a no-op unless failfast is True in which case there may be dangling
# processes which need to be killed.
@@ -612,8 +614,10 @@ class RPCCoverage():
if uncovered:
print("Uncovered RPC commands:")
print("".join((" - %s\n" % command) for command in sorted(uncovered)))
+ return False
else:
print("All RPC commands covered.")
+ return True
def cleanup(self):
return shutil.rmtree(self.dir)