add rpc parallel test group logic
This commit is contained in:
parent
1e6f4608b4
commit
c2d8153173
|
@ -190,6 +190,8 @@ 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('--machines', '-m', type=int, default=-1, help='how many machines to shard the tests over. must also provide individual shard index. Default=-1 (no sharding).')
|
||||||
|
parser.add_argument('--rpcgroup', '-r', type=int, default=-1, help='individual shard index. must also provide how many machines to shard the tests over. Default=-1 (no sharding).')
|
||||||
parser.add_argument('--nozmq', action='store_true', help='do not run the zmq tests')
|
parser.add_argument('--nozmq', action='store_true', help='do not run the zmq tests')
|
||||||
args, unknown_args = parser.parse_known_args()
|
args, unknown_args = parser.parse_known_args()
|
||||||
|
|
||||||
|
@ -266,7 +268,25 @@ def main():
|
||||||
subprocess.check_call((config["environment"]["SRCDIR"] + '/qa/rpc-tests/' + test_list[0]).split() + ['-h'])
|
subprocess.check_call((config["environment"]["SRCDIR"] + '/qa/rpc-tests/' + test_list[0]).split() + ['-h'])
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
run_tests(test_list, config["environment"]["SRCDIR"], config["environment"]["BUILDDIR"], config["environment"]["EXEEXT"], args.jobs, args.coverage, passon_args)
|
|
||||||
|
if (args.rpcgroup == -1) != (args.machines == -1):
|
||||||
|
print("ERROR: Please use both -m and -r options when using parallel rpc_groups.")
|
||||||
|
sys.exit(0)
|
||||||
|
if args.machines == 0:
|
||||||
|
print("ERROR: -m/--machines must be greater than 0")
|
||||||
|
sys.exit(0)
|
||||||
|
if args.machines > 0 and (args.rpcgroup >= args.machines):
|
||||||
|
print("ERROR: -r/--rpcgroup must be less than -m/--machines")
|
||||||
|
sys.exit(0)
|
||||||
|
if args.rpcgroup != -1 and args.machines != -1 and args.machines > args.rpcgroup:
|
||||||
|
# Ceiling division using floor division, by inverting the world.
|
||||||
|
# https://stackoverflow.com/a/17511341
|
||||||
|
k = -(len(test_list) // -args.machines)
|
||||||
|
split_list = list(test_list[i*k:(i+1)*k] for i in range(args.machines))
|
||||||
|
tests_to_run = split_list[args.rpcgroup]
|
||||||
|
else:
|
||||||
|
tests_to_run = test_list
|
||||||
|
run_tests(tests_to_run, 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=[]):
|
||||||
BOLD = ("","")
|
BOLD = ("","")
|
||||||
|
|
Loading…
Reference in New Issue