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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/android.py

Issue 2800853003: webkitpy: Unify the exit status codes. (Closed)
Patch Set: webkitpy: Unify the exit status codes. Created 3 years, 8 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) 2012 Google Inc. All rights reserved. 1 # Copyright (C) 2012 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 18 matching lines...) Expand all
29 import itertools 29 import itertools
30 import logging 30 import logging
31 import os 31 import os
32 import re 32 import re
33 import sys 33 import sys
34 import threading 34 import threading
35 import time 35 import time
36 36
37 from multiprocessing.pool import ThreadPool 37 from multiprocessing.pool import ThreadPool
38 38
39 from webkitpy.common import exit_codes
39 from webkitpy.common.system.executive import ScriptError 40 from webkitpy.common.system.executive import ScriptError
40 from webkitpy.layout_tests.breakpad.dump_reader_multipart import DumpReaderAndro id 41 from webkitpy.layout_tests.breakpad.dump_reader_multipart import DumpReaderAndro id
41 from webkitpy.layout_tests.models import test_run_results 42 from webkitpy.layout_tests.models import test_run_results
42 from webkitpy.layout_tests.port import base 43 from webkitpy.layout_tests.port import base
43 from webkitpy.layout_tests.port import linux 44 from webkitpy.layout_tests.port import linux
44 from webkitpy.layout_tests.port import driver 45 from webkitpy.layout_tests.port import driver
45 from webkitpy.layout_tests.port import factory 46 from webkitpy.layout_tests.port import factory
46 from webkitpy.layout_tests.port import server_process 47 from webkitpy.layout_tests.port import server_process
47 from webkitpy.common.system.profiler import SingleFileOutputProfiler 48 from webkitpy.common.system.profiler import SingleFileOutputProfiler
48 49
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 # marked as slow tests on desktop platforms. 349 # marked as slow tests on desktop platforms.
349 return 10 * 1000 350 return 10 * 1000
350 351
351 def driver_stop_timeout(self): 352 def driver_stop_timeout(self):
352 # The driver doesn't respond to closing stdin, so we might as well stop the driver immediately. 353 # The driver doesn't respond to closing stdin, so we might as well stop the driver immediately.
353 return 0.0 354 return 0.0
354 355
355 def default_child_processes(self): 356 def default_child_processes(self):
356 usable_devices = self._devices.usable_devices(self._executive) 357 usable_devices = self._devices.usable_devices(self._executive)
357 if not usable_devices: 358 if not usable_devices:
358 raise test_run_results.TestRunException(test_run_results.NO_DEVICES_ EXIT_STATUS, 359 raise test_run_results.TestRunException(exit_codes.NO_DEVICES_EXIT_S TATUS,
359 'Unable to find any attached Android devices.') 360 'Unable to find any attached Android devices.')
360 return len(usable_devices) 361 return len(usable_devices)
361 362
362 def max_drivers_per_process(self): 363 def max_drivers_per_process(self):
363 # Android falls over when we try to run multiple content_shells per work er. 364 # Android falls over when we try to run multiple content_shells per work er.
364 # See https://codereview.chromium.org/1158323009/ 365 # See https://codereview.chromium.org/1158323009/
365 return 1 366 return 1
366 367
367 def check_build(self, needs_http, printer): 368 def check_build(self, needs_http, printer):
368 exit_status = super(AndroidPort, self).check_build(needs_http, printer) 369 exit_status = super(AndroidPort, self).check_build(needs_http, printer)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 try: 413 try:
413 pool.map(setup_device, range(num_workers)) 414 pool.map(setup_device, range(num_workers))
414 except KeyboardInterrupt: 415 except KeyboardInterrupt:
415 pool.terminate() 416 pool.terminate()
416 raise 417 raise
417 else: 418 else:
418 setup_device(0) 419 setup_device(0)
419 420
420 if not self._devices.prepared_devices(): 421 if not self._devices.prepared_devices():
421 _log.error('Could not prepare any devices for testing.') 422 _log.error('Could not prepare any devices for testing.')
422 return test_run_results.NO_DEVICES_EXIT_STATUS 423 return exit_codes.NO_DEVICES_EXIT_STATUS
423 return test_run_results.OK_EXIT_STATUS 424 return exit_codes.OK_EXIT_STATUS
424 425
425 def setup_test_run(self): 426 def setup_test_run(self):
426 super(AndroidPort, self).setup_test_run() 427 super(AndroidPort, self).setup_test_run()
427 428
428 # By setting this on the options object, we can propagate the list 429 # By setting this on the options object, we can propagate the list
429 # of prepared devices to the workers (it is read in __init__()). 430 # of prepared devices to the workers (it is read in __init__()).
430 if self._devices._prepared_devices: 431 if self._devices._prepared_devices:
431 self._options.prepared_devices = self._devices.prepared_devices() 432 self._options.prepared_devices = self._devices.prepared_devices()
432 else: 433 else:
433 # We were called with --no-build, so assume the devices are up to da te. 434 # We were called with --no-build, so assume the devices are up to da te.
434 self._options.prepared_devices = [d.get_serial() for d in self._devi ces.usable_devices(self.host.executive)] 435 self._options.prepared_devices = [d.get_serial() for d in self._devi ces.usable_devices(self.host.executive)]
435 436
436 def num_workers(self, requested_num_workers): 437 def num_workers(self, requested_num_workers):
437 return min(len(self._options.prepared_devices), requested_num_workers) 438 return min(len(self._options.prepared_devices), requested_num_workers)
438 439
439 def check_sys_deps(self, needs_http): 440 def check_sys_deps(self, needs_http):
440 for (font_dirs, font_file, package) in HOST_FONT_FILES: 441 for (font_dirs, font_file, package) in HOST_FONT_FILES:
441 exists = False 442 exists = False
442 for font_dir in font_dirs: 443 for font_dir in font_dirs:
443 font_path = font_dir + font_file 444 font_path = font_dir + font_file
444 if self._check_file_exists(font_path, '', more_logging=False): 445 if self._check_file_exists(font_path, '', more_logging=False):
445 exists = True 446 exists = True
446 break 447 break
447 if not exists: 448 if not exists:
448 _log.error('You are missing %s under %s. Try installing %s. See build instructions.', 449 _log.error('You are missing %s under %s. Try installing %s. See build instructions.',
449 font_file, font_dirs, package) 450 font_file, font_dirs, package)
450 return test_run_results.SYS_DEPS_EXIT_STATUS 451 return exit_codes.SYS_DEPS_EXIT_STATUS
451 return test_run_results.OK_EXIT_STATUS 452 return exit_codes.OK_EXIT_STATUS
452 453
453 def requires_http_server(self): 454 def requires_http_server(self):
454 """Chromium Android runs tests on devices, and uses the HTTP server to 455 """Chromium Android runs tests on devices, and uses the HTTP server to
455 serve the actual layout tests to the test driver. 456 serve the actual layout tests to the test driver.
456 """ 457 """
457 return True 458 return True
458 459
459 def start_http_server(self, additional_dirs, number_of_drivers): 460 def start_http_server(self, additional_dirs, number_of_drivers):
460 additional_dirs[PERF_TEST_PATH_PREFIX] = self.perf_tests_dir() 461 additional_dirs[PERF_TEST_PATH_PREFIX] = self.perf_tests_dir()
461 additional_dirs[LAYOUT_TEST_PATH_PREFIX] = self.layout_tests_dir() 462 additional_dirs[LAYOUT_TEST_PATH_PREFIX] = self.layout_tests_dir()
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 return command 1126 return command
1126 1127
1127 def _read_prompt(self, deadline): 1128 def _read_prompt(self, deadline):
1128 last_char = '' 1129 last_char = ''
1129 while True: 1130 while True:
1130 current_char = self._server_process.read_stdout(deadline, 1) 1131 current_char = self._server_process.read_stdout(deadline, 1)
1131 if current_char == ' ': 1132 if current_char == ' ':
1132 if last_char in ('#', '$'): 1133 if last_char in ('#', '$'):
1133 return 1134 return
1134 last_char = current_char 1135 last_char = current_char
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698