summaryrefslogtreecommitdiffstats
path: root/mojo
diff options
context:
space:
mode:
authormsw <msw@chromium.org>2015-10-09 16:31:49 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-09 23:32:30 +0000
commit545d351a6c1ef0bdac30a66a51b4717215cd971a (patch)
treed8547474393dadd7ba8d24e42505a0d8ba7f5f76 /mojo
parent28cdc5c19e5e96f919ac4c22992a772fae391199 (diff)
downloadchromium_src-545d351a6c1ef0bdac30a66a51b4717215cd971a.zip
chromium_src-545d351a6c1ef0bdac30a66a51b4717215cd971a.tar.gz
chromium_src-545d351a6c1ef0bdac30a66a51b4717215cd971a.tar.bz2
Add temporary apptest debug logging for diagnosing hangs.
Add logging to _run_test to find the last subprocess/thread location. Seek if hangs are amid the function body or elsewhere in threading.py. From scottmg's suggestion: http://crbug.com/517661#c7 The stdio logging StreamHandler should flush on each call: http://stackoverflow.com/questions/16633911/does-python-logging-flush-every-log BUG=517661 TEST=Better logging for hung apptests. R=sky@chromium.org,scottmg@chromium.org Review URL: https://codereview.chromium.org/1395233002 Cr-Commit-Position: refs/heads/master@{#353426}
Diffstat (limited to 'mojo')
-rw-r--r--mojo/tools/mopy/gtest.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/mojo/tools/mopy/gtest.py b/mojo/tools/mopy/gtest.py
index 1b3afbb..f96c9b6 100644
--- a/mojo/tools/mopy/gtest.py
+++ b/mojo/tools/mopy/gtest.py
@@ -220,22 +220,33 @@ def _run_test_with_timeout(config, shell, args, apptest, env, seconds=10):
def _run_test(config, shell, args, apptest, env, result):
'''Run the test; put the shell/proc, output, and any exception in |result|.'''
+ # TODO(msw): Remove deubg logging after fixing http://crbug.com/517661
+ logging.getLogger().debug('MSW _run_test')
output = ''
exception = ''
try:
if config.target_os != Config.OS_ANDROID:
+ logging.getLogger().debug('MSW _run_test A')
command = _build_command_line(config, args, apptest)
+ logging.getLogger().debug('MSW _run_test B')
process = subprocess.Popen(command, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, env=env)
+ logging.getLogger().debug('MSW _run_test C')
result.put(process)
+ logging.getLogger().debug('MSW _run_test D')
(output, stderr_output) = process.communicate()
+ logging.getLogger().debug('MSW _run_test E')
if process.returncode:
+ logging.getLogger().debug('MSW _run_test F')
exception = 'Error: Test exited with code: %d\n%s' % (
process.returncode, stderr_output)
elif config.is_verbose:
+ logging.getLogger().debug('MSW _run_test G')
output += '\n' + stderr_output
if output.startswith('This program contains tests'):
+ logging.getLogger().debug('MSW _run_test H')
exception = 'Error: GTest printed help; check command line flags.'
+ logging.getLogger().debug('MSW _run_test I')
else:
assert shell
result.put(shell)
@@ -246,6 +257,9 @@ def _run_test(config, shell, args, apptest, env, result):
shell.StartActivity('MojoShellActivity', arguments, wf, wf.close)
output = rf.read()
except Exception as e:
+ logging.getLogger().debug('MSW _run_test J')
output += (e.output + '\n') if hasattr(e, 'output') else ''
exception += str(e)
+ logging.getLogger().debug('MSW _run_test K')
result.put((output, exception))
+ logging.getLogger().debug('MSW _run_test L')