| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2016 The Chromium Authors. All rights reserved. | 2 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """A Windows-only end-to-end integration test for the Chrome hang watcher. | 6 """A Windows-only end-to-end integration test for the Chrome hang watcher. |
| 7 | 7 |
| 8 This test ensures that the hang watcher is able to detect when Chrome hangs and | 8 This test ensures that the hang watcher is able to detect when Chrome hangs and |
| 9 to generate a Kasko report. The report is then delivered to a locally hosted | 9 to generate a Kasko report. The report is then delivered to a locally hosted |
| 10 test crash server. If a crash report is received then all is well. | 10 test crash server. If a crash report is received then all is well. |
| 11 | 11 |
| 12 Note that this test only works against non-component Release and Official builds | 12 Note that this test only works against non-component Release and Official builds |
| 13 of Chrome with Chrome branding, and attempting to use it with anything else will | 13 of Chrome with Chrome branding, and attempting to use it with anything else will |
| 14 most likely lead to constant failures. | 14 most likely lead to constant failures. |
| 15 | 15 |
| 16 Typical usage (assuming in root 'src' directory): | 16 Typical usage (assuming in root 'src' directory): |
| 17 - generate project files with the following build variables: | 17 - generate project files with the following build variables: |
| 18 GYP variables: | 18 GYP variables: |
| 19 branding=Chrome kasko=1 kasko_hang_reports=1 | 19 branding=Chrome kasko_hang_reports=1 |
| 20 GN variables: | 20 GN variables: |
| 21 target_cpu = "x86" | 21 target_cpu = "x86" |
| 22 is_debug = false | 22 is_debug = false |
| 23 is_chrome_branded = true | 23 is_chrome_branded = true |
| 24 enable_kasko = true | |
| 25 enable_kasko_hang_reports = true | 24 enable_kasko_hang_reports = true |
| 26 - build the release Chrome binaries: | 25 - build the release Chrome binaries: |
| 27 ninja -C {build_dir} chrome.exe chromedriver.exe | 26 ninja -C {build_dir} chrome.exe chromedriver.exe |
| 28 - run the test: | 27 - run the test: |
| 29 python chrome/test/kasko/hang_watcher_integration_test.py | 28 python chrome/test/kasko/hang_watcher_integration_test.py |
| 30 --chrome={build_dir}\chrome.exe | 29 --chrome={build_dir}\chrome.exe |
| 31 """ | 30 """ |
| 32 | 31 |
| 33 import logging | 32 import logging |
| 34 import os | 33 import os |
| 35 import sys | 34 import sys |
| 36 | 35 |
| 37 # Bring in the Kasko module. | 36 # Bring in the Kasko module. |
| 38 KASKO_DIR = os.path.join(os.path.dirname(__file__), 'py') | 37 KASKO_DIR = os.path.join(os.path.dirname(__file__), 'py') |
| 39 sys.path.append(KASKO_DIR) | 38 sys.path.append(KASKO_DIR) |
| 40 import kasko | 39 import kasko |
| 41 | 40 |
| 42 | 41 |
| 43 _LOGGER = logging.getLogger(os.path.basename(__file__)) | 42 _LOGGER = logging.getLogger(os.path.basename(__file__)) |
| 44 | 43 |
| 45 | 44 |
| 46 def Main(): | 45 def Main(): |
| 47 options = kasko.config.ParseCommandLine() | 46 options = kasko.config.ParseCommandLine() |
| 48 | 47 |
| 49 kasko.integration_test.RunTest(options, | 48 kasko.integration_test.RunTest( |
| 50 'chrome://delayeduithreadhang', | 49 options, |
| 51 120, | 50 'chrome://delayeduithreadhang', |
| 52 {'hung-process': 'DumpHungBrowserProcess()'}) | 51 120, |
| 52 { |
| 53 'hung-process': 'DumpHungBrowserProcess()', |
| 54 'hung-process-is-deadlock': 'GetThreadWaitChain()', |
| 55 'hung-process-wait-chain-00': 'GetThreadWaitChain()', |
| 56 }) |
| 53 | 57 |
| 54 _LOGGER.info('Test passed successfully!') | 58 _LOGGER.info('Test passed successfully!') |
| 55 | 59 |
| 56 return 0 | 60 return 0 |
| 57 | 61 |
| 58 | 62 |
| 59 if __name__ == '__main__': | 63 if __name__ == '__main__': |
| 60 sys.exit(Main()) | 64 sys.exit(Main()) |
| OLD | NEW |