diff options
| author | Guang Zhu <guangzhu@google.com> | 2009-06-04 11:03:57 -0700 | 
|---|---|---|
| committer | Guang Zhu <guangzhu@google.com> | 2009-06-04 11:03:57 -0700 | 
| commit | 17f8fa6b24da34724b4497622f374b27f3041e1c (patch) | |
| tree | 1a92246f128f38ae4f80e41772b87d71676d079a /tests | |
| parent | 3d3e307a63144b1bddd534fefd35a557223d52bf (diff) | |
| download | frameworks_base-17f8fa6b24da34724b4497622f374b27f3041e1c.zip frameworks_base-17f8fa6b24da34724b4497622f374b27f3041e1c.tar.gz frameworks_base-17f8fa6b24da34724b4497622f374b27f3041e1c.tar.bz2 | |
Added bugreport collecting mechanism in case of crashes.
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/DumpRenderTree/assets/run_reliability_tests.py | 32 | 
1 files changed, 31 insertions, 1 deletions
| diff --git a/tests/DumpRenderTree/assets/run_reliability_tests.py b/tests/DumpRenderTree/assets/run_reliability_tests.py index 6aab009..076c508 100755 --- a/tests/DumpRenderTree/assets/run_reliability_tests.py +++ b/tests/DumpRenderTree/assets/run_reliability_tests.py @@ -10,8 +10,10 @@  import logging  import optparse +import os  import subprocess  import sys +import time  TEST_LIST_FILE = "/sdcard/android/reliability_tests_list.txt"  TEST_STATUS_FILE = "/sdcard/android/reliability_running_test.txt" @@ -46,6 +48,20 @@ def RemoveDeviceFile(adb_cmd, file_name):                     stderr=subprocess.PIPE).communicate() +def Bugreport(url, bugreport_dir, adb_cmd): +  """Pull a bugreport from the device.""" +  bugreport_filename = "%s/reliability_bugreport_%d.txt" % (bugreport_dir, +                                                            int(time.time())) + +  # prepend the report with url +  handle = open(bugreport_filename, "w") +  handle.writelines("Bugreport for crash in url - %s\n\n" % url) +  handle.close() + +  cmd = "%s bugreport >> %s" % (adb_cmd, bugreport_filename) +  os.system(cmd) + +  def main(options, args):    """Send the url list to device and start testing, restart if crashed.""" @@ -80,6 +96,16 @@ def main(options, args):    else:      manual_delay = options.delay +  if not options.bugreport: +    bugreport_dir = "." +  else: +    bugreport_dir = options.bugreport +  if not os.path.exists(bugreport_dir): +    os.makedirs(bugreport_dir) +  if not os.path.isdir(bugreport_dir): +    logging.error("Cannot create results dir: " + bugreport_dir) +    sys.exit(1) +    adb_cmd = "adb "    if options.adb_options:      adb_cmd += options.adb_options + " " @@ -128,6 +154,7 @@ def main(options, args):                                      stdout=subprocess.PIPE).communicate()[0]      logging.info(crashed_test + " CRASHED")      crashed_tests.append(crashed_test) +    Bugreport(crashed_test, bugreport_dir, adb_cmd)      logging.info("Resuming reliability test runner...")      adb_output = subprocess.Popen(test_cmd, shell=True, stdout=subprocess.PIPE, @@ -172,9 +199,12 @@ if "__main__" == __name__:                             help="the list of sites that cause browser to crash")    option_parser.add_option("-f", "--timeout-file",                             default="reliability_timedout_sites.txt", -                           help="the list of sites that timedout during test.") +                           help="the list of sites that timedout during test")    option_parser.add_option("-d", "--delay",                             default=0,                             help="add a manual delay between pages (in ms)") +  option_parser.add_option("-b", "--bugreport", +                           default=".", +                           help="the directory to store bugreport for crashes")    opts, arguments = option_parser.parse_args()    main(opts, arguments) | 
