OLD | NEW |
1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
2 # Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Sze
ged | 2 # Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Sze
ged |
3 # Copyright (C) 2011 Apple Inc. All rights reserved. | 3 # Copyright (C) 2011 Apple Inc. All rights reserved. |
4 # | 4 # |
5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
7 # met: | 7 # met: |
8 # | 8 # |
9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 import webkitpy.thirdparty.unittest2 as unittest | 43 import webkitpy.thirdparty.unittest2 as unittest |
44 | 44 |
45 from webkitpy.common.system import outputcapture, path | 45 from webkitpy.common.system import outputcapture, path |
46 from webkitpy.common.system.crashlogs_unittest import make_mock_crash_report_dar
win | 46 from webkitpy.common.system.crashlogs_unittest import make_mock_crash_report_dar
win |
47 from webkitpy.common.system.systemhost import SystemHost | 47 from webkitpy.common.system.systemhost import SystemHost |
48 from webkitpy.common.host import Host | 48 from webkitpy.common.host import Host |
49 from webkitpy.common.host_mock import MockHost | 49 from webkitpy.common.host_mock import MockHost |
50 | 50 |
51 from webkitpy.layout_tests import port | 51 from webkitpy.layout_tests import port |
52 from webkitpy.layout_tests import run_webkit_tests | 52 from webkitpy.layout_tests import run_webkit_tests |
| 53 from webkitpy.layout_tests.models.test_run_results import INTERRUPTED_EXIT_STATU
S |
53 from webkitpy.layout_tests.port import Port | 54 from webkitpy.layout_tests.port import Port |
54 from webkitpy.layout_tests.port import test | 55 from webkitpy.layout_tests.port import test |
55 from webkitpy.test.skip import skip_if | 56 from webkitpy.test.skip import skip_if |
56 from webkitpy.tool import grammar | 57 from webkitpy.tool import grammar |
57 from webkitpy.tool.mocktool import MockOptions | 58 from webkitpy.tool.mocktool import MockOptions |
58 | 59 |
59 | 60 |
60 def parse_args(extra_args=None, tests_included=False, new_results=False, print_n
othing=True): | 61 def parse_args(extra_args=None, tests_included=False, new_results=False, print_n
othing=True): |
61 extra_args = extra_args or [] | 62 extra_args = extra_args or [] |
62 args = [] | 63 args = [] |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 285 |
285 def test_full_results_html(self): | 286 def test_full_results_html(self): |
286 host = MockHost() | 287 host = MockHost() |
287 details, _, _ = logging_run(['--full-results-html'], host=host) | 288 details, _, _ = logging_run(['--full-results-html'], host=host) |
288 self.assertEqual(details.exit_code, 0) | 289 self.assertEqual(details.exit_code, 0) |
289 self.assertEqual(len(host.user.opened_urls), 1) | 290 self.assertEqual(len(host.user.opened_urls), 1) |
290 | 291 |
291 def test_keyboard_interrupt(self): | 292 def test_keyboard_interrupt(self): |
292 # Note that this also tests running a test marked as SKIP if | 293 # Note that this also tests running a test marked as SKIP if |
293 # you specify it explicitly. | 294 # you specify it explicitly. |
294 self.assertRaises(KeyboardInterrupt, logging_run, ['failures/expected/ke
yboard.html', '--child-processes', '1'], tests_included=True) | 295 details, _, _ = logging_run(['failures/expected/keyboard.html', '--child
-processes', '1'], tests_included=True) |
| 296 self.assertEqual(details.exit_code, INTERRUPTED_EXIT_STATUS) |
295 | 297 |
296 if self.should_test_processes: | 298 if self.should_test_processes: |
297 self.assertRaises(KeyboardInterrupt, logging_run, | 299 _, regular_output, _ = logging_run(['failures/expected/keyboard.html
', 'passes/text.html', '--child-processes', '2', '--skipped=ignore'], tests_incl
uded=True, shared_port=False) |
298 ['failures/expected/keyboard.html', 'passes/text.html', '--child
-processes', '2', '--skipped=ignore'], tests_included=True, shared_port=False) | 300 self.assertTrue(any(['Interrupted, exiting' in line for line in regu
lar_output.buflist])) |
299 | 301 |
300 def test_no_tests_found(self): | 302 def test_no_tests_found(self): |
301 details, err, _ = logging_run(['resources'], tests_included=True) | 303 details, err, _ = logging_run(['resources'], tests_included=True) |
302 self.assertEqual(details.exit_code, -1) | 304 self.assertEqual(details.exit_code, -1) |
303 self.assertContains(err, 'No tests to run.\n') | 305 self.assertContains(err, 'No tests to run.\n') |
304 | 306 |
305 def test_no_tests_found_2(self): | 307 def test_no_tests_found_2(self): |
306 details, err, _ = logging_run(['foo'], tests_included=True) | 308 details, err, _ = logging_run(['foo'], tests_included=True) |
307 self.assertEqual(details.exit_code, -1) | 309 self.assertEqual(details.exit_code, -1) |
308 self.assertContains(err, 'No tests to run.\n') | 310 self.assertContains(err, 'No tests to run.\n') |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
955 return FakeRunDetails() | 957 return FakeRunDetails() |
956 | 958 |
957 def exception_raising_run(port, options, args, stderr): | 959 def exception_raising_run(port, options, args, stderr): |
958 assert False | 960 assert False |
959 | 961 |
960 stdout = StringIO.StringIO() | 962 stdout = StringIO.StringIO() |
961 stderr = StringIO.StringIO() | 963 stderr = StringIO.StringIO() |
962 try: | 964 try: |
963 run_webkit_tests.run = interrupting_run | 965 run_webkit_tests.run = interrupting_run |
964 res = run_webkit_tests.main([], stdout, stderr) | 966 res = run_webkit_tests.main([], stdout, stderr) |
965 self.assertEqual(res, run_webkit_tests.INTERRUPTED_EXIT_STATUS) | 967 self.assertEqual(res, INTERRUPTED_EXIT_STATUS) |
966 | 968 |
967 run_webkit_tests.run = successful_run | 969 run_webkit_tests.run = successful_run |
968 res = run_webkit_tests.main(['--platform', 'test'], stdout, stderr) | 970 res = run_webkit_tests.main(['--platform', 'test'], stdout, stderr) |
969 self.assertEqual(res, -1) | 971 self.assertEqual(res, -1) |
970 | 972 |
971 run_webkit_tests.run = exception_raising_run | 973 run_webkit_tests.run = exception_raising_run |
972 res = run_webkit_tests.main([], stdout, stderr) | 974 res = run_webkit_tests.main([], stdout, stderr) |
973 self.assertEqual(res, run_webkit_tests.EXCEPTIONAL_EXIT_STATUS) | 975 self.assertEqual(res, run_webkit_tests.EXCEPTIONAL_EXIT_STATUS) |
974 finally: | 976 finally: |
975 run_webkit_tests.run = orig_run_fn | 977 run_webkit_tests.run = orig_run_fn |
OLD | NEW |