summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2021-03-29 13:59:49 +0200
committerFlorian Bruhin <me@the-compiler.org>2021-03-29 23:42:14 +0200
commit179d85274f9ed1cfd3f73087704fc075bd0f6f69 (patch)
tree083eb2fcaca9665e645b2933dfb692a5ee12a812 /scripts
parent8a0d7a5be801b4d7370b97ad14715a7c9261226d (diff)
downloadqutebrowser-179d85274f9ed1cfd3f73087704fc075bd0f6f69.tar.gz
qutebrowser-179d85274f9ed1cfd3f73087704fc075bd0f6f69.zip
scripts: Show debug run output on failed smoke test
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/dev/build_release.py67
1 files changed, 60 insertions, 7 deletions
diff --git a/scripts/dev/build_release.py b/scripts/dev/build_release.py
index bcc5a3701..6149bd234 100755
--- a/scripts/dev/build_release.py
+++ b/scripts/dev/build_release.py
@@ -100,6 +100,20 @@ def _filter_whitelisted(output, patterns):
yield line
+def _smoke_test_run(executable, *args):
+ """Get a subprocess to run a smoke test."""
+ argv = [
+ executable,
+ '--no-err-windows',
+ '--nowindow',
+ '--temp-basedir',
+ *args,
+ 'about:blank',
+ ':later 500 quit',
+ ]
+ return subprocess.run(argv, check=True, capture_output=True)
+
+
def smoke_test(executable):
"""Try starting the given qutebrowser executable."""
stdout_whitelist = []
@@ -132,15 +146,54 @@ def smoke_test(executable):
r'module could not be found. \(0x7E\)'),
]
- proc = subprocess.run([executable, '--no-err-windows', '--nowindow',
- '--temp-basedir', 'about:blank',
- ':later 500 quit'], check=True, capture_output=True)
+ proc = _smoke_test_run(executable)
stdout = '\n'.join(_filter_whitelisted(proc.stdout, stdout_whitelist))
stderr = '\n'.join(_filter_whitelisted(proc.stderr, stderr_whitelist))
- if stdout:
- raise Exception("Unexpected stdout:\n{}".format(stdout))
- if stderr:
- raise Exception("Unexpected stderr:\n{}".format(stderr))
+
+ if stdout or stderr:
+ print("Unexpected output, running with --debug")
+ proc = _smoke_test_run(executable, '--debug')
+ debug_stdout = proc.stdout.decode('utf-8')
+ debug_stderr = proc.stderr.decode('utf-8')
+
+ lines = [
+ "Unexpected output!",
+ "",
+ ]
+ if stdout:
+ lines += [
+ "stdout",
+ "------",
+ "",
+ stdout,
+ "",
+ ]
+ if stderr:
+ lines += [
+ "stderr",
+ "------",
+ "",
+ stderr,
+ "",
+ ]
+ if debug_stdout:
+ lines += [
+ "debug rerun stdout",
+ "------------------",
+ "",
+ debug_stdout,
+ "",
+ ]
+ if debug_stderr:
+ lines += [
+ "debug rerun stderr",
+ "------------------",
+ "",
+ debug_stderr,
+ "",
+ ]
+
+ raise Exception("\n".join(lines))
def patch_windows_exe(exe_path):