mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
Merge #10197: [tests] Functional test warnings
08e51c1
[tests] Remove cache directory by default when running test_runner (John Newbery)c85b080
[test] add warnings to test_runner (John Newbery) Tree-SHA512: 537a8a258e410102708d1e02893f3f45abe7a3a3290536249381a7dc55d74ca78322804bf34178dec1461ec1c29d8f8358c5901ddd1633f8b301b95bcbb6ce6d
This commit is contained in:
parent
46db8eb685
commit
b76b91d821
@ -159,6 +159,7 @@ def main():
|
|||||||
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).')
|
||||||
parser.add_argument('--help', '-h', '-?', action='store_true', help='print help text and exit')
|
parser.add_argument('--help', '-h', '-?', action='store_true', help='print help text and exit')
|
||||||
parser.add_argument('--jobs', '-j', type=int, default=4, help='how many test scripts to run in parallel. Default=4.')
|
parser.add_argument('--jobs', '-j', type=int, default=4, help='how many test scripts to run in parallel. Default=4.')
|
||||||
|
parser.add_argument('--keepcache', '-k', action='store_true', help='the default behavior is to flush the cache directory on startup. --keepcache retains the cache from the previous testrun.')
|
||||||
args, unknown_args = parser.parse_known_args()
|
args, unknown_args = parser.parse_known_args()
|
||||||
|
|
||||||
# Create a set to store arguments and create the passon string
|
# Create a set to store arguments and create the passon string
|
||||||
@ -218,9 +219,24 @@ def main():
|
|||||||
|
|
||||||
check_script_list(config["environment"]["SRCDIR"])
|
check_script_list(config["environment"]["SRCDIR"])
|
||||||
|
|
||||||
|
if not args.keepcache:
|
||||||
|
shutil.rmtree("%s/test/cache" % config["environment"]["BUILDDIR"], ignore_errors=True)
|
||||||
|
|
||||||
run_tests(test_list, config["environment"]["SRCDIR"], config["environment"]["BUILDDIR"], config["environment"]["EXEEXT"], args.jobs, args.coverage, passon_args)
|
run_tests(test_list, config["environment"]["SRCDIR"], config["environment"]["BUILDDIR"], config["environment"]["EXEEXT"], args.jobs, args.coverage, passon_args)
|
||||||
|
|
||||||
def run_tests(test_list, src_dir, build_dir, exeext, jobs=1, enable_coverage=False, args=[]):
|
def run_tests(test_list, src_dir, build_dir, exeext, jobs=1, enable_coverage=False, args=[]):
|
||||||
|
# Warn if dashd is already running (unix only)
|
||||||
|
try:
|
||||||
|
if subprocess.check_output(["pidof", "dashd"]) is not None:
|
||||||
|
print("%sWARNING!%s There is already a dashd process running on this system. Tests may fail unexpectedly due to resource contention!" % (BOLD[1], BOLD[0]))
|
||||||
|
except (OSError, subprocess.SubprocessError):
|
||||||
|
pass
|
||||||
|
|
||||||
|
# Warn if there is a cache directory
|
||||||
|
cache_dir = "%s/test/cache" % build_dir
|
||||||
|
if os.path.isdir(cache_dir):
|
||||||
|
print("%sWARNING!%s There is a cache directory here: %s. If tests fail unexpectedly, try deleting the cache directory." % (BOLD[1], BOLD[0], cache_dir))
|
||||||
|
|
||||||
BOLD = ("","")
|
BOLD = ("","")
|
||||||
if os.name == 'posix':
|
if os.name == 'posix':
|
||||||
# primitive formatting on supported
|
# primitive formatting on supported
|
||||||
@ -234,7 +250,7 @@ def run_tests(test_list, src_dir, build_dir, exeext, jobs=1, enable_coverage=Fal
|
|||||||
tests_dir = src_dir + '/test/functional/'
|
tests_dir = src_dir + '/test/functional/'
|
||||||
|
|
||||||
flags = ["--srcdir={}/src".format(build_dir)] + args
|
flags = ["--srcdir={}/src".format(build_dir)] + args
|
||||||
flags.append("--cachedir=%s/test/cache" % build_dir)
|
flags.append("--cachedir=%s" % cache_dir)
|
||||||
|
|
||||||
if enable_coverage:
|
if enable_coverage:
|
||||||
coverage = RPCCoverage()
|
coverage = RPCCoverage()
|
||||||
@ -346,8 +362,9 @@ def check_script_list(src_dir):
|
|||||||
python_files = set([t for t in os.listdir(script_dir) if t[-3:] == ".py"])
|
python_files = set([t for t in os.listdir(script_dir) if t[-3:] == ".py"])
|
||||||
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("The following scripts are not being run:" + 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)))
|
||||||
print("Check the test lists in test_runner.py")
|
if os.getenv('TRAVIS') == 'true':
|
||||||
|
# On travis this warning is an error to prevent merging incomplete commits into master
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
class RPCCoverage(object):
|
class RPCCoverage(object):
|
||||||
|
Loading…
Reference in New Issue
Block a user