rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
update_status_url = "%s/patch-status/%s/%s" % (self.url, queue_name, patch_id) return self._fetch_url(update_status_url)
patch_status_url = "%s/patch-status/%s/%s" % (self.url, queue_name, patch_id) return self._fetch_url(patch_status_url)
def patch_status(self, queue_name, patch_id): update_status_url = "%s/patch-status/%s/%s" % (self.url, queue_name, patch_id) return self._fetch_url(update_status_url)
Committer("Mike Fenton", ["mike.fenton@torchmobile.com", "mifenton@rim.com"], "mfenton"),
Committer("Mike Fenton", ["mifenton@rim.com", "mike.fenton@torchmobile.com"], "mfenton"),
def __init__(self, name, email_or_emails, irc_nickname=None): Committer.__init__(self, name, email_or_emails, irc_nickname) self.can_review = True
self.nonce = None
self.nonce_time = None
def serve_forever(self): self.stop = False self.nonce = None while not self.stop: self.handle_request() self.socket.close()
nonce_life = 10 stale = False if (not self.server.nonce or (time.time() - self.server.nonce_time > nonce_life)): if self.server.nonce: stale = True self.server.nonce_time = time.time() self.server.nonce = \ _new_md5(time.ctime(self.server.nonce_time) + 'privatekey').hexdigest() nonce = self.server.nonce
stale = 'stale' in self.path nonce = self.GetNonce(force_reset=stale)
def AuthDigestHandler(self): """This handler tests 'Digest' authentication. It just sends a page with title 'user/pass' if you succeed."""
now = time.time()
def testForge(self): """Brief test of forging history items.
'time': now})
'time': new_time})
def testForge(self): """Brief test of forging history items.
self.assertTrue(abs(now - history[0]['time']) < 1.0)
self.assertTrue(abs(new_time - history[0]['time']) < 1.0)
def testForge(self): """Brief test of forging history items.
test_args, png_path, shell_args = self._get_dump_render_tree_args(i)
test_args, png_path, shell_args = \ self._get_dump_render_tree_args(i)
def _instantiate_dump_render_tree_threads(self, test_files, result_summary): """Instantitates and starts the TestShellThread(s).
percent_complete = 100 * (result_summary.expected + result_summary.unexpected) / result_summary.total self._meter.update("Testing (%d%%): %d ran as expected, %d didn't, %d left" % (percent_complete, result_summary.expected,
percent_complete = 100 * (result_summary.expected + result_summary.unexpected) / result_summary.total self._meter.update("Testing (%d%%): %d ran as expected, %d didn't," " %d left" % (percent_complete, result_summary.expected,
def _display_one_line_progress(self, result_summary): """Displays the progress through the test run.""" percent_complete = 100 * (result_summary.expected + result_summary.unexpected) / result_summary.total self._meter.update("Testing (%d%%): %d ran as expected, %d didn't, %d left" % (percent_complete, result_summary.ex...
optparse.make_option("--log", action="store", default="detailed-progress,unexpected", help="log various types of data. The param should be a comma-separated list of values from: " "actual,config," + LOG_DETAILED_PROGRESS + ",expected,timing," + LOG_UNEXPECTED + " " "(defaults to " + "--log detailed-progress,unexpected)...
optparse.make_option("--log", action="store", default="detailed-progress,unexpected", help="log various types of data. The param should be a " + "comma-separated list of values from: " + "actual,config," + LOG_DETAILED_PROGRESS + ",expected,timing," + LOG_UNEXPECTED + " " + "(defaults to " + "--log detailed-progress,un...
def parse_args(args=None): """Provides a default set of command line args. Returns a tuple of options, args from optparse""" # FIXME: All of these options should be stored closer to the code which actually uses them. # FIXME: configuration_options should move to WebKitPort and be shared across all scripts. configurat...
optparse.make_option("-p", "--pixel-tests'", action="store_true", dest="pixel_tests", help="Enable pixel-to-pixel PNG comparisons"), optparse.make_option("--no-pixel-tests", action="store_false", dest="pixel_tests", help="Disable pixel-to-pixel PNG comparisons"), optparse.make_option("--fuzzy-pixel-tests", action="stor...
optparse.make_option("-p", "--pixel-tests'", action="store_true", dest="pixel_tests", help="Enable pixel-to-pixel PNG comparisons"), optparse.make_option("--no-pixel-tests", action="store_false", dest="pixel_tests", help="Disable pixel-to-pixel PNG comparisons"), optparse.make_option("--fuzzy-pixel-tests", action="stor...
def parse_args(args=None): """Provides a default set of command line args. Returns a tuple of options, args from optparse""" # FIXME: All of these options should be stored closer to the code which actually uses them. # FIXME: configuration_options should move to WebKitPort and be shared across all scripts. configurat...
optparse.make_option("--noshow-results", action="store_true", default=False, help="Don't launch a browser with results after the tests are done"), optparse.make_option("--full-results-html", action="store_true", default=False, help="Show all failures in results.html, rather than only regressions"), optparse.make_optio...
optparse.make_option("--noshow-results", action="store_true", default=False, help="Don't launch a browser with results after the tests " "are done"), optparse.make_option("--full-results-html", action="store_true", default=False, help="Show all failures in results.html, rather than only " "regressions"), optparse.ma...
def parse_args(args=None): """Provides a default set of command line args. Returns a tuple of options, args from optparse""" # FIXME: All of these options should be stored closer to the code which actually uses them. # FIXME: configuration_options should move to WebKitPort and be shared across all scripts. configurat...
optparse.make_option("--wrapper", help="wrapper command to insert before invocations of DumpRenderTree; option is split " "on whitespace before running. (Example: --wrapper='valgrind --smc-check=all')"), optparse.make_option("--test-list", action="append", help="read list of tests to run from file", metavar="FILE"), ...
optparse.make_option("--wrapper", help="wrapper command to insert before invocations of " "DumpRenderTree; option is split on whitespace before " "running. (Example: --wrapper='valgrind --smc-check=all')"), optparse.make_option("--test-list", action="append", help="read list of tests to run from file", metavar="FILE...
def parse_args(args=None): """Provides a default set of command line args. Returns a tuple of options, args from optparse""" # FIXME: All of these options should be stored closer to the code which actually uses them. # FIXME: configuration_options should move to WebKitPort and be shared across all scripts. configurat...
optparse.make_option("--randomize-order", action="store_true", default=False, help=("Run tests in random order (useful for tracking down corruption)")), optparse.make_option("--run-chunk", help=("Run a specified chunk (n:l), the nth of len l, of the layout tests")), optparse.make_option("--run-part", help=("Run a speci...
optparse.make_option("--randomize-order", action="store_true", default=False, help=("Run tests in random order (useful " "for tracking down corruption)")), optparse.make_option("--run-chunk", help=("Run a specified chunk (n:l), the nth of len l, " "of the layout tests")), optparse.make_option("--run-part", help=("Run a...
def parse_args(args=None): """Provides a default set of command line args. Returns a tuple of options, args from optparse""" # FIXME: All of these options should be stored closer to the code which actually uses them. # FIXME: configuration_options should move to WebKitPort and be shared across all scripts. configurat...
optparse.make_option("--lint-test-files", action="store_true", default=False, help="Makes sure the test files parse for all configurations. Does not run any tests."),
optparse.make_option("--lint-test-files", action="store_true", default=False, help=("Makes sure the test files parse for all " "configurations. Does not run any tests.")),
def parse_args(args=None): """Provides a default set of command line args. Returns a tuple of options, args from optparse""" # FIXME: All of these options should be stored closer to the code which actually uses them. # FIXME: configuration_options should move to WebKitPort and be shared across all scripts. configurat...
optparse.make_option("--builder-name", default="DUMMY_BUILDER_NAME", help=("The name of the builder shown on the waterfall running this script e.g. WebKit.")), optparse.make_option("--build-name", default="DUMMY_BUILD_NAME", help=("The name of the builder used in its path, e.g. webkit-rel.")), optparse.make_option("--b...
optparse.make_option("--builder-name", default="DUMMY_BUILDER_NAME", help=("The name of the builder shown on the waterfall running " "this script e.g. WebKit.")), optparse.make_option("--build-name", default="DUMMY_BUILD_NAME", help=("The name of the builder used in its path, e.g. " "webkit-rel.")), optparse.make_optio...
def parse_args(args=None): """Provides a default set of command line args. Returns a tuple of options, args from optparse""" # FIXME: All of these options should be stored closer to the code which actually uses them. # FIXME: configuration_options should move to WebKitPort and be shared across all scripts. configurat...
option_list = configuration_options + logging_options + chromium_options + results_options + test_options + misc_options + results_json_options
option_list = (configuration_options + logging_options + chromium_options + results_options + test_options + misc_options + results_json_options)
def parse_args(args=None): """Provides a default set of command line args. Returns a tuple of options, args from optparse""" # FIXME: All of these options should be stored closer to the code which actually uses them. # FIXME: configuration_options should move to WebKitPort and be shared across all scripts. configurat...
env['GTEST_TOTAL_SHARDS'] = str(self._num_shards) env['GTEST_SHARD_INDEX'] = str(self._shard)
if 'GTEST_TOTAL_SHARDS' in env: outer_shards = int(env['GTEST_TOTAL_SHARDS']) outer_index = int(env['GTEST_SHARD_INDEX']) env['GTEST_TOTAL_SHARDS'] = str(self._num_shards * outer_shards) env['GTEST_SHARD_INDEX'] = str((self._num_shards * outer_index) + self._shard) else: env['GTEST_TOTAL_SHARDS'] = str(self._num_s...
def launch(self): env = os.environ.copy() env['GTEST_TOTAL_SHARDS'] = str(self._num_shards) env['GTEST_SHARD_INDEX'] = str(self._shard)
def IsWhiteListedExtension(file_path): """Returns True if file_path has an extension we want to ignore.""" return WHITELIST_EXTENSIONS_REGEX.match(os.path.splitext(file_path)[1]) def IsWhiteListedPath(file_path): """Returns True if file_path ends with a path we want to ignore.""" return WHITELIST_FILES_REGEX.search(f...
def IsWhiteListed(file_path): """Returns True if file_path is in our whitelist of files to ignore.""" if WHITELIST_EXTENSIONS_REGEX.match(os.path.splitext(file_path)[1]): return True if WHITELIST_FILES_REGEX.search(file_path): return True if os.path.basename(file_path) in WHITELIST_FILENAMES: return True
def IsWhiteListedExtension(file_path): """Returns True if file_path has an extension we want to ignore.""" return WHITELIST_EXTENSIONS_REGEX.match(os.path.splitext(file_path)[1])
if IsWhiteListedExtension(file_path_lower): return None if IsWhiteListedPath(file_path_lower): return None if IsWhiteListedRegex(file_path_lower):
if IsWhiteListed(file_path_lower):
def CheckFile(file_path): """Checks file_path's permissions. Args: file_path: The file path to check. Returns: Either a string describing the error if there was one, or None if the file checked out OK. """ if VERBOSE: print 'Checking file: ' + file_path file_path_lower = file_path.lower() # Check to see if it's whit...
We return nonzero if there are regressions compared to the last run.
The number of unexpected results (0 == success)
def run(self, result_summary): """Run all our tests on all our test files.
"""Run the tests. Will call sys.exit when complete.
"""Run the tests.
def main(options, args): """Run the tests. Will call sys.exit when complete. Args: options: a dictionary of command line options args: a list of sub directories or files to test """ if options.sources: options.verbose = True # Set up our logging format. meter = metered_stream.MeteredStream(options.verbose, sys.stde...
sys.exit(0)
return 0
def main(options, args): """Run the tests. Will call sys.exit when complete. Args: options: a dictionary of command line options args: a list of sub directories or files to test """ if options.sources: options.verbose = True # Set up our logging format. meter = metered_stream.MeteredStream(options.verbose, sys.stde...
sys.exit(1)
return -1
def main(options, args): """Run the tests. Will call sys.exit when complete. Args: options: a dictionary of command line options args: a list of sub directories or files to test """ if options.sources: options.verbose = True # Set up our logging format. meter = metered_stream.MeteredStream(options.verbose, sys.stde...
has_new_failures = test_runner.run(result_summary)
num_unexpected_results = test_runner.run(result_summary)
def main(options, args): """Run the tests. Will call sys.exit when complete. Args: options: a dictionary of command line options args: a list of sub directories or files to test """ if options.sources: options.verbose = True # Set up our logging format. meter = metered_stream.MeteredStream(options.verbose, sys.stde...
_log.debug("Exit status: %d" % has_new_failures) sys.exit(has_new_failures)
_log.debug("Exit status: %d" % num_unexpected_results) return num_unexpected_results
def main(options, args): """Run the tests. Will call sys.exit when complete. Args: options: a dictionary of command line options args: a list of sub directories or files to test """ if options.sources: options.verbose = True # Set up our logging format. meter = metered_stream.MeteredStream(options.verbose, sys.stde...
main(options, args)
sys.exit(main(options, args))
def parse_args(args=None): """Provides a default set of command line args. Returns a tuple of options, args from optparse""" # FIXME: All of these options should be stored closer to the code which actually uses them. # FIXME: configuration_options should move to WebKitPort and be shared across all scripts. configurat...
'tools', 'layout_tests', 'layout_package', 'lighttpd.conf')
'tools', 'layout_tests', 'webkitpy', 'layout_tests', 'layout_package', 'lighttpd.conf')
def Start(self): if self.IsRunning(): raise 'Lighttpd already running'
SANITY_TEST_SUPPRESSIONS = [ "Memcheck sanity test (array deleted without []).", "Memcheck sanity test (malloc/read left).", "Memcheck sanity test (malloc/read right).", "Memcheck sanity test (malloc/write left).", "Memcheck sanity test (malloc/write right).", "Memcheck sanity test (memory leak).", "Memcheck sanity tes...
SANITY_TEST_SUPPRESSIONS_LINUX = { "Memcheck sanity test 01 (memory leak).": 1, "Memcheck sanity test 02 (malloc/read left).": 1, "Memcheck sanity test 03 (malloc/read right).": 1, "Memcheck sanity test 04 (malloc/write left).": 1, "Memcheck sanity test 05 (malloc/write right).": 1, "Memcheck sanity test 06 (new/read l...
def find_and_truncate(f): f.seek(0) while True: line = f.readline() if line == "": return False if '</valgrindoutput>' in line: # valgrind often has garbage after </valgrindoutput> upon crash f.truncate() return True
remaining_sanity_supp = set(MemcheckAnalyze.SANITY_TEST_SUPPRESSIONS) for item in sorted(self._suppcounts.items(), key=lambda (k,v): (v,k)): print "%7s %s" % (item[1], item[0]) if item[0] in remaining_sanity_supp: remaining_sanity_supp.remove(item[0])
if common.IsLinux(): remaining_sanity_supp = MemcheckAnalyze.SANITY_TEST_SUPPRESSIONS_LINUX elif common.IsMac(): remaining_sanity_supp = MemcheckAnalyze.SANITY_TEST_SUPPRESSIONS_MAC else: remaining_sanity_supp = {} if check_sanity: logging.warn("No sanity test list for platform %s", sys.platform) for (name, count) in ...
def Report(self, check_sanity=False): if self._parse_failed: logging.error("FAIL! Couldn't parse Valgrind output file") return -2
for supp in remaining_sanity_supp: logging.info(" " + supp)
for (name, count) in sorted(remaining_sanity_supp.items(), key=lambda (k,v): (v,k)): logging.info("%7d %s" % (count, name))
def Report(self, check_sanity=False): if self._parse_failed: logging.error("FAIL! Couldn't parse Valgrind output file") return -2
uri = self.filename_to_uri(results_filename)
uri = self.get_absolute_path(results_filename)
def show_results_html_file(self, results_filename): uri = self.filename_to_uri(results_filename) if self._options.use_drt: # FIXME: This should use User.open_url webbrowser.open(uri, new=1) else: # Note: Not thread safe: http://bugs.python.org/issue2320 subprocess.Popen([self._path_to_driver(), uri])
self.assertEqual('google.com/', self.GetOmniboxInfo().Text())
self.assertTrue('google.com' in self.GetOmniboxInfo().Text())
def testInlinAutoComplete(self): """Verify inline autocomplete for a pre-visited url.""" self.NavigateToURL('http://www.google.com') matches = self._GetOmniboxMatchesFor('goog') self.assertTrue(matches) # Omnibox should suggest auto completed url as the first item matches_description = matches[0] self.assertTrue('www.g...
self._batch_count = 0 self._batch_size = self._options.batch_size
self._filename_list = []
def __init__(self, port, options, worker_number, worker_name, filename_list_queue, result_queue): """Initialize all the local state for this DumpRenderTree thread.
self._have_http_lock = False self._test_runner = None self._result_summary = None self._test_list_timing_stats = {}
self._test_group_timing_stats = {}
def __init__(self, port, options, worker_number, worker_name, filename_list_queue, result_queue): """Initialize all the local state for this DumpRenderTree thread.
tests_run_filename = os.path.join(self._options.results_directory, "tests_run.txt") self._tests_run_file = codecs.open(tests_run_filename, "a", "utf-8") def __del__(self): self._cleanup()
self._current_group = None self._num_tests_in_current_group = None self._current_group_start_time = None
def __init__(self, port, options, worker_number, worker_name, filename_list_queue, result_queue): """Initialize all the local state for this DumpRenderTree thread.
return self._test_list_timing_stats
return self._test_group_timing_stats
def get_test_group_timing_stats(self): """Returns a dictionary mapping test group to a tuple of (number of tests in that group, time to run the tests)""" return self._test_list_timing_stats
def next_timeout(self): """Return the time the test is supposed to finish by.""" if self._next_timeout: return self._next_timeout + self._http_lock_wait_time() return self._next_timeout
def get_num_tests(self): return self._num_tests
_log.debug('%s starting' % (self._name))
_log.debug('%s starting' % (self.getName()))
def _covered_run(self): # FIXME: this is a separate routine to work around a bug # in coverage: see http://bitbucket.org/ned/coveragepy/issue/85. self._thread_id = thread.get_ident() self._start_time = time.time() try: _log.debug('%s starting' % (self._name)) self._run(test_runner=None, result_summary=None) _log.debug(...
_log.debug('%s done (%d tests)' % (self._name, self._num_tests))
_log.debug('%s done (%d tests)' % (self.getName(), self.get_num_tests()))
def _covered_run(self): # FIXME: this is a separate routine to work around a bug # in coverage: see http://bitbucket.org/ned/coveragepy/issue/85. self._thread_id = thread.get_ident() self._start_time = time.time() try: _log.debug('%s starting' % (self._name)) self._run(test_runner=None, result_summary=None) _log.debug(...
_log.debug("%s interrupted" % self._name)
_log.debug("%s interrupted" % self.getName())
def _covered_run(self): # FIXME: this is a separate routine to work around a bug # in coverage: see http://bitbucket.org/ned/coveragepy/issue/85. self._thread_id = thread.get_ident() self._start_time = time.time() try: _log.debug('%s starting' % (self._name)) self._run(test_runner=None, result_summary=None) _log.debug(...
_log.error('%s dying, exception raised' % self._name)
_log.error('%s dying, exception raised' % self.getName())
def _covered_run(self): # FIXME: this is a separate routine to work around a bug # in coverage: see http://bitbucket.org/ned/coveragepy/issue/85. self._thread_id = thread.get_ident() self._start_time = time.time() try: _log.debug('%s starting' % (self._name)) self._run(test_runner=None, result_summary=None) _log.debug(...
with the results of each test during _tear_down_test(), below.""" self._test_runner = test_runner self._result_summary = result_summary while not self._canceled: try: current_group, filename_list = \ self._filename_list_queue.get_nowait() self.handle_test_list(current_group, filename_list) except Queue.Empty: break i...
with the results of each test.""" batch_size = self._options.batch_size batch_count = 0 tests_run_filename = os.path.join(self._options.results_directory, "tests_run.txt") tests_run_file = codecs.open(tests_run_filename, "a", "utf-8") while True:
def _run(self, test_runner, result_summary): """Main work entry point of the thread. Basically we pull urls from the filename queue and run the tests until we run out of urls.
break num_tests += 1 elapsed_time = time.time() - start_time if self._have_http_lock: self._stop_servers_with_lock() self._test_list_timing_stats[list_name] = \ (num_tests, elapsed_time) def _run_test(self, test_input): self._set_up_test(test_input) driver_timeout_sec = 3.0 * float(test_input.timeout) / 10...
_log.debug('Testing cancelled') tests_run_file.close() return if len(self._filename_list) is 0: if self._current_group is not None: self._test_group_timing_stats[self._current_group] = \ (self._num_tests_in_current_group, time.time() - self._current_group_start_time) try: self._current_group, self._filename_list = \ ...
def handle_test_list(self, list_name, test_list): if list_name == "tests_to_http_lock": self._start_servers_with_lock()
thread_timeout_sec: time to wait before killing the driver process.
def _run_test_in_another_thread(self, test_input, thread_timeout_sec): """Run a test in a separate thread, enforcing a hard time limit.
worker = self result = None driver = worker._port.create_driver(worker._worker_number) driver.start() class SingleTestThread(threading.Thread): def run(self): result = worker._run_single_test(driver, test_input) thread = SingleTestThread() thread.start() thread.join(thread_timeout_sec) if thread.isAlive():
worker = SingleTestThread(self._port, self._options, self._worker_number, self._name, test_input, self._test_types, self._test_args) worker.start() thread_timeout = _milliseconds_to_seconds( _pad_timeout(int(test_input.timeout))) thread._next_timeout = time.time() + thread_timeout worker.join(thread_timeout) if worke...
def _run_test_in_another_thread(self, test_input, thread_timeout_sec): """Run a test in a separate thread, enforcing a hard time limit.
driver.stop() if not result:
if worker._driver: worker._driver.stop() try: result = worker.get_test_result() except AttributeError, e: failures = [] _log.error('Cannot get results of test: %s' % test_input.filename)
def run(self): result = worker._run_single_test(driver, test_input)
test_result = self._run_single_test(test_input, self._driver) self._test_results.append(test_result) return test_result def _run_single_test(self, test_input, driver): if self._should_fetch_expected_checksum(): test_input.image_hash = self._port.expected_checksum( test_input.filename) test_output = driver.run_test...
def _run_test_in_this_thread(self, test_input): """Run a single test file using a shared DumpRenderTree process.
_log.debug('Acquiring http lock ...')
_log.debug('Acquire http lock ...')
def _start_servers_with_lock(self): self._http_lock_wait_begin = time.time() _log.debug('Acquiring http lock ...') self._port.acquire_http_lock() _log.debug('Starting HTTP server ...') self._port.start_http_server() _log.debug('Starting WebSocket server ...') self._port.start_websocket_server() self._http_lock_wait_end...
def _http_lock_wait_time(self): """Return the time what http locking takes.""" if self._http_lock_wait_begin == 0: return 0 if self._http_lock_wait_end == 0: return time.time() - self._http_lock_wait_begin return self._http_lock_wait_end - self._http_lock_wait_begin
def _start_servers_with_lock(self): self._http_lock_wait_begin = time.time() _log.debug('Acquiring http lock ...') self._port.acquire_http_lock() _log.debug('Starting HTTP server ...') self._port.start_http_server() _log.debug('Starting WebSocket server ...') self._port.start_websocket_server() self._http_lock_wait_end...
wake_time = datetime.now() + timedelta(seconds=cls.seconds_to_sleep) return "%s Sleeping until %s (%s)." % (message, wake_time.strftime(cls.log_date_format), cls.sleep_duration_text)
wake_time = datetime.now() + timedelta(seconds=self.seconds_to_sleep) return "%s Sleeping until %s (%s)." % (message, wake_time.strftime(self.log_date_format), self.sleep_duration_text)
def _sleep_message(self, message): wake_time = datetime.now() + timedelta(seconds=cls.seconds_to_sleep) return "%s Sleeping until %s (%s)." % (message, wake_time.strftime(cls.log_date_format), cls.sleep_duration_text)
test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads', 'crazy_filenames') data_file = os.path.join(test_dir, 'download_filenames') filenames = filter(os.path.isfile, os.listdir(test_dir)) logging.info('Testing with %d crazy filenames' % len(filenames)) for filename in filenames: downloaded_file = os.path...
crazy_filenames = self._EvalDataFrom('crazy_filenames.txt') logging.info('Testing with %d crazy filenames' % len(crazy_filenames))
def testCrazyFilenames(self): """Test downloading with filenames containing special chars.""" download_dir = self.GetDownloadDirectory().value() test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads', 'crazy_filenames') data_file = os.path.join(test_dir, 'download_filenames') filenames = filter(os.path.is...
downloads = self.GetDownloadsInfo().Downloads() self.assertEqual(len(downloads), len(filenames))
def _CreateFile(name): """Create and fill the given file with some junk.""" fp = open(name, 'w') print >>fp, 'This is a junk file named %s. ' % name * 100 fp.close()
def testCrazyFilenames(self): """Test downloading with filenames containing special chars.""" download_dir = self.GetDownloadDirectory().value() test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads', 'crazy_filenames') data_file = os.path.join(test_dir, 'download_filenames') filenames = filter(os.path.is...
for filename in filenames: downloaded_file = os.path.join(download_dir, filename) self.assertTrue(os.path.exists(downloaded_file)) self.assertEqual( self._ComputeMD5sum(downloaded_file), self._ComputeMD5sum(os.path.join(test_dir, filename))) os.path.exists(downloaded_file) and os.remove(downloaded_file)
temp_dir = tempfile.mkdtemp(prefix='download') try: for filename in crazy_filenames: file_path = os.path.join(temp_dir, filename) _CreateFile(file_path) file_url = self.GetFileURLForPath(file_path) downloaded_file = os.path.join(download_dir, filename) os.path.exists(downloaded_file) and os.remove(downloaded_file) self...
def testCrazyFilenames(self): """Test downloading with filenames containing special chars.""" download_dir = self.GetDownloadDirectory().value() test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads', 'crazy_filenames') data_file = os.path.join(test_dir, 'download_filenames') filenames = filter(os.path.is...
def testDownloadInIncognito(self): """Download a zip in incognito window and verify.
downloads = self.GetDownloadsInfo().Downloads() self.assertEqual(len(downloads), len(crazy_filenames))
def testDownloadInIncognito(self): """Download a zip in incognito window and verify.
Also verify that the download shelf showed up. """ test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads') checksum_file = os.path.join(test_dir, 'a_zip_file.md5sum') file_url = self.GetFileURLForPath(os.path.join(test_dir, 'a_zip_file.zip')) golden_md5sum = urllib.urlopen(checksum_file).read() downloaded...
for filename in crazy_filenames: downloaded_file = os.path.join(download_dir, filename) self.assertTrue(os.path.exists(downloaded_file)) self.assertEqual( self._ComputeMD5sum(downloaded_file), self._ComputeMD5sum(os.path.join(temp_dir, filename))) os.path.exists(downloaded_file) and os.remove(downloaded_file) finally: ...
def testDownloadInIncognito(self): """Download a zip in incognito window and verify.
subprocess.call(['taskkill.exe', '/PID', pid])
subprocess.call(['taskkill.exe', '/PID', str(pid)])
def TerminateSignalHandler(sig, stack): """When killed, try and kill our child processes.""" signal.signal(sig, signal.SIG_DFL) for pid in gChildPIDs: if 'kill' in os.__all__: # POSIX os.kill(pid, sig) else: subprocess.call(['taskkill.exe', '/PID', pid]) sys.exit(0)
return self._retcode
return self.retcode()
def kill(self): """Kill our running process if needed. Wait for kill to complete.
subprocess.call(['taskkill.exe', '/PID', self._process.pid]) self._retcode = self._process.wait() return self._retcode
subprocess.call(['taskkill.exe', '/PID', str(self._process.pid)]) return self.retcode()
def kill(self): """Kill our running process if needed. Wait for kill to complete.
Kill it if needed. """ return self.kill()
Waits for process to die but does NOT kill it explicitly. """ if self._retcode == None: self._retcode = self._process.wait() return self._retcode
def retcode(self): """Return the return value of the subprocess.
patch['reviewer'] = 'Joe Cool'
def _create_patch(self, patch_contents): patch_path = os.path.join(self.svn_checkout_path, 'patch.diff') write_into_file_at_path(patch_path, patch_contents) patch = {} patch['reviewer'] = 'Joe Cool' patch['bug_id'] = '12345' patch['url'] = 'file://%s' % urllib.pathname2url(patch_path) return Attachment(patch, None) # F...
return Attachment(patch, None)
attachment = Attachment(patch, None) joe_cool = Committer(name="Joe Cool", email_or_emails=None) attachment._reviewer = joe_cool return attachment
def _create_patch(self, patch_contents): patch_path = os.path.join(self.svn_checkout_path, 'patch.diff') write_into_file_at_path(patch_path, patch_contents) patch = {} patch['reviewer'] = 'Joe Cool' patch['bug_id'] = '12345' patch['url'] = 'file://%s' % urllib.pathname2url(patch_path) return Attachment(patch, None) # F...
self.assertEqual(1, self.GetBrowserWindowCount(), 'Extensions in failing group: %s' % extensions[curr_extension:group_end])
self.assertTrue(self.GetBrowserWindowCount(), 'Extensions in failing group: %s' % extensions[curr_extension:group_end])
def testExtensionCrashes(self): """Add top extensions; confirm browser stays up when visiting top urls""" self.assertTrue(os.path.exists(self.extensions_dir_), 'The dir "%s" must exist' % os.path.abspath(self.extensions_dir_)) self.assertTrue(os.path.exists(self.urls_file_), 'The file "%s" must exist' % os.path.abspath...
if func.GetInfo('expectation') == False: test = self._remove_expected_call_re.sub('', test)
def WriteValidUnitTest(self, func, file, test, extra = {}): """Writes a valid unit test.""" if func.GetInfo('expectation') == False: test = self._remove_expected_call_re.sub('', test) name = func.name arg_strings = [] count = 0 for arg in func.GetOriginalArgs(): arg_strings.append(arg.GetValidArg(count, 0)) count += 1 ...
symbol_file = 'chrome.breakpad.ia64'
symbol_file = 'chrome.breakpad.x64'
def main_linux(options, args): # minidump_stackwalk is part of Google Breakpad. You may need to checkout # the code and build your own copy. http://google-breakpad.googlecode.com/ LINUX_PROCESSOR = 'minidump_stackwalk' processor_bin = None if options.processor_dir: bin = os.path.join(os.path.expanduser(options.processo...
if cppdir != hdir: inputBasename = os.path.basename(input) (root, ext) = os.path.splitext(inputBasename) if fileName != '': hname = '%s.h' % (fileName) else: hname = '%s%s.h' % (prefix, root) hsrc = os.path.join(cppdir, hname) hdst = os.path.join(hdir, hname) shutil.copyfile(hsrc, hdst) os.unlink(hsrc)
def main(args): sections = SplitArgsIntoSections(args[1:]) assert len(sections) == 3, sections (base, inputs, options) = sections assert len(base) == 3, base (input, cppdir, hdir) = base assert len(inputs) > 1, inputs generateBindings = inputs[0] perlModules = inputs[1:] includeDirs = [] for perlModule in perlModule...
attrs = [("builder", self._options.builder_name), ("testtype", "layout-tests")] if self._options.master_name: attrs.append(("master", self._options.master_name))
attrs = [("builder", self._options.builder_name), ("testtype", "layout-tests"), ("master", self._options.master_name)]
def _upload_json_files(self): if not self._options.test_results_server: return
if self._options.builder_name.startswith("Webkit Linux"): for filename in files: _log.debug(filename[1]) with codecs.open(filename[1], "r") as results_file: _log.debug("%s:\n%s" % (filename[0], results_file.read()))
def _upload_json_files(self): if not self._options.test_results_server: return
self.file = open(filename, "w")
self.file = open(filename, "wb")
def __init__(self, filename): self.filename = filename self.file = open(filename, "w")
lock_filename = '%s\\%s' % (CHROMIUM_SOURCE_DIR, LOCK_FILE)
lock_filename = os.path.join(options.source_dir, LOCK_FILE)
def main(options, args): """Runs all the selected tests for the given build type and target.""" # Create the lock file to prevent another instance of this script from # running. lock_filename = '%s\\%s' % (CHROMIUM_SOURCE_DIR, LOCK_FILE) try: lock_file = os.open(lock_filename, os.O_CREAT | os.O_EXCL | os.O_TRUNC | os.O...
print 'Change directory to ' + CHROMIUM_SOURCE_DIR os.chdir(CHROMIUM_SOURCE_DIR)
print 'Change directory to ' + options.source_dir os.chdir(options.source_dir) coverity_password = _ReadPassword(options.coverity_password_file)
def main(options, args): """Runs all the selected tests for the given build type and target.""" # Create the lock file to prevent another instance of this script from # running. lock_filename = '%s\\%s' % (CHROMIUM_SOURCE_DIR, LOCK_FILE) try: lock_file = os.open(lock_filename, os.O_CREAT | os.O_EXCL | os.O_TRUNC | os.O...
cmd = 'rmdir /s /q %s\\%s\\%s' % (CHROMIUM_SOURCE_DIR, CHROMIUM_SOLUTION_DIR, options.target) _RunCommand(cmd, options.dry_run, shell=True) print 'Elapsed time: %ds' % (time.time() - start_time) cmd = '%s\\cov-build.exe --dir %s devenv.com %s\\%s /build %s' % ( COVERITY_BIN_DIR, COVERITY_INTERMEDIATE_DIR, CHROMIUM_SOU...
if sys.platform == 'linux2': rm_path = os.path.join(options.source_dir,'src','out',options.target) elif sys.platform == 'win32': rm_path = os.path.join(options.source_dir,options.solution_dir, options.target) else: print 'Platform "%s" unrecognized, don\'t know how to proceed' _ReleaseLock(lock_file, lock_filename) sys...
def main(options, args): """Runs all the selected tests for the given build type and target.""" # Create the lock file to prevent another instance of this script from # running. lock_filename = '%s\\%s' % (CHROMIUM_SOURCE_DIR, LOCK_FILE) try: lock_file = os.open(lock_filename, os.O_CREAT | os.O_EXCL | os.O_TRUNC | os.O...
'--password %s') % (COVERITY_BIN_DIR, COVERITY_INTERMEDIATE_DIR, COVERITY_REMOTE, COVERITY_PORT, COVERITY_PRODUCT, COVERITY_TARGET, COVERITY_USER, CHROMIUM_PASSWORD) _RunCommand(cmd, options.dry_run)
'--password %s') % (cov_commit_exe, options.coverity_intermediate_dir, options.coverity_dbhost, options.coverity_port, options.coverity_product, coverity_target, options.coverity_user, coverity_password) _RunCommand(cmd, options.dry_run, shell=use_shell_during_make)
def main(options, args): """Runs all the selected tests for the given build type and target.""" # Create the lock file to prevent another instance of this script from # running. lock_filename = '%s\\%s' % (CHROMIUM_SOURCE_DIR, LOCK_FILE) try: lock_file = os.open(lock_filename, os.O_CREAT | os.O_EXCL | os.O_TRUNC | os.O...
os.close(lock_file) os.remove(lock_filename)
_ReleaseLock(lock_file, lock_filename)
def main(options, args): """Runs all the selected tests for the given build type and target.""" # Create the lock file to prevent another instance of this script from # running. lock_filename = '%s\\%s' % (CHROMIUM_SOURCE_DIR, LOCK_FILE) try: lock_file = os.open(lock_filename, os.O_CREAT | os.O_EXCL | os.O_TRUNC | os.O...
self.driver = WebDriver.WebDriver(WEBDRIVER_SERVER_URL, "chrome", "ANY");
self.driver = WebDriver.WebDriver(WEBDRIVER_SERVER_URL, "chrome", "ANY")
def setUp(self): global WEBDRIVER_SERVER_URL global WEBDRIVER_PROCESS WEBDRIVER_PROCESS = subprocess.Popen([WEBDRIVER_EXE, '--port=%d' % WEBDRIVER_PORT]) if WEBDRIVER_PROCESS == None: print "Chromium executable not found. The path used was: " print WEBDRIVER_EXE sys.exit(-1)
def assertFind(self, text, search): text = string.lower(text) search = string.lower(search) self.assertNotEqual(-1, string.find(text, search))
def assertURL(self, url): u = self.driver.get_current_url() self.assertEqual(u, url)
self.driver.back();
self.driver.back()
def testNavigation(self): # Loads two pages into chrome's navigation history. self.navigate(self.NEWS) self.navigate(self.SEARCH)
path_utils.maybe_make_directory(self._options.results_directory)
os.makedirs(self._options.results_directory)
def __init__(self, options): self._options = options
if not os.path.exists('/usr/share/ca-certificates/root_ca_cert.crt'): logging.warning('WARNING: SSL certificate missing! SSL tests will fail.') logging.warning('You need to run:') logging.warning('sudo cp src/net/data/ssl/certificates/root_ca_cert.crt ' '/usr/share/ca-certificates/') logging.warning('sudo vi /etc/ca-ce...
def PrepareForTestWine(self): """Set up the Wine environment.
while (not found and (firstrun or ((time.time() - start) < 180.0))):
while (running and not found and (firstrun or ((time.time() - start) < 180.0))):
def __init__(self, source_dir, files, show_all_leaks=False, use_gdb=False): '''Reads in a set of files.
if not found:
if not running and not found: logging.warn("Valgrind process PID = %s is not running but " "its XML log has not been finished correctly." % pid) if running and not found:
def __init__(self, source_dir, files, show_all_leaks=False, use_gdb=False): '''Reads in a set of files.
Committer("Tony Chang", "tony@chromium.org", "tony^work"),
def __init__(self, name, email_or_emails, irc_nickname=None): Committer.__init__(self, name, email_or_emails, irc_nickname) self.can_review = True
args = [self.script_path("webkit-build-directory")] + args
args = ["perl", self.script_path("webkit-build-directory")] + args
def _webkit_build_directory(self, args): args = [self.script_path("webkit-build-directory")] + args return self._executive.run_command(args).rstrip()
return os.path.join(sub_path, 'dangerous.dmg')
return os.path.join(sub_path, 'invalid-dummy.dmg')
def _GetDangerousDownload(self): """Returns the file url for a dangerous download for this OS.""" sub_path = os.path.join(self.DataDir(), 'downloads', 'dangerous') if self.IsMac(): return os.path.join(sub_path, 'dangerous.dmg') return os.path.join(sub_path, 'dangerous.exe')
self._save_baseline_files(filename, actual_test_output.image_hash, actual_test_output.image,
self._save_baseline_files(filename, actual_test_output.image, actual_test_output.image_hash,
def compare_output(self, port, filename, test_args, actual_test_output, expected_test_output): """Implementation of CompareOutput that checks the output image and checksum against the expected files from the LayoutTest directory. """ failures = []
self.AddFunction(f) f.type_handler.AddImmediateFunction(self, f) f.type_handler.AddBucketFunction(self, f)
gen_cmd = f.GetInfo('gen_cmd') if gen_cmd == True or gen_cmd == None: self.AddFunction(f) f.type_handler.AddImmediateFunction(self, f) f.type_handler.AddBucketFunction(self, f)
def ParseGLH(self, filename): """Parses the GL2.h file and extracts the functions""" for line in _GL_FUNCTIONS.splitlines(): match = self._function_re.match(line) if match: func_name = match.group(2)[2:] func_info = self.GetFunctionInfo(func_name) if func_info.type != 'Noop': return_type = match.group(1).strip() arg_st...
if not func.name in _CMD_ID_TABLE: self.Error("Command %s not in _CMD_ID_TABLE" % func.name) by_id[_CMD_ID_TABLE[func.name]] = func
if True: if not func.name in _CMD_ID_TABLE: self.Error("Command %s not in _CMD_ID_TABLE" % func.name) by_id[_CMD_ID_TABLE[func.name]] = func
def WriteCommandIds(self, filename): """Writes the command buffer format""" file = CHeaderWriter(filename) file.Write("#define GLES2_COMMAND_LIST(OP) \\\n") by_id = {} for func in self.functions: if not func.name in _CMD_ID_TABLE: self.Error("Command %s not in _CMD_ID_TABLE" % func.name) by_id[_CMD_ID_TABLE[func.name]]...
func.WriteStruct(file)
if True: func.WriteStruct(file)
def WriteFormat(self, filename): """Writes the command buffer format""" file = CHeaderWriter(filename) for func in self.functions: func.WriteStruct(file) file.Write("\n") file.Close()
func.WriteDocs(file)
if True: func.WriteDocs(file)
def WriteDocs(self, filename): """Writes the command buffer doc version of the commands""" file = CWriter(filename) for func in self.functions: func.WriteDocs(file) file.Write("\n") file.Close()
func.WriteFormatTest(file)
if True: func.WriteFormatTest(file)
def WriteFormatTest(self, filename): """Writes the command buffer format test.""" file = CHeaderWriter( filename, "// This file contains unit tests for gles2 commmands\n" "// It is included by gles2_cmd_format_test.cc\n" "\n")
if not func.name in _CMD_ID_TABLE: self.Error("Command %s not in _CMD_ID_TABLE" % func.name) file.Write(" COMPILE_ASSERT(%s::kCmdId == %d,\n" % (func.name, _CMD_ID_TABLE[func.name])) file.Write(" GLES2_%s_kCmdId_mismatch);\n" % func.name)
if True: if not func.name in _CMD_ID_TABLE: self.Error("Command %s not in _CMD_ID_TABLE" % func.name) file.Write(" COMPILE_ASSERT(%s::kCmdId == %d,\n" % (func.name, _CMD_ID_TABLE[func.name])) file.Write(" GLES2_%s_kCmdId_mismatch);\n" % func.name)
def WriteCommandIdTest(self, filename): """Writes the command id test.""" file = CHeaderWriter( filename, "// This file contains unit tests for gles2 commmand ids\n")
func.WriteCmdHelper(file)
if True: func.WriteCmdHelper(file)
def WriteCmdHelperHeader(self, filename): """Writes the gles2 command helper.""" file = CHeaderWriter(filename)
func.WriteServiceImplementation(file)
if True: func.WriteServiceImplementation(file)
def WriteServiceImplementation(self, filename): """Writes the service decorder implementation.""" file = CHeaderWriter( filename, "// It is included by gles2_cmd_decoder.cc\n")
if func.GetInfo('unit_test') == False: file.Write("// TODO(gman): %s\n" % func.name) else: func.WriteServiceUnitTest(file)
if True: if func.GetInfo('unit_test') == False: file.Write("// TODO(gman): %s\n" % func.name) else: func.WriteServiceUnitTest(file)
def WriteServiceUnitTests(self, filename): """Writes the service decorder unit tests.""" num_tests = len(self.functions) step = (num_tests + 1) / 2 count = 0 for test_num in range(0, num_tests, step): count += 1 name = filename % count file = CHeaderWriter( name, "// It is included by gles2_cmd_decoder_unittest_%d.cc\n...
options.configuration = "debug"
options.configuration = "Debug"
def main(): """Main function to produce new baselines.""" option_parser = optparse.OptionParser() option_parser.add_option('-v', '--verbose', action='store_true', default=False, help='include debug-level logging.') option_parser.add_option('-p', '--platforms', default='mac,win,win-xp,win-vista,linux', help=('Comma de...
PermanentItem('google_chrome_sessions', name='Sessions', parent_tag='google_chrome', sync_type=SESSION),
def __init__(self, tag, name, parent_tag, sync_type): self.tag = tag self.name = name self.parent_tag = parent_tag self.sync_type = sync_type
if name.find("-expected.") != -1 and mode == "w":
if name.find("-expected.") != -1 and mode.find("w") != -1:
def _wrapper(name, mode, encoding): if name.find("-expected.") != -1 and mode == "w": # we don't want to actually write new baselines, so stub these out name.replace('\\', '/') file_list.append(name) return original_open(os.devnull, mode, encoding) return original_open(name, mode, encoding)
(username, password) = Credentials(
while not self.authenticated: (username, password) = Credentials(
def authenticate(self): if self.authenticated: return
log("Logging in as %s..." % username) self.browser.open(self.bug_server_url + "index.cgi?GoAheadAndLogIn=1") self.browser.select_form(name="login") self.browser['Bugzilla_login'] = username self.browser['Bugzilla_password'] = password response = self.browser.submit() match = re.search("<title>(.+?)</title>", response....
log("Logging in as %s..." % username) self.browser.open(self.bug_server_url + "index.cgi?GoAheadAndLogIn=1") self.browser.select_form(name="login") self.browser['Bugzilla_login'] = username self.browser['Bugzilla_password'] = password response = self.browser.submit() match = re.search("<title>(.+?)</title>", response....
def authenticate(self): if self.authenticated: return
self._tool.scm())
scm)
def execute(self, options, args, tool): results_directory = args[0] filesystem = system.filesystem.FileSystem()