Commit 012f5b96 authored by Victor Stinner's avatar Victor Stinner Committed by GitHub

bpo-34605, libregrtest: Rename --slaveargs to --worker-args (GH-9099)

Rename also run_tests_slave() to run_tests_worker().
parent 23e65b25
...@@ -170,7 +170,7 @@ def _create_parser(): ...@@ -170,7 +170,7 @@ def _create_parser():
group.add_argument('--wait', action='store_true', group.add_argument('--wait', action='store_true',
help='wait for user input, e.g., allow a debugger ' help='wait for user input, e.g., allow a debugger '
'to be attached') 'to be attached')
group.add_argument('--slaveargs', metavar='ARGS') group.add_argument('--worker-args', metavar='ARGS')
group.add_argument('-S', '--start', metavar='START', group.add_argument('-S', '--start', metavar='START',
help='the name of the test at which to start.' + help='the name of the test at which to start.' +
more_details) more_details)
......
...@@ -542,9 +542,9 @@ class Regrtest: ...@@ -542,9 +542,9 @@ class Regrtest:
print(msg, file=sys.stderr, flush=True) print(msg, file=sys.stderr, flush=True)
sys.exit(2) sys.exit(2)
if self.ns.slaveargs is not None: if self.ns.worker_args is not None:
from test.libregrtest.runtest_mp import run_tests_slave from test.libregrtest.runtest_mp import run_tests_worker
run_tests_slave(self.ns.slaveargs) run_tests_worker(self.ns.worker_args)
if self.ns.wait: if self.ns.wait:
input("Press any key to continue...") input("Press any key to continue...")
......
...@@ -24,23 +24,23 @@ WAIT_PROGRESS = 2.0 # seconds ...@@ -24,23 +24,23 @@ WAIT_PROGRESS = 2.0 # seconds
def run_test_in_subprocess(testname, ns): def run_test_in_subprocess(testname, ns):
"""Run the given test in a subprocess with --slaveargs. """Run the given test in a subprocess with --worker-args.
ns is the option Namespace parsed from command-line arguments. regrtest ns is the option Namespace parsed from command-line arguments. regrtest
is invoked in a subprocess with the --slaveargs argument; when the is invoked in a subprocess with the --worker-args argument; when the
subprocess exits, its return code, stdout and stderr are returned as a subprocess exits, its return code, stdout and stderr are returned as a
3-tuple. 3-tuple.
""" """
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
ns_dict = vars(ns) ns_dict = vars(ns)
slaveargs = (ns_dict, testname) worker_args = (ns_dict, testname)
slaveargs = json.dumps(slaveargs) worker_args = json.dumps(worker_args)
cmd = [sys.executable, *support.args_from_interpreter_flags(), cmd = [sys.executable, *support.args_from_interpreter_flags(),
'-u', # Unbuffered stdout and stderr '-u', # Unbuffered stdout and stderr
'-m', 'test.regrtest', '-m', 'test.regrtest',
'--slaveargs', slaveargs] '--worker-args', worker_args]
if ns.pgo: if ns.pgo:
cmd += ['--pgo'] cmd += ['--pgo']
...@@ -58,8 +58,8 @@ def run_test_in_subprocess(testname, ns): ...@@ -58,8 +58,8 @@ def run_test_in_subprocess(testname, ns):
return retcode, stdout, stderr return retcode, stdout, stderr
def run_tests_slave(slaveargs): def run_tests_worker(worker_args):
ns_dict, testname = json.loads(slaveargs) ns_dict, testname = json.loads(worker_args)
ns = types.SimpleNamespace(**ns_dict) ns = types.SimpleNamespace(**ns_dict)
setup_tests(ns) setup_tests(ns)
......
...@@ -67,10 +67,10 @@ class ParseArgsTestCase(unittest.TestCase): ...@@ -67,10 +67,10 @@ class ParseArgsTestCase(unittest.TestCase):
ns = libregrtest._parse_args(['--wait']) ns = libregrtest._parse_args(['--wait'])
self.assertTrue(ns.wait) self.assertTrue(ns.wait)
def test_slaveargs(self): def test_worker_args(self):
ns = libregrtest._parse_args(['--slaveargs', '[[], {}]']) ns = libregrtest._parse_args(['--worker-args', '[[], {}]'])
self.assertEqual(ns.slaveargs, '[[], {}]') self.assertEqual(ns.worker_args, '[[], {}]')
self.checkError(['--slaveargs'], 'expected one argument') self.checkError(['--worker-args'], 'expected one argument')
def test_start(self): def test_start(self):
for opt in '-S', '--start': for opt in '-S', '--start':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment