Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py

Issue 23496003: User interruption should still create results.html for run-webkit-tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rework-patchset3 Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 18 matching lines...) Expand all
29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 30
31 import codecs 31 import codecs
32 import json 32 import json
33 import logging 33 import logging
34 import os 34 import os
35 import platform 35 import platform
36 import Queue 36 import Queue
37 import re 37 import re
38 import StringIO 38 import StringIO
39 import signal
39 import sys 40 import sys
40 import thread 41 import thread
41 import time 42 import time
42 import threading 43 import threading
43 import webkitpy.thirdparty.unittest2 as unittest 44 import webkitpy.thirdparty.unittest2 as unittest
44 45
45 from webkitpy.common.system import outputcapture, path 46 from webkitpy.common.system import outputcapture, path
46 from webkitpy.common.system.crashlogs_unittest import make_mock_crash_report_dar win 47 from webkitpy.common.system.crashlogs_unittest import make_mock_crash_report_dar win
47 from webkitpy.common.system.systemhost import SystemHost 48 from webkitpy.common.system.systemhost import SystemHost
48 from webkitpy.common.host import Host 49 from webkitpy.common.host import Host
49 from webkitpy.common.host_mock import MockHost 50 from webkitpy.common.host_mock import MockHost
50 51
51 from webkitpy.layout_tests import port 52 from webkitpy.layout_tests import port
52 from webkitpy.layout_tests import run_webkit_tests 53 from webkitpy.layout_tests import run_webkit_tests
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
60 # This mirrors what the shell normally does.
61 INTERRUPTED_EXIT_STATUS = signal.SIGINT + 128
59 62
60 def parse_args(extra_args=None, tests_included=False, new_results=False, print_n othing=True): 63 def parse_args(extra_args=None, tests_included=False, new_results=False, print_n othing=True):
61 extra_args = extra_args or [] 64 extra_args = extra_args or []
62 args = [] 65 args = []
63 if not '--platform' in extra_args: 66 if not '--platform' in extra_args:
64 args.extend(['--platform', 'test']) 67 args.extend(['--platform', 'test'])
65 if not new_results: 68 if not new_results:
66 args.append('--no-new-test-results') 69 args.append('--no-new-test-results')
67 70
68 if not '--child-processes' in extra_args: 71 if not '--child-processes' in extra_args:
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 287
285 def test_full_results_html(self): 288 def test_full_results_html(self):
286 host = MockHost() 289 host = MockHost()
287 details, _, _ = logging_run(['--full-results-html'], host=host) 290 details, _, _ = logging_run(['--full-results-html'], host=host)
288 self.assertEqual(details.exit_code, 0) 291 self.assertEqual(details.exit_code, 0)
289 self.assertEqual(len(host.user.opened_urls), 1) 292 self.assertEqual(len(host.user.opened_urls), 1)
290 293
291 def test_keyboard_interrupt(self): 294 def test_keyboard_interrupt(self):
292 # Note that this also tests running a test marked as SKIP if 295 # Note that this also tests running a test marked as SKIP if
293 # you specify it explicitly. 296 # you specify it explicitly.
294 self.assertRaises(KeyboardInterrupt, logging_run, ['failures/expected/ke yboard.html', '--child-processes', '1'], tests_included=True) 297 host = MockHost()
298 details, _, _ = logging_run(['failures/expected/keyboard.html', '--child -processes', '1'], tests_included=True, host=host)
299 self.assertEqual(details.exit_code, INTERRUPTED_EXIT_STATUS)
295 300
296 if self.should_test_processes: 301 if self.should_test_processes:
297 self.assertRaises(KeyboardInterrupt, logging_run, 302 _, 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) 303 self.assertTrue(any(['Running 1 ' in line for line in regular_output .buflist]))
299 304
300 def test_no_tests_found(self): 305 def test_no_tests_found(self):
301 details, err, _ = logging_run(['resources'], tests_included=True) 306 details, err, _ = logging_run(['resources'], tests_included=True)
302 self.assertEqual(details.exit_code, -1) 307 self.assertEqual(details.exit_code, -1)
303 self.assertContains(err, 'No tests to run.\n') 308 self.assertContains(err, 'No tests to run.\n')
304 309
305 def test_no_tests_found_2(self): 310 def test_no_tests_found_2(self):
306 details, err, _ = logging_run(['foo'], tests_included=True) 311 details, err, _ = logging_run(['foo'], tests_included=True)
307 self.assertEqual(details.exit_code, -1) 312 self.assertEqual(details.exit_code, -1)
308 self.assertContains(err, 'No tests to run.\n') 313 self.assertContains(err, 'No tests to run.\n')
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 return FakeRunDetails() 960 return FakeRunDetails()
956 961
957 def exception_raising_run(port, options, args, stderr): 962 def exception_raising_run(port, options, args, stderr):
958 assert False 963 assert False
959 964
960 stdout = StringIO.StringIO() 965 stdout = StringIO.StringIO()
961 stderr = StringIO.StringIO() 966 stderr = StringIO.StringIO()
962 try: 967 try:
963 run_webkit_tests.run = interrupting_run 968 run_webkit_tests.run = interrupting_run
964 res = run_webkit_tests.main([], stdout, stderr) 969 res = run_webkit_tests.main([], stdout, stderr)
965 self.assertEqual(res, run_webkit_tests.INTERRUPTED_EXIT_STATUS) 970 self.assertEqual(res, INTERRUPTED_EXIT_STATUS)
966 971
967 run_webkit_tests.run = successful_run 972 run_webkit_tests.run = successful_run
968 res = run_webkit_tests.main(['--platform', 'test'], stdout, stderr) 973 res = run_webkit_tests.main(['--platform', 'test'], stdout, stderr)
969 self.assertEqual(res, -1) 974 self.assertEqual(res, -1)
970 975
971 run_webkit_tests.run = exception_raising_run 976 run_webkit_tests.run = exception_raising_run
972 res = run_webkit_tests.main([], stdout, stderr) 977 res = run_webkit_tests.main([], stdout, stderr)
973 self.assertEqual(res, run_webkit_tests.EXCEPTIONAL_EXIT_STATUS) 978 self.assertEqual(res, run_webkit_tests.EXCEPTIONAL_EXIT_STATUS)
974 finally: 979 finally:
975 run_webkit_tests.run = orig_run_fn 980 run_webkit_tests.run = orig_run_fn
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698