rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
Reviewer("Simon Hausmann", ["hausmann@webkit.org", "hausmann@kde.org"]),
Reviewer("Simon Hausmann", ["hausmann@webkit.org", "hausmann@kde.org", "simon.hausmann@nokia.com"]),
def __init__(self, name, email_or_emails): Committer.__init__(self, name, email_or_emails) self.can_review = True
env['CYGWIN_PATH'] = self._port_obj.path_from_base('third_party', 'cygwin', 'bin')
env['CYGWIN_PATH'] = self._port_obj.path_from_chromium_base( 'third_party', 'cygwin', 'bin')
def start(self): if not self._web_socket_tests: _log.info('No need to start %s server.' % self._server_name) return if self.is_running(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name)
if self._options.use_drt and sys.platform not in ('win32', 'cygwin'):
if self._options.use_drt and sys.platform == 'darwin':
def create_driver(self, image_path, options): """Starts a new Driver and returns a handle to it.""" if self._options.use_drt and sys.platform not in ('win32', 'cygwin'): return webkit.WebKitDriver(self, image_path, options, executive=self._executive) if self._options.use_drt: options += ['--test-shell'] else: options +...
message = "%s ran check-webkit-style on attachment %s without any errors." % (self.name, patch["id"]) self.tool.bugs.post_comment_to_bug(patch["bug_id"], message, cc=self.watchers)
def process_work_item(self, patch): try: self.run_webkit_patch(["check-style", "--force-clean", "--non-interactive", "--parent-command=style-queue", patch["id"]]) message = "%s ran check-webkit-style on attachment %s without any errors." % (self.name, patch["id"]) self.tool.bugs.post_comment_to_bug(patch["bug_id"], mes...
'http://chromium-status.appspot.com/current?format=raw', '(?i).*closed.*'))
json_url='http://chromium-status.appspot.com/current?format=json'))
def CheckChangeOnCommit(input_api, output_api): results = [] if not input_api.json: results.append(output_api.PresubmitNotifyResult( 'You don\'t have json nor simplejson installed.\n' ' This is a warning that you will need to upgrade your python ' 'installation.\n' ' This is no big deal but you\'ll eventually need to...
with codecs.open(file1, "r", "utf8") as file_handle1: output1 = file_handle1.read() with codecs.open(file2, "r", "utf8") as file_handle2: output2 = file_handle2.read() if not self._diff_baselines(new_baseline, fallback_fullpath):
with codecs.open(new_baseline, "r", None) as file_handle1: new_output = file_handle1.read() with codecs.open(fallback_fullpath, "r", None) as file_handle2: fallback_output = file_handle2.read() is_image = baseline_path.lower().endswith('.png') if not self._diff_baselines(new_output, fallback_output, is_image):
def _is_dup_baseline(self, new_baseline, baseline_path, test, suffix, platform): """Check whether a baseline is duplicate and can fallback to same baseline for another platform. For example, if a test has same baseline on linux and windows, then we only store windows baseline and linux baseline will fallback to the win...
self._scm.add(path)
def _update_rebaselined_tests_in_file(self, backup): """Update the rebaselined tests in test expectations file.
user.open_url(self._html_file)
user.User().open_url(self._html_file)
def show_html(self): """Launch the rebaselining html in brwoser."""
parser = optparse.OptionParser('Usage: %prog [options] <files>')
parser = optparse.OptionParser(usage=_USAGE, description=_DESCRIPTION)
def ParseCommandLine(): """Constructs and configures an option parser for this script and parses the command line arguments. Returns: The parsed options. """ parser = optparse.OptionParser('Usage: %prog [options] <files>') parser.add_option('-i', '--input', dest='input', help='An archive file to append to.') parser.ad...
if options.path:
if path == _DEBUG_ONLY_FILE_SEPARATOR: if options.config != 'Debug': break elif options.path:
def Main(): """Zip input arguments to Zip output archive.""" (options, args) = ParseCommandLine() # Test that all the input files exist before we blow the output archive away # only to fail part way. for path in args: if not os.path.exists(path): raise Exception('Input file does not exist:', path) if os.path.isdir(pat...
2) file.Write(" file.Write("
3) file.Write(" file.Write("
def WritePepperGLES2Interface(self, filename): """Writes the Pepper OpenGLES interface definition.""" file = CHeaderWriter( filename, "// This interface is used to access common and lite profile OpenGL ES " "2.0\n// functions.\n", 2)
file.Write("\ntypedef struct _ppb_OpenGLES {\n")
file.Write("\nstruct PPB_OpenGLES_Dev {\n")
file.Write("\ntypedef struct _ppb_OpenGLES {\n")
file.Write("} PPB_OpenGLES;\n\n")
file.Write("};\n\n")
file.Write("\ntypedef struct _ppb_OpenGLES {\n")
file.Write("\nconst PPB_OpenGLES ppb_opengles = {\n")
file.Write("\nconst struct PPB_OpenGLES_Dev ppb_opengles = {\n")
def WritePepperGLES2Implementation(self, filename): """Writes the Pepper OpenGLES interface implementation."""
const PPB_OpenGLES* Graphics3D::GetOpenGLESInterface() {
const PPB_OpenGLES_Dev* Graphics3D::GetOpenGLESInterface() {
def WritePepperGLES2Implementation(self, filename): """Writes the Pepper OpenGLES interface implementation."""
choices=("ppapi", "chrome_ppapi", "ppapi_gles2"),
choices=("ppapi", "chrome_ppapi"),
def main(argv): """This is the main function.""" parser = OptionParser() parser.add_option( "-g", "--generate-implementation-templates", action="store_true", help="generates files that are generally hand edited..") parser.add_option( "--generate-command-id-tests", action="store_true", help="generate tests for commands ...
gen.WritePepperGLES2Interface("ppapi/c/ppb_opengles.h")
gen.WritePepperGLES2Interface("ppapi/c/dev/ppb_opengles_dev.h")
def main(argv): """This is the main function.""" parser = OptionParser() parser.add_option( "-g", "--generate-implementation-templates", action="store_true", help="generates files that are generally hand edited..") parser.add_option( "--generate-command-id-tests", action="store_true", help="generate tests for commands ...
from pyautolib import *
import pyautolib
def _LocateBinDirs(): script_dir = os.path.dirname(__file__) chrome_src = os.path.join(script_dir, os.pardir, os.pardir, os.pardir) bin_dirs = { 'linux2': [ os.path.join(chrome_src, 'out', 'Debug'), os.path.join(chrome_src, 'sconsbuild', 'Debug'), os.path.join(chrome_src, 'out', 'Release'), os.path.join(chrome_src, 's...
class PyUITest(PyUITestSuite, unittest.TestCase):
class PyUITest(pyautolib.PyUITestSuite, unittest.TestCase):
def _LocateBinDirs(): script_dir = os.path.dirname(__file__) chrome_src = os.path.join(script_dir, os.pardir, os.pardir, os.pardir) bin_dirs = { 'linux2': [ os.path.join(chrome_src, 'out', 'Debug'), os.path.join(chrome_src, 'sconsbuild', 'Debug'), os.path.join(chrome_src, 'out', 'Release'), os.path.join(chrome_src, 's...
PyUITestSuite.__init__(self, sys.argv)
pyautolib.PyUITestSuite.__init__(self, sys.argv) browser_dir = os.path.normpath(os.path.dirname(pyautolib.__file__)) os.environ['PATH'] = browser_dir + os.pathsep + os.environ['PATH'] self.Initialize(pyautolib.FilePath(browser_dir))
def __init__(self, methodName='runTest'): PyUITestSuite.__init__(self, sys.argv) unittest.TestCase.__init__(self, methodName)
PyUITestSuite.__del__(self)
pyautolib.PyUITestSuite.__del__(self)
def __del__(self): PyUITestSuite.__del__(self)
self._update_status("Empty queue")
def next_work_item(self): patches = self._validate_patches_in_commit_queue() patches = sorted(patches, self._patch_cmp) self._update_work_items([patch.id() for patch in patches]) if not patches: self._update_status("Empty queue") return None # Only bother logging if we have patches in the queue. self.log_progress([patc...
self._update_status("Empty queue")
def next_work_item(self): patch_id = self._patches.next() if patch_id: return self.tool.bugs.fetch_attachment(patch_id) self._update_status("Empty queue")
self.browser['flag_type-3'] = ('?',) if mark_for_commit_queue else ('X',) self.browser['flag_type-3'] = ('+',) if mark_for_landing else ('X',)
if mark_for_landing: self.browser['flag_type-3'] = ('+',) elif mark_for_commit_queue: self.browser['flag_type-3'] = ('?',) else: self.browser['flag_type-3'] = ('X',)
def _fill_attachment_form(self, description, patch_file_object, comment_text=None, mark_for_review=False, mark_for_commit_queue=False, mark_for_landing=False, bug_id=None): self.browser['description'] = description self.browser['ispatch'] = ("1",) self.browser['flag_type-1'] = ('?',) if mark_for_review else ('X',) self...
def test_should_build(self): for files, platforms in self._should_build_tests: for platform in ["win"]: should_build = platform in platforms or "*" in platforms self.assertEqual(build.should_build(platform, files), should_build, "%s should%s have built but did%s (files: %s)" % (platform, "" if should_build else "n't"...
base_platform = target_platform.split("-")[0] for directory, platforms in directories: if re.search(r"/?\b%s\b/" % directory, file): return target_platform in platforms or base_platform in platforms for pattern, platforms in patterns: if re.search(pattern, file): return target_platform in platforms or base_platform...
def test_should_build(self): for files, platforms in self._should_build_tests: # FIXME: We should test more platforms here once # build._should_file_trigger_build is implemented for them. for platform in ["win"]: should_build = platform in platforms or "*" in platforms self.assertEqual(build.should_build(platform, file...
if __name__ == "__main__": unittest.main()
def should_build(target_platform, changed_files): """Returns true if the changed files affect the given platform, and thus a build should be performed. target_platform should be one of the platforms used in the build.webkit.org master's config.json file.""" return any(_should_file_trigger_build(target_platform, file) f...
def test_should_build(self): for files, platforms in self._should_build_tests: # FIXME: We should test more platforms here once # build._should_file_trigger_build is implemented for them. for platform in ["win"]: should_build = platform in platforms or "*" in platforms self.assertEqual(build.should_build(platform, file...
self.assertEqual('Popup Success!', blocked_popups[0]['title'])
def testPopupBlockerEnabled(self): """Verify popup blocking is enabled.""" self.assertFalse(self.GetBlockedPopupsInfo(), msg='Should have no blocked popups on startup') file_url = self.GetFileURLForPath(os.path.join( self.DataDir(), 'popup_blocker', 'popup-blocked-to-post-blank.html')) self.NavigateToURL(file_url) bloc...
feature_defines = ['ENABLE_DATABASE', 'ENABLE_XSLT', 'ENABLE_JAVASCRIPT_DEBUGGER', 'ENABLE_SVG', 'ENABLE_SVG_USE', 'ENABLE_FILTERS', 'ENABLE_SVG_FONTS', 'ENABLE_SVG_ANIMATION', 'ENABLE_SVG_AS_IMAGE']
feature_defines = ['ENABLE_DATABASE', 'ENABLE_XSLT', 'ENABLE_JAVASCRIPT_DEBUGGER', 'ENABLE_SVG', 'ENABLE_SVG_USE', 'ENABLE_FILTERS', 'ENABLE_SVG_FONTS', 'ENABLE_SVG_ANIMATION', 'ENABLE_SVG_AS_IMAGE', 'ENABLE_SVG_FOREIGN_OBJECT']
def get_config(): waf_configname = config.upper().strip() if building_on_win32: isReleaseCRT = (config == 'Release') if build_port == 'wx': if Options.options.wxpython: isReleaseCRT = True if isReleaseCRT: waf_configname = waf_configname + ' CRT_MULTITHREADED_DLL' else: waf_configname = waf_configname + ' CRT_MULTITHR...
(dir_name in GIT_SOURCE_DIRECTORY)):
(dir_name.lower() in GIT_SOURCE_DIRECTORY)):
def ApplyDirectoryRules(existing_rules, dir_name): """Combines rules from the existing rules and the new directory. Any directory can contain a DEPS file. Toplevel DEPS files can contain module dependencies which are used by gclient. We use these, along with additional include rules and implicit rules for the given di...
(shortname, extension) = os.path.splitext(file_name)
(shortname, extension) = os.path.splitext(file_name.split("?")[0])
def GetMIMETypeFromName(self, file_name): """Returns the mime type for the specified file_name. So far it only looks at the file extension."""
keyword = 'Suppression:'
errors = [] skip_next_line = False func_re = input_api.re.compile('[a-z_.]+\(.+\)$')
def CheckChange(input_api, output_api): """Checks that the user didn't paste 'Suppression:' into the file""" keyword = 'Suppression:' for f, line_num, line in input_api.RightHandSideLines(lambda x: x.LocalPath().endswith('.txt')): if keyword in line: text = '"%s" must not be included; %s line %s' % ( keyword, f.LocalPa...
if keyword in line: text = '"%s" must not be included; %s line %s' % ( keyword, f.LocalPath(), line_num) return [output_api.PresubmitError(text)]
line = line.lstrip() if line.startswith(' continue if skip_next_line: skip_next_line = False continue if (line.startswith('fun:') or line.startswith('obj:') or line.startswith('Memcheck:') or line == '}' or line == '...'): continue if func_re.match(line): continue if line == '{': skip_next_line = True continue errors....
def CheckChange(input_api, output_api): """Checks that the user didn't paste 'Suppression:' into the file""" keyword = 'Suppression:' for f, line_num, line in input_api.RightHandSideLines(lambda x: x.LocalPath().endswith('.txt')): if keyword in line: text = '"%s" must not be included; %s line %s' % ( keyword, f.LocalPa...
if os.path.exists(BaseTool.TMP_DIR): shutil.rmtree(BaseTool.TMP_DIR) os.mkdir(BaseTool.TMP_DIR)
self.temp_dir = tempfile.mkdtemp()
def __init__(self): # If we have a testing.tmp directory, we didn't cleanup last time. if os.path.exists(BaseTool.TMP_DIR): shutil.rmtree(BaseTool.TMP_DIR) os.mkdir(BaseTool.TMP_DIR)
shutil.rmtree(self.TMP_DIR, ignore_errors=True)
shutil.rmtree(self.temp_dir, ignore_errors=True)
def Main(self, args, check_sanity): """Call this to run through the whole process: Setup, Execute, Analyze""" start = datetime.datetime.now() retcode = -1 if self.Setup(args): retcode = self.RunTestsAndAnalyze(check_sanity) if not self._nocleanup_on_exit: shutil.rmtree(self.TMP_DIR, ignore_errors=True) self.Cleanup() e...
logfilename = self.TMP_DIR + ("/%s." % tool_name) + "%p"
logfilename = self.temp_dir + ("/%s." % tool_name) + "%p"
def ToolCommand(self): """Get the valgrind command to run.""" # Note that self._args begins with the exe to be run. tool_name = self.ToolName()
(fd, indirect_fname) = tempfile.mkstemp(dir=self.TMP_DIR,
(fd, indirect_fname) = tempfile.mkstemp(dir=self.temp_dir,
def CreateBrowserWrapper(self, command, logfiles): """The program being run invokes Python or something else that can't stand to be valgrinded, and also invokes the Chrome browser. Set an environment variable to tell the program to prefix the Chrome commandline with a magic wrapper. Build the magic wrapper here. """ ...
filenames = glob.glob(self.TMP_DIR + "/" + self.ToolName() + ".*")
filenames = glob.glob(self.temp_dir + "/" + self.ToolName() + ".*")
def GetAnalyzeResults(self, check_sanity=False): # Glob all the files in the "testing.tmp" directory filenames = glob.glob(self.TMP_DIR + "/" + self.ToolName() + ".*")
logfilename = self.TMP_DIR + "/tsan.%p"
logfilename = self.temp_dir + "/tsan.%p"
def ToolSpecificFlags(self): proc = ThreadSanitizerBase.ToolSpecificFlags(self) # On PIN, ThreadSanitizer has its own suppression mechanism # and --log-file flag which work exactly on Valgrind. suppression_count = 0 for suppression_file in self._options.suppressions: if os.path.exists(suppression_file): suppression_cou...
filenames = glob.glob(self.TMP_DIR + "/tsan.*")
filenames = glob.glob(self.temp_dir + "/tsan.*")
def Analyze(self, check_sanity=False): filenames = glob.glob(self.TMP_DIR + "/tsan.*") analyzer = tsan_analyze.TsanAnalyzer(self._source_dir) ret = analyzer.Report(filenames, check_sanity) if ret != 0: logging.info(self.INFO_MESSAGE) return ret
proc += ["-logdir", (os.getcwd() + "\\" + self.TMP_DIR)]
proc += ["-logdir", (os.getcwd() + "\\" + self.temp_dir)]
def ToolCommand(self): """Get the valgrind command to run.""" tool_name = self.ToolName()
filenames = glob.glob(self.TMP_DIR + "/*/results.txt")
filenames = glob.glob(self.temp_dir + "/*/results.txt")
def Analyze(self, check_sanity=False): # Glob all the results files in the "testing.tmp" directory filenames = glob.glob(self.TMP_DIR + "/*/results.txt")
proc += ["-no_check_leaks", "-no_count_leaks"]
def ToolCommand(self): """Get the valgrind command to run.""" tool_name = self.ToolName()
self._subclass_must_implement()
SCM._subclass_must_implement()
def in_working_directory(path): self._subclass_must_implement()
self._subclass_must_implement()
SCM._subclass_must_implement()
def find_checkout_root(path): self._subclass_must_implement()
self._subclass_must_implement()
SCM._subclass_must_implement()
def commit_success_regexp(): self._subclass_must_implement()
self._subclass_must_implement()
SCM._subclass_must_implement()
def supports_local_commits(): self._subclass_must_implement()
self._subclass_must_implement()
SCM._subclass_must_implement()
def remote_merge_base(): self._subclass_must_implement()
lambda: self.FindInPage('data', tab_index=1)['match_count'],
lambda: self.FindInPage(search_query, tab_index=1)['match_count'],
def testSearchWithinSpecialURL(self): """Verify search for text within special URLs such as chrome:history. chrome://history, chrome://downloads, pyAuto Data directory """ zip_file = 'a_zip_file.zip' self.NavigateToURL(self.GetFileURLForPath(self.DataDir())) # search in Data directory self.assertEqual(1, self.FindInPag...
self.assertEqual(1, self.FindInPage('data', tab_index=1)['match_count'])
self.assertEqual( 1, self.FindInPage(search_query, tab_index=1)['match_count'])
def testSearchWithinSpecialURL(self): """Verify search for text within special URLs such as chrome:history. chrome://history, chrome://downloads, pyAuto Data directory """ zip_file = 'a_zip_file.zip' self.NavigateToURL(self.GetFileURLForPath(self.DataDir())) # search in Data directory self.assertEqual(1, self.FindInPag...
file.Write("static %s valid_%s_table[] = {\n" % (_ENUM_LISTS[enum]['type'], ToUnderscore(enum))) for value in _ENUM_LISTS[enum]['valid']: file.Write(" %s,\n" % value) file.Write("};\n") file.Write("\n")
if len(_ENUM_LISTS[enum]['valid']) > 0: file.Write("static %s valid_%s_table[] = {\n" % (_ENUM_LISTS[enum]['type'], ToUnderscore(enum))) for value in _ENUM_LISTS[enum]['valid']: file.Write(" %s,\n" % value) file.Write("};\n") file.Write("\n")
def WriteServiceUtilsImplementation(self, filename): """Writes the gles2 auto generated utility implementation.""" file = CHeaderWriter(filename) enums = sorted(_ENUM_LISTS.keys()) for enum in enums: file.Write("static %s valid_%s_table[] = {\n" % (_ENUM_LISTS[enum]['type'], ToUnderscore(enum))) for value in _ENUM_LIST...
code = """ %(pre)s%(name)s( valid_%(name)s_table, arraysize(valid_%(name)s_table))%(post)s
if len(_ENUM_LISTS[enum]['valid']) > 0: code = """ %(pre)s%(name)s( valid_%(name)s_table, arraysize(valid_%(name)s_table))%(post)s """ else: code = """ %(pre)s%(name)s()%(post)s
def WriteServiceUtilsImplementation(self, filename): """Writes the gles2 auto generated utility implementation.""" file = CHeaderWriter(filename) enums = sorted(_ENUM_LISTS.keys()) for enum in enums: file.Write("static %s valid_%s_table[] = {\n" % (_ENUM_LISTS[enum]['type'], ToUnderscore(enum))) for value in _ENUM_LIST...
'name': func.name, 'arg_index': arg_index, 'value_index': value_index, 'gl_func_name': gl_func_name, 'args': ", ".join(arg_strings), 'all_but_last_args': ", ".join(arg_strings[:-1]), 'gl_args': ", ".join(gl_arg_strings), 'parse_result': parse_result,
'test_name': 'GLES2DecoderTest%d' % file.file_num , 'name': func.name, 'arg_index': arg_index, 'value_index': value_index, 'gl_func_name': gl_func_name, 'args': ", ".join(arg_strings), 'all_but_last_args': ", ".join(arg_strings[:-1]), 'gl_args': ", ".join(gl_arg_strings), 'parse_result': parse_result,
def WriteInvalidUnitTest(self, func, file, test, extra = {}): """Writes a invalid unit test.""" arg_index = 0 for arg in func.GetOriginalArgs(): num_invalid_values = arg.GetNumInvalidValues() for value_index in range(0, num_invalid_values): arg_strings = [] parse_result = "kNoError" count = 0 for arg in func.GetOrigina...
if func.GetInfo('unit_test') == False: file.Write("// TODO(gman): %s\n" % func.name) return
def WriteServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" if func.GetInfo('unit_test') == False: file.Write("// TODO(gman): %s\n" % func.name) return valid_test = """
TEST_F(GLES2DecoderTest, %(name)sValidArgs) {
TEST_F(%(test_name)s, %(name)sValidArgs) {
def WriteServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" if func.GetInfo('unit_test') == False: file.Write("// TODO(gman): %s\n" % func.name) return valid_test = """
TEST_F(GLES2DecoderTest, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) {
TEST_F(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) {
def WriteServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" if func.GetInfo('unit_test') == False: file.Write("// TODO(gman): %s\n" % func.name) return valid_test = """
TEST_F(GLES2DecoderTest, %(name)sValidArgs) {
TEST_F(%(test_name)s, %(name)sValidArgs) {
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
TEST_F(GLES2DecoderTest, %(name)sInvalidArgs) {
TEST_F(%(test_name)s, %(name)sInvalidArgs) {
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
TEST_F(GLES2DecoderTest, %(name)sValidArgs) {
TEST_F(%(test_name)s, %(name)sValidArgs) {
def WriteImmediateServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
TEST_F(GLES2DecoderTest, %(name)sInvalidArgs) {
TEST_F(%(test_name)s, %(name)sInvalidArgs) {
def WriteImmediateServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
TEST_F(GLES2DecoderTest, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) {
TEST_F(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) {
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
TEST_F(GLES2DecoderTest, %(name)sValidArgs) {
TEST_F(%(test_name)s, %(name)sValidArgs) {
def WriteImmediateServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" valid_test = """
TEST_F(GLES2DecoderTest, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) {
TEST_F(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) {
def WriteImmediateServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" valid_test = """
file.Write(" if (!id_manager_->GetServiceId(c.%s, &%s)) {\n" %
file.Write(" if (!id_manager()->GetServiceId(c.%s, &%s)) {\n" %
def WriteGetCode(self, file): """Overridden from Argument.""" file.Write(" %s %s;\n" % (self.type, self.name)) file.Write(" if (!id_manager_->GetServiceId(c.%s, &%s)) {\n" % (self.name, self.name)) file.Write(" SetGLError(GL_INVALID_VALUE);\n") file.Write(" return error::kNoError;\n") file.Write(" }\n")
def __init__(self, name, info, return_type, original_args, args_for_cmds, cmd_args, init_args, num_pointer_args):
def __init__(self, original_name, name, info, return_type, original_args, args_for_cmds, cmd_args, init_args, num_pointer_args):
def __init__(self, name, info, return_type, original_args, args_for_cmds, cmd_args, init_args, num_pointer_args): self.name = name self.original_name = name self.info = info self.type_handler = info.type_handler self.return_type = return_type self.original_args = original_args self.num_pointer_args = num_pointer_args s...
self.original_name = name
self.original_name = original_name
def __init__(self, name, info, return_type, original_args, args_for_cmds, cmd_args, init_args, num_pointer_args): self.name = name self.original_name = name self.info = info self.type_handler = info.type_handler self.return_type = return_type self.original_args = original_args self.num_pointer_args = num_pointer_args s...
if self.GetInfo('DecoderFunc'): return self.GetInfo('DecoderFunc')
if self.GetInfo('decoder_func'): return self.GetInfo('decoder_func')
def GetGLFunctionName(self): """Gets the function to call to execute GL for this command.""" if self.GetInfo('DecoderFunc'): return self.GetInfo('DecoderFunc') return "gl%s" % self.original_name
gl_func_name = self.name
gl_func_name = self.original_name
def GetGLTestFunctionName(self): gl_func_name = self.GetInfo('gl_test_func') if gl_func_name == None: gl_func_name = self.GetGLFunctionName() if gl_func_name.startswith("gl"): gl_func_name = gl_func_name[2:] else: gl_func_name = self.name return gl_func_name
self.original_name = func.name
def __init__(self, func): new_args = [] for arg in func.GetOriginalArgs(): new_arg = arg.GetImmediateVersion() if new_arg: new_args.append(new_arg)
f = Function(func_name, func_info, return_type, args, args_for_cmds, cmd_args, init_args, num_pointer_args)
f = Function(func_name, func_name, func_info, return_type, args, args_for_cmds, cmd_args, init_args, num_pointer_args)
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...
file = CHeaderWriter( filename, "// It is included by gles2_cmd_decoder_unittest.cc\n") for func in self.functions: func.WriteServiceUnitTest(file) file.Close()
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" % count) file.SetFileNum(count) end = test_num + step if end > num_tests: end = num_tes...
def WriteServiceUnitTests(self, filename): """Writes the service decorder unit tests.""" file = CHeaderWriter( filename, "// It is included by gles2_cmd_decoder_unittest.cc\n")
gen.WriteServiceUnitTests("service/gles2_cmd_decoder_unittest_autogen.h")
gen.WriteServiceUnitTests("service/gles2_cmd_decoder_unittest_%d_autogen.h")
def main(argv): """This is the main function.""" parser = OptionParser() parser.add_option( "-g", "--generate-implementation-templates", action="store_true", help="generates files that are generally hand edited..") parser.add_option( "--generate-command-id-tests", action="store_true", help="generate tests for commands ...
if len(args) != 1: print 'You must provide only one argument: path to the test binary'
if not args: print 'You must provide path to the test binary'
def main(argv): parser = optparse.OptionParser() parser.add_option("--shards", type="int", dest="shards", default=10) options, args = parser.parse_args(argv) if len(args) != 1: print 'You must provide only one argument: path to the test binary' return 1 launchers = [] for shard in range(options.shards): launcher = ...
launcher = TestLauncher(args[0], args[0], options.shards, shard)
launcher = TestLauncher(args, args[0], options.shards, shard)
def main(argv): parser = optparse.OptionParser() parser.add_option("--shards", type="int", dest="shards", default=10) options, args = parser.parse_args(argv) if len(args) != 1: print 'You must provide only one argument: path to the test binary' return 1 launchers = [] for shard in range(options.shards): launcher = ...
hname = 'V8%s.h' % root
hname = '%s%s.h' % (prefix, root)
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...
received recvmsg(s, start_and_play_command)
received = recvmsg(s, start_and_play_command)
def measure_dt_seq(s, am_server, send_signal=False): """ This function performs distance measurement using sequential playback. In this method, the server plays its sound first, and the client plays only after the server has finished. The first and second halves of the recording are analyzed separately. This method i...
good_version = indentation + good_version + ','
good_version = indentation + "version='%s'," % version
def _update_version(self, version): """Find out where to change the version and change it.
if not os.path.exists(rc):
files = [f for f in [rc, 'setup.cfg'] if os.path.exists(f)] if not files:
def _read_configfile(self): """Read the config file and store it (when valid)""" rc = self.config_filename if not os.path.isabs(rc): rc = os.path.join(os.path.expanduser('~'), self.config_filename) if not os.path.exists(rc): self.config = None return self.config = ConfigParser() self.config.read(rc) if (not self.is_old...
self.config.read(rc)
self.config.read(files)
def _read_configfile(self): """Read the config file and store it (when valid)""" rc = self.config_filename if not os.path.isabs(rc): rc = os.path.join(os.path.expanduser('~'), self.config_filename) if not os.path.exists(rc): self.config = None return self.config = ConfigParser() self.config.read(rc) if (not self.is_old...
self.tagdir = os.path.realpath(os.getcwd()) logger.info("Tag checkout placed in %s", self.tagdir)
self.data['tagdir'] = os.path.realpath(os.getcwd()) logger.info("Tag checkout placed in %s", self.data['tagdir'])
def _release(self): """Upload the release, when desired""" if not utils.ask("Check out the tag (for tweaks or pypi/distutils " "server upload)"): return package = self.vcs.name version = self.data['version'] logger.info("Doing a checkout...") self.vcs.checkout_from_tag(version) self.tagdir = os.path.realpath(os.getcwd(...
if 'setup.py' in os.listdir(self.tagdir):
if 'setup.py' in os.listdir(self.data['tagdir']):
def _release(self): """Upload the release, when desired""" if not utils.ask("Check out the tag (for tweaks or pypi/distutils " "server upload)"): return package = self.vcs.name version = self.data['version'] logger.info("Doing a checkout...") self.vcs.checkout_from_tag(version) self.tagdir = os.path.realpath(os.getcwd(...
return "svn diff %s %s" % (tag_url, url)
return "svn --non-interactive diff %s %s" % (tag_url, url)
def cmd_diff_last_commit_against_tag(self, version): url = self._svn_info() tag_url = self.tag_url(version) return "svn diff %s %s" % (tag_url, url)
fileIN = open('tests/glean/tglsl1.cpp', 'r')
try: options, args = getopt(sys.argv[1:], "hdt:n:x:", [ "help", "dry-run", "tests=", "name=", "exclude-tests=" ]) except GetoptError: usage() if len(args) != 2: usage() suffix = args[1] fileIN = open(args[0], 'r')
def main(): fileIN = open('tests/glean/tglsl1.cpp', 'r') line = fileIN.readline() next_is_name = False while line: if next_is_name: name = line.lstrip(" \",") name = name.rstrip("\n") if re.match(r'GLint stat', name): break if not re.match(r'//', name): name = re.sub(r'".*', r'', name) print "add_glsl1('" + name + "')...
print "add_glsl1('" + name + "')"
print "add_" + suffix + "('" + name + "')"
def main(): fileIN = open('tests/glean/tglsl1.cpp', 'r') line = fileIN.readline() next_is_name = False while line: if next_is_name: name = line.lstrip(" \",") name = name.rstrip("\n") if re.match(r'GLint stat', name): break if not re.match(r'//', name): name = re.sub(r'".*', r'', name) print "add_glsl1('" + name + "')...
print u
def _simple_req(cls, uri, method, params, data=False): p = params if params else {} p['api_key'] = Freesound.get_api_key() u = '%s?%s' % (uri, urllib.urlencode(p)) d = urllib.urlencode(data) if data else None print u req = RequestWithMethod(u, method, d) try: try: f = urllib2.urlopen(req) except HTTPError, e: if e.code...
if (iGameTurn == getTurnForYear(1933)):
if (iGameTurn == getTurnForYear(1932)):
def checkPlayerTurn(self, iGameTurn, iPlayer):
for iCiv in range(con.iNumPlayers): if (iCiv != iRome): if self.checkOwnedArea(iCiv, tLibyaTL, tLibyaBR, 1): bLibya = False
def checkPlayerTurn(self, iGameTurn, iPlayer):
if (iGameTurn >= getTurnForYear(-210) and iGameTurn <= getTurnForYear(470)):
if (iGameTurn >= getTurnForYear(-210) and iGameTurn <= getTurnForYear(300)): self.spawnUnits( iBarbarian, (50, 45), (63, 52), con.iAxeman, 1 + iHandicap, iGameTurn, 12, 0, utils.outerInvasion, 0) self.spawnUnits( iBarbarian, (64, 49), (69, 55), con.iAxeman, 1 + iHandicap, iGameTurn, 14, 2, utils.outerInvasion, 0) if (i...
def checkTurn(self, iGameTurn): #handicap level modifier iHandicap = (gc.getGame().getHandicapType() - 1)
if (iGameTurn >= getTurnForYear(50) and iGameTurn <= getTurnForYear(470)):
if (iGameTurn >= getTurnForYear(250) and iGameTurn <= getTurnForYear(470)):
def checkTurn(self, iGameTurn): #handicap level modifier iHandicap = (gc.getGame().getHandicapType() - 1)
elif (iReligion == con.iIslam):
elif (iReligion == con.iJudaism):
def onReligionFounded(self, iReligion, iFounder):
if (unit.getOwner() == iOldOwner):
if (unit.getOwner() == iOwner):
def birthInCapital(self, iCiv, tCapital, tTopLeft, tBottomRight):
utils.makeUnit(self.getBaseUnit(unitType, iNewOwner), iNewOwner, (0, 0), 1)
utils.makeUnit(self.getBaseUnit(unitType, iNewOwner), iCiv, (0, 0), 1)
def birthInCapital(self, iCiv, tCapital, tTopLeft, tBottomRight):
parinfo = [{'value':0., 'fixed':0, 'limited':[0,0], 'limits':[0.,0.]}]*5
parinfo = [{'value':0., 'fixed':0, 'limited':[0,0], 'limits':[0.,0.]} for i in range(5)]
def myfunct(p, fjac=None, x=None, y=None, err=None)
egg = _build_egg()
egg, tmpdir = _build_egg()
def run(self, args, opts): try: import setuptools except ImportError: raise UsageError("setuptools not installed") if opts.list_targets: for name, target in _get_targets().items(): print "%-20s %s" % (name, target['url']) return if opts.list_projects: target = _get_target(opts.list_projects) req = urllib2.Request(_url(...
try: f = tempfile.TemporaryFile(dir=d) check_call([sys.executable, 'setup.py', 'bdist_egg', '-d', d], stdout=f) egg = glob.glob(os.path.join(d, '*.egg'))[0] return open(egg, 'rb') finally: shutil.rmtree(d)
f = tempfile.TemporaryFile(dir=d) check_call([sys.executable, 'setup.py', 'bdist_egg', '-d', d], stdout=f) egg = glob.glob(os.path.join(d, '*.egg'))[0] return open(egg, 'rb'), d
def _build_egg(): closest = closest_scrapy_cfg() os.chdir(os.path.dirname(closest)) if not os.path.exists('setup.py'): settings = get_config().get('settings', 'default') _create_default_setup_py(settings=settings) d = tempfile.mkdtemp() try: f = tempfile.TemporaryFile(dir=d) check_call([sys.executable, 'setup.py', 'bdi...
except (netrc.NetrcParseError, TypeError):
except (netrc.NetrcParseError, IOError, TypeError):
def _add_auth_header(request, target): if 'username' in target: u, p = target.get('username'), target.get('password', '') request.add_header('Authorization', basic_auth_header(u, p)) else: # try netrc try: host = urlparse(target['url']).hostname a = netrc.netrc().authenticators(host) request.add_header('Authorization',...
_log("Server response (%s):" % f.getcode())
_log("Server response (%s):" % f.code)
def _http_post(request): try: f = urllib2.urlopen(request) _log("Server response (%s):" % f.getcode()) print f.read() except urllib2.HTTPError, e: _log("Deploy failed (%s):" % e.getcode()) print e.read() except urllib2.URLError, e: _log("Deploy failed: %s" % e)
_log("Deploy failed (%s):" % e.getcode())
_log("Deploy failed (%s):" % e.code)
def _http_post(request): try: f = urllib2.urlopen(request) _log("Server response (%s):" % f.getcode()) print f.read() except urllib2.HTTPError, e: _log("Deploy failed (%s):" % e.getcode()) print e.read() except urllib2.URLError, e: _log("Deploy failed: %s" % e)
points = [self._readDoubles(fp, 2) for j in xrange(offsetParts[i])] part['points'] = points
part['points'] = [self._readDoubles(fp, 2) for j in xrange(offsetParts[i])]
def _readRecordPoly(self, fp): """ Type: PolyLine (3), Polygon (5), PolyLineZ (13), PolygonZ (15), PolyLineM (23), PolygonM (25), or MultiPatch (31)
nPointsOffset = offsetParts[i] part = parts[i] zPoints = self._readDoubles(fp, nPointsOffset) points = part['points'] nPointsInPart = len(points) nZPoints = len(zPoints) if nPointsInPart != nZPoints: msg = "Found %s points in part %s should be equal " + \ "to %s Z points." raise ValueError(msg % (nPointsInPart, i, nZP...
[parts[i]['points'][j].append(self._readDoubles(fp, 1)) for j in xrange(offsetParts[i])]
def _readRecordPoly(self, fp): """ Type: PolyLine (3), Polygon (5), PolyLineZ (13), PolygonZ (15), PolyLineM (23), PolygonM (25), or MultiPatch (31)
nPointsOffset = offsetParts[i] part = parts[i] measures = self._readDoubles(fp, nPointsOffset) points = part['points'] nPointsInPart = len(points) nMeasures = len(measures) if nPointsInPart != nMeasures: msg = "Found %s points in part %s should be equal " + \ "to %s measures." raise ValueError(msg % (nPointsInPart, i,...
parts[i]['measure'] = self._readDoubles(fp, offsetParts[i])
def _readRecordPoly(self, fp): """ Type: PolyLine (3), Polygon (5), PolyLineZ (13), PolygonZ (15), PolyLineM (23), PolygonM (25), or MultiPatch (31)