| OLD | NEW |
| 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import logging, os, re, shutil | 5 import logging, os, re, shutil |
| 6 from autotest_lib.client.bin import utils | 6 from autotest_lib.client.bin import utils |
| 7 from autotest_lib.client.common_lib import error | 7 from autotest_lib.client.common_lib import error |
| 8 from autotest_lib.client.cros import cros_ui, cros_ui_test | 8 from autotest_lib.client.cros import cros_ui, cros_ui_test |
| 9 | 9 |
| 10 class graphics_O3DSelenium(cros_ui_test.UITest): | 10 class graphics_O3DSelenium(cros_ui_test.UITest): |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 cmd = cmd + " --browserpath=../../chrome_wrapper" | 61 cmd = cmd + " --browserpath=../../chrome_wrapper" |
| 62 cmd = cmd + " --browser=*googlechrome" | 62 cmd = cmd + " --browser=*googlechrome" |
| 63 cmd = cmd + " --screenshotsdir=tests/selenium/screenshots_chrome" | 63 cmd = cmd + " --screenshotsdir=tests/selenium/screenshots_chrome" |
| 64 cmd = cmd + " --java=/usr/local/lib/icedtea6/bin/java" | 64 cmd = cmd + " --java=/usr/local/lib/icedtea6/bin/java" |
| 65 cmd = cros_ui.xcommand(cmd) | 65 cmd = cros_ui.xcommand(cmd) |
| 66 result = utils.run(cmd, ignore_status = True) | 66 result = utils.run(cmd, ignore_status = True) |
| 67 | 67 |
| 68 # Find out total tests. | 68 # Find out total tests. |
| 69 report = re.findall(r"([0-9]+) tests run.", result.stdout) | 69 report = re.findall(r"([0-9]+) tests run.", result.stdout) |
| 70 if not report: | 70 if not report: |
| 71 return error.TestFail('Output missing: total test number unknown!') | 71 raise error.TestFail('Output missing: total test number unknown!') |
| 72 total = int(report[-1]) | 72 total = int(report[-1]) |
| 73 # Find out failures. | 73 # Find out failures. |
| 74 report = re.findall(r"([0-9]+) errors.", result.stdout) | 74 report = re.findall(r"([0-9]+) errors.", result.stdout) |
| 75 if not report: | 75 if not report: |
| 76 return error.TestFail('Output missing: error number unknown!') | 76 raise error.TestFail('Output missing: error number unknown!') |
| 77 failures = int(report[-1]) | 77 failures = int(report[-1]) |
| 78 report = re.findall(r"([0-9]+) failures.", result.stdout) | 78 report = re.findall(r"([0-9]+) failures.", result.stdout) |
| 79 if not report: | 79 if not report: |
| 80 return error.TestFail('Output missing: failure number unknown!') | 80 raise error.TestFail('Output missing: failure number unknown!') |
| 81 failures += int(report[-1]) | 81 failures += int(report[-1]) |
| 82 logging.info('RESULTS: %d out of %d tests failed!', failures, total) | 82 logging.info('RESULTS: %d out of %d tests failed!', failures, total) |
| 83 | 83 |
| 84 # If all failed cases belong to flaky_test_list, we still pass the test. | 84 # If all failed cases belong to flaky_test_list, we still pass the test. |
| 85 report = re.findall(r"SELENIUMRESULT ([a-zA-Z_0-9]+) " | 85 report = re.findall(r"SELENIUMRESULT ([a-zA-Z_0-9]+) " |
| 86 r"\([a-zA-Z_0-9]+\.[a-zA-Z_0-9]+\) " | 86 r"\([a-zA-Z_0-9]+\.[a-zA-Z_0-9]+\) " |
| 87 r"<\*googlechrome> \[[0-9.s]+\]: FAIL", | 87 r"<\*googlechrome> \[[0-9.s]+\]: FAIL", |
| 88 result.stdout) | 88 result.stdout) |
| 89 ignored_failures = 0 | 89 ignored_failures = 0 |
| 90 error_message = "Unexpected failure cases:" | 90 error_message = "Unexpected failure cases:" |
| 91 for report_item in report: | 91 for report_item in report: |
| 92 if report_item in self.flaky_test_list: | 92 if report_item in self.flaky_test_list: |
| 93 ignored_failures += 1 | 93 ignored_failures += 1 |
| 94 logging.info("FAILURE (ignored): %s" % report_item) | 94 logging.info("FAILURE (ignored): %s" % report_item) |
| 95 else: | 95 else: |
| 96 error_message += " " + report_item | 96 error_message += " " + report_item |
| 97 | 97 |
| 98 if failures > ignored_failures: | 98 if failures > ignored_failures: |
| 99 raise error.TestFail(error_message) | 99 raise error.TestFail(error_message) |
| OLD | NEW |