tests: Add --qute-strace-subprocs flag
Was needed for #8444 debugging, but might be useful for other issues with qutebrowser subprocesses as well.
This commit is contained in:
parent
3934d727e4
commit
977c90939c
|
|
@ -239,6 +239,8 @@ def pytest_addoption(parser):
|
|||
help="Delay (in ms) after qutebrowser process started.")
|
||||
parser.addoption('--qute-profile-subprocs', action='store_true',
|
||||
default=False, help="Run cProfile for subprocesses.")
|
||||
parser.addoption('--qute-strace-subprocs', action='store_true',
|
||||
default=False, help="Run strace for subprocesses.")
|
||||
parser.addoption('--qute-backend', action='store',
|
||||
choices=['webkit', 'webengine'], help='Set backend for BDD tests')
|
||||
|
||||
|
|
|
|||
|
|
@ -399,24 +399,37 @@ class QuteProc(testprocess.Process):
|
|||
|
||||
def _executable_args(self):
|
||||
profile = self.request.config.getoption('--qute-profile-subprocs')
|
||||
strace = self.request.config.getoption('--qute-strace-subprocs')
|
||||
if hasattr(sys, 'frozen'):
|
||||
if profile:
|
||||
raise RuntimeError("Can't profile with sys.frozen!")
|
||||
if profile or strace:
|
||||
raise RuntimeError("Can't profile/strace with sys.frozen!")
|
||||
executable = str(pathlib.Path(sys.executable).parent / 'qutebrowser')
|
||||
args = []
|
||||
else:
|
||||
executable = sys.executable
|
||||
if strace:
|
||||
executable = 'strace'
|
||||
args = [
|
||||
"-o",
|
||||
"qb-strace",
|
||||
"--output-separately", # create .PID files
|
||||
"--write=2", # dump full stderr data (qb JSON logs)
|
||||
sys.executable,
|
||||
]
|
||||
else:
|
||||
executable = sys.executable
|
||||
args = []
|
||||
|
||||
if profile:
|
||||
profile_dir = pathlib.Path.cwd() / 'prof'
|
||||
profile_id = '{}_{}'.format(self._instance_id,
|
||||
next(self._run_counter))
|
||||
profile_file = profile_dir / '{}.pstats'.format(profile_id)
|
||||
profile_dir.mkdir(exist_ok=True)
|
||||
args = [str(pathlib.Path('scripts') / 'dev' / 'run_profile.py'),
|
||||
args += [str(pathlib.Path('scripts') / 'dev' / 'run_profile.py'),
|
||||
'--profile-tool', 'none',
|
||||
'--profile-file', str(profile_file)]
|
||||
else:
|
||||
args = ['-bb', '-m', 'qutebrowser']
|
||||
args += ['-bb', '-m', 'qutebrowser']
|
||||
return executable, args
|
||||
|
||||
def _default_args(self):
|
||||
|
|
|
|||
Loading…
Reference in New Issue