Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Unified Diff: chrome/test/kasko/hang_watcher_integration_test.py

Issue 1543803005: Added an integration test for kasko hang reports (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/chrome_watcher/chrome_watcher_main_api.h ('k') | chrome/test/kasko/kasko_integration_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/kasko/hang_watcher_integration_test.py
diff --git a/chrome/test/kasko/kasko_integration_test.py b/chrome/test/kasko/hang_watcher_integration_test.py
old mode 100755
new mode 100644
similarity index 91%
copy from chrome/test/kasko/kasko_integration_test.py
copy to chrome/test/kasko/hang_watcher_integration_test.py
index 669ff0c7c60e471d3e13cdaceee337ca11738bde..078f064f32463feaad33a9f8826ac4d49d083163
--- a/chrome/test/kasko/kasko_integration_test.py
+++ b/chrome/test/kasko/hang_watcher_integration_test.py
@@ -3,12 +3,11 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-"""A Windows-only end-to-end integration test for Kasko, Chrome and Crashpad.
+"""A Windows-only end-to-end integration test for the Kasko hang watcher.
-This test ensures that the interface between Kasko and Chrome and Crashpad works
-as expected. The test causes Kasko to set certain crash keys and invoke a crash
-report, which is in turn delivered to a locally hosted test crash server. If the
-crash report is received intact with the expected crash keys then all is well.
+This test ensures that Kasko is able to detect when Chrome is hanged and to
+generate a report. The report is then delivered to a locally hosted test crash
+server. If a crash report is received then all is well.
Note that this test only works against non-component Release and Official builds
of Chrome with Chrome branding, and attempting to use it with anything else will
@@ -17,11 +16,12 @@ most likely lead to constant failures.
Typical usage (assuming in root 'src' directory):
- generate project files with the following GYP variables:
- branding=Chrome syzyasan=1 win_z7=0 chromium_win_pch=0
-- build the release Chrome binaries:
+ branding=Chrome kasko=1 kasko_hang_reports=1
+- build the release Chrome binaries and driver:
ninja -C out\Release chrome.exe
+ ninja -C out\Release chromedriver.exe
- run the test:
- python chrome/test/kasko/kasko_integration_test.py --chrome-dir=out/Release
+ python chrome/test/kasko/kasko_integration_test.py
Many of the components in this test could be reused in other end-to-end crash
testing. Feel free to open them up for reuse, but please CC chrisha@chromium.org
@@ -350,7 +350,8 @@ def _GetProcessCreationDate(pid):
procs = wmi.ExecQuery(
'select CreationDate from Win32_Process where ProcessId = %s' % pid)
for proc in procs:
- return _WmiTimeToLocalEpoch(proc.Properties_['CreationDate'].Value)
+ print _WmiTimeToLocalEpoch(proc.Properties_('CreationDate').Value)
+ return _WmiTimeToLocalEpoch(proc.Properties_('CreationDate').Value)
raise Exception('Unable to find process with PID %d.' % pid)
@@ -367,14 +368,14 @@ def _ShutdownChildren(parent_pid, child_exe, started_after, started_before,
wmi = win32com.client.GetObject('winmgmts:')
_LOGGER.debug('Shutting down lingering children processes.')
for proc in wmi.InstancesOf('Win32_Process'):
- if proc.Properties_['ParentProcessId'].Value != parent_pid:
+ if proc.Properties_('ParentProcessId').Value != parent_pid:
Patrick Monette 2015/12/23 17:24:46 chrisha: Does this work on your PC?
continue
- if proc.Properties_['ExecutablePath'].Value != child_exe:
+ if proc.Properties_('ExecutablePath').Value != child_exe:
continue
- t = _WmiTimeToLocalEpoch(proc.Properties_['CreationDate'].Value)
+ t = _WmiTimeToLocalEpoch(proc.Properties_('CreationDate').Value)
if t <= started_after or t >= started_before:
continue
- pid = proc.Properties_['ProcessId'].Value
+ pid = proc.Properties_('ProcessId').Value
remaining = max(0, started + timeout - time.time())
_ShutdownProcess(pid, remaining, force=force)
@@ -531,28 +532,24 @@ def Main():
os.environ['KASKO_CRASH_SERVER_URL'] = (
'http://127.0.0.1:%d/crash' % server.port)
- # Launch Chrome and navigate it to the test URL.
+ # Launch Chrome and navigate to the hang URL.
chrome = _ChromeInstance(options.chromedriver, options.chrome,
user_data_dir)
with _ScopedStartStop(chrome):
- _LOGGER.info('Navigating to Kasko debug URL')
- chrome.navigate_to('chrome://kasko/send-report')
+ _LOGGER.info('Navigating to the hang debug url')
+ chrome.navigate_to('chrome://uithreadhang')
_LOGGER.info('Waiting for Kasko report')
- if not server.wait_for_report(10):
- raise Exception('No Kasko report received.')
-
- report = server.crash(0)
- for (key, value) in report.iteritems():
- val = value[0]
- if (len(val) < 64):
- _LOGGER.debug('Got crashkey "%s": "%s"', key, val)
- else:
- _LOGGER.debug('Got crashkey "%s": ...%d bytes...', key, len(val))
- kasko_key = 'kasko-set-crash-key-value-impl'
- if kasko_key not in report:
- _LOGGER.error('Missing expected "%s" crash key.', kasko_key)
- raise Exception('SendCrashKeyValueImpl integration appears broken.')
+
+ # The report can take as long as 80 seconds to be generated because
+ # the polling is done every 60 seconds and the watcher gives 20
+ # seconds to Chrome to ping back before being considered hanged.
+ if not server.wait_for_report(120):
+ raise Exception('No Kasko report received')
+
+ _LOGGER.info('Received Kasko report successfully')
+ # TODO(pmonette): Verify that the report contains the crash keys that
+ # are expected when they will work.
return 0
« no previous file with comments | « chrome/chrome_watcher/chrome_watcher_main_api.h ('k') | chrome/test/kasko/kasko_integration_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698