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, shutil | 5 import logging, os, shutil, urllib |
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, httpd | 8 from autotest_lib.client.cros import cros_ui, cros_ui_test, httpd |
9 | 9 |
10 class graphics_WebGLConformance(cros_ui_test.UITest): | 10 class graphics_WebGLConformance(cros_ui_test.UITest): |
11 version = 1 | 11 version = 1 |
12 | 12 |
| 13 # TODO(ihf) not all tests are passing now, maintain this |
| 14 # list was assembled on mario but should be a superset |
| 15 # of all failing configurations |
| 16 waived_tests = { |
| 17 'conformance/premultiplyalpha-test.html' : 8, |
| 18 'conformance/tex-image-and-sub-image-2d-with-array-buffer-view.html' : 1
92, |
| 19 'conformance/tex-image-with-format-and-type.html' : 12, |
| 20 'conformance/texture-npot.html' : 12, |
| 21 'conformance/glsl-conformance.html' : 1, |
| 22 'conformance/tex-image-and-sub-image-2d-with-image.html' : 8, |
| 23 'conformance/copy-tex-image-and-sub-image-2d.html' : 34, |
| 24 'conformance/gl-clear.html' : 4, |
| 25 'conformance/more/functions/readPixelsBadArgs.html' : 1, |
| 26 'conformance/more/conformance/webGLArrays.html' : 1, |
| 27 'conformance/gl-teximage.html' : 46, |
| 28 'conformance/texture-active-bind.html' : 4, |
| 29 'conformance/read-pixels-test.html' : 3, |
| 30 'conformance/gl-object-get-calls.html' : 2, |
| 31 'conformance/point-size.html' : 1, |
| 32 'conformance/texture-formats-test.html' : 4, |
| 33 'conformance/texture-complete.html' : 1, |
| 34 'conformance/tex-image-and-sub-image-2d-with-video.html' : 8, |
| 35 'conformance/context-lost-restored.html' : 2, |
| 36 'conformance/tex-image-and-sub-image-2d-with-image-data.html' : 16 |
| 37 } |
13 | 38 |
14 def initialize(self, creds='$default'): | 39 def initialize(self, creds='$default'): |
15 self._test_url = 'http://localhost:8000/webgl-conformance-tests.html' | 40 self._test_url = 'http://localhost:8000/webgl-conformance-tests.html' |
16 self._testServer = httpd.HTTPListener(8000, docroot=self.srcdir) | 41 self._testServer = httpd.HTTPListener(8000, docroot=self.srcdir) |
17 self._testServer.run() | 42 self._testServer.run() |
18 cros_ui_test.UITest.initialize(self, creds) | 43 cros_ui_test.UITest.initialize(self, creds) |
19 | 44 |
20 | 45 def setup(self, tarball='webgl-conformance-1.0.0.tar.bz2'): |
21 def setup(self, tarball='webgl-tests-0.0.1.tar.bz2'): | |
22 shutil.rmtree(self.srcdir, ignore_errors=True) | 46 shutil.rmtree(self.srcdir, ignore_errors=True) |
23 | |
24 dst_path = os.path.join(self.bindir, 'WebGL') | |
25 tarball_path = os.path.join(self.bindir, tarball) | 47 tarball_path = os.path.join(self.bindir, tarball) |
26 if not os.path.exists(dst_path): | 48 if not os.path.exists(self.srcdir): |
27 if not os.path.exists(tarball_path): | 49 if not os.path.exists(tarball_path): |
28 utils.get_file( | 50 utils.get_file( |
29 'http://commondatastorage.googleapis.com/chromeos-localmirro
r/distfiles/' + tarball, | 51 'http://commondatastorage.googleapis.com/chromeos-localmirro
r/distfiles/' + tarball, |
30 tarball_path) | 52 tarball_path) |
31 utils.extract_tarball_to_dir(tarball_path, dst_path) | 53 utils.extract_tarball_to_dir(tarball_path, self.srcdir) |
32 | |
33 shutil.copytree(os.path.join(self.bindir, 'WebGL'), self.srcdir) | |
34 os.chdir(self.srcdir) | 54 os.chdir(self.srcdir) |
35 utils.system('patch -p1 < ../r11002.patch') | 55 utils.system('patch -p1 < ../webgl-conformance-1.0.0.patch') |
36 | |
37 | 56 |
38 def cleanup(self): | 57 def cleanup(self): |
39 self._testServer.stop() | 58 self._testServer.stop() |
40 cros_ui_test.UITest.cleanup(self) | 59 cros_ui_test.UITest.cleanup(self) |
41 | 60 |
42 | |
43 def run_once(self, timeout=300): | 61 def run_once(self, timeout=300): |
44 latch = self._testServer.add_wait_url('/WebGL/results') | 62 latch = self._testServer.add_wait_url('/WebGL/results') |
45 session = cros_ui.ChromeSession(' --enable-webgl %s' % self._test_url) | 63 cros_ui.ChromeSession(' --enable-webgl %s' % self._test_url) |
46 logging.debug('Chrome session started.') | 64 logging.debug('Chrome session started.') |
47 latch.wait(timeout) | 65 latch.wait(timeout) |
48 | 66 |
49 if not latch.is_set(): | 67 if not latch.is_set(): |
50 raise error.TestFail('Never received callback from browser.') | 68 raise error.TestFail('Never received callback from browser.') |
| 69 |
| 70 # receive data from webgl-conformance-tests.html::postFinalResults |
51 results = self._testServer.get_form_entries() | 71 results = self._testServer.get_form_entries() |
52 total = int(results['total']) | 72 groups_total = int(results['gtotal']) |
53 passed = int(results['pass']) | 73 groups_pass = int(results['gpass']) |
54 if passed < total: | 74 groups_fail = groups_total - groups_pass |
55 raise error.TestFail('Results: %d out of %d tests failed!' % | 75 tests_total = int(results['ttotal']) |
56 (total - passed, total)) | 76 tests_pass = int(results['tpass']) |
| 77 tests_timeout = int(results['ttimeout']) |
| 78 tests_fail = tests_total - tests_pass |
| 79 |
| 80 logging.info('WebGLConformance: %d groups pass', groups_pass) |
| 81 logging.info('WebGLConformance: %d groups fail', groups_fail) |
| 82 logging.info('WebGLConformance: %d tests pass', tests_pass) |
| 83 logging.info('WebGLConformance: %d tests fail', tests_fail) |
| 84 logging.info('WebGLConformance: %d tests timeout', tests_timeout) |
| 85 |
| 86 # output numbers for plotting by harness |
| 87 keyvals = {} |
| 88 keyvals['count_tests_pass'] = tests_pass |
| 89 keyvals['count_tests_fail'] = tests_fail |
| 90 keyvals['count_tests_timeout'] = tests_timeout |
| 91 |
| 92 # handle failed groups/urls and apply waivers |
| 93 failTestRun = False |
| 94 i = 0 |
| 95 for key in results: |
| 96 unquote_key = urllib.unquote_plus(key) |
| 97 if unquote_key.startswith('failed_url:'): |
| 98 new_key = "waived_url_%03d" % i |
| 99 failures = int(results[key]) |
| 100 url = unquote_key[11:] |
| 101 waived_failures = 0 |
| 102 if url in self.waived_tests: |
| 103 waived_failures = self.waived_tests[url] |
| 104 if failures > waived_failures: |
| 105 failTestRun = True |
| 106 new_key = "failed_url_%03d" % i |
| 107 message = url + " : %d failures (%d waived)"\ |
| 108 % (failures, waived_failures) |
| 109 keyvals[new_key] = message |
| 110 logging.info(new_key + " " + message) |
| 111 i = i+1 |
| 112 self.write_perf_keyval(keyvals) |
| 113 |
| 114 # write transmitted summary to graphics_WebGLConformance/summary.txt |
| 115 summary = urllib.unquote_plus(results['summary']) |
| 116 logging.info('\n' + summary) |
| 117 results_path = os.path.join(self.bindir, |
| 118 "../../results/default/graphics_WebGLConformance/summary.txt") |
| 119 f = open(results_path, 'w+') |
| 120 f.write(summary) |
| 121 f.close() |
| 122 |
| 123 # if we saw failures that were not waived raise an error now |
| 124 if failTestRun: |
| 125 raise error.TestFail('Results: saw failures without waivers. ') |
| 126 |
OLD | NEW |