rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
def setMessageFlags(self, md, var, reply, actor=None): | def setMessageFlags(self, md, var, reply, routingId=None): if routingId is None: routingId = self.protocol.routingId() | def setMessageFlags(self, md, var, reply, actor=None): stmts = [ StmtExpr(ExprCall( ExprSelect(var, '->', 'set_routing_id'), args=[ self.protocol.routingId(actor) ])) ] |
args=[ self.protocol.routingId(actor) ])) ] | args=[ routingId ])) ] | def setMessageFlags(self, md, var, reply, actor=None): stmts = [ StmtExpr(ExprCall( ExprSelect(var, '->', 'set_routing_id'), args=[ self.protocol.routingId(actor) ])) ] |
def __init__(self, automation, options): | def __init__(self, automation, options, scriptDir): | def __init__(self, automation, options): self._automation = automation self._utilityPath = options.utilityPath self._xrePath = options.xrePath self._profileDir = options.serverProfilePath self.webServer = options.remoteWebServer self.httpPort = options.httpPort self.shutdownURL = "http://%(server)s:%(port)s/server/shut... |
"-f", "./" + "reftest/components/httpd.js", | "-f", os.path.join(self.scriptDir, "reftest/components/httpd.js"), | def start(self): "Run the Refest server, returning the process ID of the server." env = self._automation.environment(xrePath = self._xrePath) env["XPCOM_DEBUG_BREAK"] = "warn" if self._automation.IS_WIN32: env["PATH"] = env["PATH"] + ";" + self._xrePath |
"-f", "./" + "server.js"] | "-f", os.path.join(self.scriptDir, "server.js")] | def start(self): "Run the Refest server, returning the process ID of the server." env = self._automation.environment(xrePath = self._xrePath) env["XPCOM_DEBUG_BREAK"] = "warn" if self._automation.IS_WIN32: env["PATH"] = env["PATH"] + ";" + self._xrePath |
self.server = ReftestServer(localAutomation, options) | self.server = ReftestServer(localAutomation, options, self.scriptDir) | def startWebServer(self, options): """ Create the webserver on the host and start it up """ remoteXrePath = options.xrePath remoteUtilityPath = options.utilityPath localAutomation = Automation() |
os.mkdir(options.cachedir) | os.makedirs(options.cachedir) | def main(): from optparse import OptionParser o = OptionParser(usage="usage: %prog [options] configfile") o.add_option('-o', "--stub-output", type='string', dest='stub_output', default=None, help="Quick stub C++ source output file", metavar="FILE") o.add_option('--header-output', type='string', default=None, help="Quic... |
self.xpcsRunArgs = ['-e', '_execute_test();'] | self.xpcsRunArgs = ['-e', '_execute_test(); quit(0);'] | def buildXpcsRunArgs(self): """ Add arguments to run the test or make it interactive. """ if self.interactive: self.xpcsRunArgs = [ '-e', 'print("To start the test, type |_execute_test();|.");', '-i'] else: self.xpcsRunArgs = ['-e', '_execute_test();'] |
self._dm.pushDir(options.profilePath, self.remoteProfile) | if self._dm.pushDir(options.profilePath, self.remoteProfile) == None: raise devicemanager.FileError("Unable to copy profile to device.") | def buildProfile(self, options): manifest = Mochitest.buildProfile(self, options) self.localProfile = options.profilePath self._dm.pushDir(options.profilePath, self.remoteProfile) options.profilePath = self.remoteProfile return manifest |
manifest = path + "/chrome/" + filename self._dm.pushFile(filename, manifest) | manifest = path + "/chrome/" + os.path.basename(filename) if self._dm.pushFile(filename, manifest) == None: raise devicemanager.FileError("Unable to install Chrome files on device.") | def installChromeFile(self, filename, options): path = '/'.join(options.app.split('/')[:-1]) manifest = path + "/chrome/" + filename self._dm.pushFile(filename, manifest) return manifest |
auto.setServerPort(options.webServer, options.httpPort, options.sslPort) | auto.setServerInfo(options.webServer, options.httpPort, options.sslPort) | def main(): scriptdir = os.path.abspath(os.path.realpath(os.path.dirname(__file__))) dm = devicemanager.DeviceManager(None, None) auto = RemoteAutomation(dm, "fennec") parser = RemoteOptions(auto, scriptdir) options, args = parser.parse_args() dm = devicemanager.DeviceManager(options.deviceIP, options.devicePort) auto... |
def atos_proc(file): pipe = None | def addressToSymbol(file, address): converter = None | def atos_proc(file): pipe = None if not file in atoses: debug_file = separate_debug_file_for(file) or file pipe = subprocess.Popen(['/usr/bin/atos', '-o', debug_file], stdin=subprocess.PIPE, stdout=subprocess.PIPE) # COMMENTED OUT DUE TO BUFFERING PROBLEMS #atoses[file] = pipe else: pipe = atoses[file] return pipe |
pipe = subprocess.Popen(['/usr/bin/atos', '-o', debug_file], stdin=subprocess.PIPE, stdout=subprocess.PIPE) | converter = unbufferedLineConverter('/usr/bin/atos', ['-o', debug_file]) atoses[file] = converter | def atos_proc(file): pipe = None if not file in atoses: debug_file = separate_debug_file_for(file) or file pipe = subprocess.Popen(['/usr/bin/atos', '-o', debug_file], stdin=subprocess.PIPE, stdout=subprocess.PIPE) # COMMENTED OUT DUE TO BUFFERING PROBLEMS #atoses[file] = pipe else: pipe = atoses[file] return pipe |
pipe = atoses[file] return pipe | converter = atoses[file] return converter.convert("0x%X" % address) | def atos_proc(file): pipe = None if not file in atoses: debug_file = separate_debug_file_for(file) or file pipe = subprocess.Popen(['/usr/bin/atos', '-o', debug_file], stdin=subprocess.PIPE, stdout=subprocess.PIPE) # COMMENTED OUT DUE TO BUFFERING PROBLEMS #atoses[file] = pipe else: pipe = atoses[file] return pipe |
atos = atos_proc(file) | def cxxfilt(sym): if cxxfilt_proc is None: globals()["cxxfilt_proc"] = subprocess.Popen(['c++filt', '--no-strip-underscores', '--format', 'gnu-v3'], stdin=subprocess.PIPE, stdout=subprocess.PIPE) # strip underscores ourselves (works better than c++filt's # --strip-underscores) cxxfilt_proc.stdin.write(sym[1:] + "\n") r... | |
atos.stdin.write("0x%X\n" % address) atos.stdin.flush() atos.stdin.close() info = atos.stdout.readline().rstrip("\n") | info = addressToSymbol(file, address) | def cxxfilt(sym): if cxxfilt_proc is None: globals()["cxxfilt_proc"] = subprocess.Popen(['c++filt', '--no-strip-underscores', '--format', 'gnu-v3'], stdin=subprocess.PIPE, stdout=subprocess.PIPE) # strip underscores ourselves (works better than c++filt's # --strip-underscores) cxxfilt_proc.stdin.write(sym[1:] + "\n") r... |
def _shmemIdType(): return Type('Shmem::id_t') | def _shmemIdType(ptr=0): return Type('Shmem::id_t', ptr=ptr) | def _shmemIdType(): return Type('Shmem::id_t') |
return ExprCall(ExprVar('LookupShmem'), args=[ idexpr ]) | return ExprCall(ExprVar('LookupSharedMemory'), args=[ idexpr ]) | def _lookupShmem(idexpr): return ExprCall(ExprVar('LookupShmem'), args=[ idexpr ]) |
assert self.usesShmem() | assert self.decl.type.isToplevel() | def shmemMapVar(self): assert self.usesShmem() return ExprVar('mShmemMap') |
assert self.usesShmem() | assert self.decl.type.isToplevel() | def lastShmemIdVar(self): assert self.usesShmem() return ExprVar('mLastShmemId') |
assert self.usesShmem() | assert self.decl.type.isToplevel() | def shmemIdInit(self, side): assert self.usesShmem() # use the same scheme for shmem IDs as actor IDs if side is 'parent': return _FREED_ACTOR_ID elif side is 'child': return _NULL_ACTOR_ID else: assert 0 |
assert self.usesShmem() | assert self.decl.type.isToplevel() | def nextShmemIdExpr(self, side): assert self.usesShmem() if side is 'parent': op = '++' elif side is 'child': op = '--' return ExprPrefixUnop(self.lastShmemIdVar(), op) |
def lookupShmemVar(self): assert self.usesShmem() return ExprVar('LookupShmem') def registerShmemVar(self): assert self.usesShmem() return ExprVar('RegisterShmem') def registerShmemIdVar(self): assert self.usesShmem() return ExprVar('RegisterShmemId') def unregisterShmemVar(self): assert self.usesShmem() return Expr... | def nextShmemIdExpr(self, side): assert self.usesShmem() if side is 'parent': op = '++' elif side is 'child': op = '--' return ExprPrefixUnop(self.lastShmemIdVar(), op) | |
if p.usesShmem(): | if p.decl.type.isToplevel(): | for typedef in self.includedActorTypedefs: self.cls.addstmt(typedef) |
if p.usesShmem(): self.asyncSwitch.addcase( CaseLabel('SHMEM_CREATED_MESSAGE_TYPE'), self.genShmemCreatedHandler()) | for typedef in self.includedActorTypedefs: self.cls.addstmt(typedef) | |
if p.usesShmem(): self.cls.addstmts(self.makeShmemIface()) | def makeHandlerMethod(name, switch, hasReply, dispatches=0): params = [ Decl(Type('Message', const=1, ref=1), msgvar.name) ] if hasReply: params.append(Decl(Type('Message', ref=1, ptr=1), replyvar.name)) method = MethodDefn(MethodDecl(name, virtual=True, params=params, ret=_Result.Type())) if dispatches: routevar = Ex... | |
if p.usesShmem(): | if p.decl.type.isToplevel(): | def makeHandlerMethod(name, switch, hasReply, dispatches=0): params = [ Decl(Type('Message', const=1, ref=1), msgvar.name) ] if hasReply: params.append(Decl(Type('Message', ref=1, ptr=1), replyvar.name)) method = MethodDefn(MethodDecl(name, virtual=True, params=params, ret=_Result.Type())) if dispatches: routevar = Ex... |
rawvar = ExprVar('rawmem') allocShmem.addstmt(StmtDecl( Decl(_autoptr(_rawShmemType()), rawvar.name), initargs=[ _shmemAlloc(sizevar) ])) failif = StmtIf(ExprNot(rawvar)) failif.addifstmt(StmtReturn(ExprLiteral.FALSE)) allocShmem.addstmt(failif) handlevar = ExprVar('handle') allocShmem.addstmt(StmtDecl( Decl(_shmemHan... | ifallocfails = StmtIf(ExprNot(rawvar)) ifallocfails.addifstmt(StmtReturn(ExprLiteral.FALSE)) | def makeShmemIface(self): p = self.protocol idvar = ExprVar('aId') |
return [ Whitespace('// Methods for managing shmem\n', indent=1), allocShmem, Whitespace.NL ] def genShmemCreatedHandler(self): p = self.protocol assert p.decl.type.isToplevel() | def makeShmemIface(self): p = self.protocol idvar = ExprVar('aId') | |
lookupShmem = MethodDefn(MethodDecl( p.lookupShmemVar().name, params=[ Decl(_shmemIdType(), idvar.name) ], ret=_rawShmemType(ptr=1))) lookupShmem.addstmt(StmtReturn(ExprCall( ExprSelect(p.shmemMapVar(), '.', 'Lookup'), args=[ idvar ]))) mapvar = ExprVar('aMap') tmpvar = ExprVar('tmp') registerShmem = MethodDefn(Method... | def makeShmemIface(self): p = self.protocol idvar = ExprVar('aId') | |
StmtExpr(ExprCall(self.protocol.registerShmemIdVar(), args=[ _autoptrForget(rawvar), idvar ])), | StmtExpr(ExprCall( ExprSelect(p.shmemMapVar(), '.', 'AddWithID'), args=[ _autoptrForget(rawvar), idvar ])), | def genShmemCreatedHandler(self): case = StmtBlock() |
testfiles = os.path.abspath([os.path.join(testdir, self.singleFile)]) | testfiles = [os.path.abspath(os.path.join(testdir, self.singleFile))] | def getTestFiles(self, testdir): """ Ff a single test file was specified, we only want to execute that test, otherwise return a list of all tests in a directory |
if not xpcsh.runTests(args[0], **options.__dict__): | if not xpcsh.runTests(args[0], testdirs=args[1:], **options.__dict__): | def main(): parser = XPCShellOptions() options, args = parser.parse_args() if len(args) < 2 and options.manifest is None or \ (len(args) < 1 and options.manifest is not None): print >>sys.stderr, """Usage: %s <path to xpcshell> <test dirs> or: %s --manifest=test.manifest <path to xpcshell>""" % (sys.argv[0], sys.argv[... |
self.cls.addstmts([ meth, Whitespace.NL ]) | refmeth = MethodDefn(MethodDecl( p.managedMethod(managed, self.side).name, params=[ ], ret=p.managedVarType(managed, self.side, const=1, ref=1), const=1)) refmeth.addstmt(StmtReturn(p.managedVar(managed, self.side))) self.cls.addstmts([ meth, refmeth, Whitespace.NL ]) | for typedef in self.includedActorTypedefs: self.cls.addstmt(typedef) |
onclose.addstmt(StmtExpr(ExprCall( destroysubtreevar, args=[ _DestroyReason.NormalShutdown ]))) | onclose.addstmts([ StmtExpr(ExprCall(destroysubtreevar, args=[ _DestroyReason.NormalShutdown ])), StmtExpr(ExprCall(deallocsubtreevar)) ]) | def makeHandlerMethod(name, switch, hasReply, dispatches=0): params = [ Decl(Type('Message', const=1, ref=1), msgvar.name) ] if hasReply: params.append(Decl(Type('Message', ref=1, ptr=1), replyvar.name)) method = MethodDefn(MethodDecl(name, virtual=True, params=params, ret=_Result.Type())) if dispatches: routevar = Ex... |
onerror.addstmt(StmtExpr(ExprCall( destroysubtreevar, args=[ _DestroyReason.AbnormalShutdown ]))) | onerror.addstmts([ StmtExpr(ExprCall(destroysubtreevar, args=[ _DestroyReason.AbnormalShutdown ])), StmtExpr(ExprCall(deallocsubtreevar)) ]) | def makeHandlerMethod(name, switch, hasReply, dispatches=0): params = [ Decl(Type('Message', const=1, ref=1), msgvar.name) ] if hasReply: params.append(Decl(Type('Message', ref=1, ptr=1), replyvar.name)) method = MethodDefn(MethodDecl(name, virtual=True, params=params, ret=_Result.Type())) if dispatches: routevar = Ex... |
if p.decl.type.isToplevel(): destroysubtree.addstmt(StmtExpr(ExprCall(deallocsubtreevar))) | def makeHandlerMethod(name, switch, hasReply, dispatches=0): params = [ Decl(Type('Message', const=1, ref=1), msgvar.name) ] if hasReply: params.append(Decl(Type('Message', ref=1, ptr=1), replyvar.name)) method = MethodDefn(MethodDecl(name, virtual=True, params=params, ret=_Result.Type())) if dispatches: routevar = Ex... | |
+ [ StmtExpr(self.callActorDestroy(actorexpr)) ] + [ StmtExpr(self.callRemoveActor(actorexpr)) ] + [ StmtExpr(self.callDeallocActor(md, actorexpr)) ]) | + [ StmtExpr(self.callActorDestroy(actorexpr)), StmtExpr(self.callRemoveActor(actorexpr)), StmtExpr(self.callDeallocSubtree(md, actorexpr)), StmtExpr(self.callDeallocActor(md, actorexpr)) ]) | def dtorEpilogue(self, md, actorexpr): return (self.unregisterActor(actorexpr) + [ StmtExpr(self.callActorDestroy(actorexpr)) ] + [ StmtExpr(self.callRemoveActor(actorexpr)) ] + [ StmtExpr(self.callDeallocActor(md, actorexpr)) ]) |
elif sys.platform == 'osx': | elif sys.platform == 'osx' or sys.platform == "darwin": | def buildEnvironment(self): """ Create and returns a dictionary of self.env to include all the appropriate env variables and values. On a remote system, we overload this to set different values and are missing things like os.environ and PATH. """ self.env = dict(os.environ) # Make assertions fatal self.env["XPCOM_DEBUG... |
def _shmemType(ptr=0, ref=0): | def _shmemType(ptr=0, const=1, ref=0): | def _shmemType(ptr=0, ref=0): return Type('Shmem', ptr=ptr, ref=ref) |
rawvar = ExprVar('segment') | def implementManagerIface(self): p = self.protocol routedvar = ExprVar('aRouted') idvar = ExprVar('aId') shmemvar = ExprVar('aShmem') sizevar = ExprVar('aSize') typevar = ExprVar('type') listenertype = Type('ChannelListener', ptr=1) | |
failif.addifstmt(StmtReturn(ExprLiteral.FALSE)) | failif.addifstmt(StmtReturn(ExprLiteral.NULL)) | def implementManagerIface(self): p = self.protocol routedvar = ExprVar('aRouted') idvar = ExprVar('aId') shmemvar = ExprVar('aShmem') sizevar = ExprVar('aSize') typevar = ExprVar('type') listenertype = Type('ChannelListener', ptr=1) |
os.remove(d) | dumpSavePath = os.environ.get('MINIDUMP_SAVE_PATH', None) if dumpSavePath: shutil.move(d, dumpSavePath) print "Saved dump as %s" % os.path.join(dumpSavePath, os.path.basename(d)) else: os.remove(d) | def checkForCrashes(dumpDir, symbolsPath, testName=None): stackwalkPath = os.environ.get('MINIDUMP_STACKWALK', None) # try to get the caller's filename if no test name is given if testName is None: try: testName = os.path.basename(sys._getframe(1).f_code.co_filename) except: testName = "unknown" foundCrash = False dum... |
f.write(" return xpc_qsXPCOMObjectToJsval(lccx, result, " "xpc_qsGetWrapperCache(result), &NS_GET_IID(%s), " "&interfaces[k_%s], %s);\n" | f.write(" return xpc_qsXPCOMObjectToJsval(lccx, " "ToSupports(result), xpc_qsGetWrapperCache(result), " "&NS_GET_IID(%s), &interfaces[k_%s], %s);\n" | def writeResultConv(f, type, jsvalPtr, jsvalRef): """ Emit code to convert the C++ variable `result` to a jsval. The emitted code contains a return statement; it returns JS_TRUE on success, JS_FALSE on error. """ # From NativeData2JS. typeName = getBuiltinOrNativeTypeName(type) if typeName is not None: template = resu... |
if isMethod: code = customMethodCall['code'] elif isGetter: code = customMethodCall['getter_code'] else: code = customMethodCall['setter_code'] | def writeQuickStub(f, customMethodCalls, member, stubName, isSetter=False): """ Write a single quick stub (a custom SpiderMonkey getter/setter/method) for the specified XPCOM interface-member. """ isAttr = (member.kind == 'attribute') isMethod = (member.kind == 'method') assert isAttr or isMethod isGetter = isAttr and ... | |
code = None | callTemplate = "" | def writeQuickStub(f, customMethodCalls, member, stubName, isSetter=False): """ Write a single quick stub (a custom SpiderMonkey getter/setter/method) for the specified XPCOM interface-member. """ isAttr = (member.kind == 'attribute') isMethod = (member.kind == 'method') assert isAttr or isMethod isGetter = isAttr and ... |
f.write(" nsCOMPtr<%s> debug_self = do_QueryInterface(self);\n" | f.write(" nsCOMPtr<%s> debug_self;\n" " CallQueryInterface(self, getter_AddRefs(debug_self));\n" | f.write("#ifdef DEBUG\n") |
f.write(" JSBool ok = xpc_qsXPCOMObjectToJsval(lccx, result, " "xpc_qsGetWrapperCache(result), &NS_GET_IID(%s), " "&interfaces[k_%s], &vp.array[0]);" "\n" % (type.name, type.name)) | f.write(" JSBool ok = xpc_qsXPCOMObjectToJsval(lccx, " "ToSupports(result), xpc_qsGetWrapperCache(result), " "&NS_GET_IID(%s), &interfaces[k_%s], &vp.array[0]);\n" % (type.name, type.name)) | def writeTraceableResultConv(f, type): typeName = getBuiltinOrNativeTypeName(type) if typeName is not None: template = traceableResultConvTemplates.get(typeName) if template is not None: values = { 'errorStr': getFailureString( getTraceInfoDefaultReturn(type), 2) } f.write(substitute(template, values)) return # else fa... |
cmd = [ 'gdb', '--args' ] + get_test_cmd(tc.path, lib_dir) | cmd = [ 'gdb', '--args' ] + get_test_cmd(tc.path, tc.jitflags, lib_dir) | def parse_jitflags(): jitflags = [ [ '-' + flag for flag in flags ] for flags in OPTIONS.jitflags.split(',') ] for flags in jitflags: for flag in flags: if flag not in ('-j', '-m'): print('Invalid jit flag: "%s"'%flag) sys.exit(1) return jitflags |
raise "No File found for: " + str(fileName) | raise devicemanager.FileError("No File found for: " + str(fileName)) | def verifyFilePath(self, fileName): # approot - path to root of application - firefox or fennec # xreroot - path to xulrunner binaries - firefox or fennec/xulrunner # xpcshell - full or relative path to xpcshell binary #given fileName, returns full path of existing file if (self.device.fileExists(fileName)): return fil... |
raise "No Dir found for: " + str(fileName) | raise devicemanager.FileError("No Dir found for: " + str(fileName)) | def verifyDirPath(self, fileName): # approot - path to root of application - firefox or fennec # xreroot - path to xulrunner binaries - firefox or fennec/xulrunner # xpcshell - full or relative path to xpcshell binary #given fileName, returns full path of existing file if (self.device.dirExists(fileName)): return fileN... |
profileDir = self.device.getTempDir() self.env["XPCSHELL_TEST_PROFILE_DIR"] = profileDir return profileDir | self.device.removeDir(self.profileDir) self.device.mkDir(self.profileDir) self.env["XPCSHELL_TEST_PROFILE_DIR"] = self.profileDir return self.profileDir | def setupProfileDir(self): profileDir = self.device.getTempDir() self.env["XPCSHELL_TEST_PROFILE_DIR"] = profileDir return profileDir |
dm.pushFile(zipName, '/tests/xpcshell.7z') dm.unpackFile('xpcshell.7z') | if dm.pushFile(zipName, '/tests/xpcshell.7z') == None: raise devicemanager.FileError("failed to copy xpcshell.7z to device") if dm.unpackFile('xpcshell.7z') == None: raise devicemanager.FileError("failed to unpack xpcshell.7z on the device") | def main(): parser = RemoteXPCShellOptions() options, args = parser.parse_args() if len(args) < 2 and options.manifest is None or \ (len(args) < 1 and options.manifest is not None): print "len(args): " + str(len(args)) print >>sys.stderr, """Usage: %s <path to xpcshell> <test dirs> or: %s --manifest=test.manifest <pa... |
def _shmemAlloc(size, type): | def _shmemAlloc(size, type, unsafe): | def _shmemAlloc(size, type): # starts out UNprotected return ExprCall(ExprVar('Shmem::Alloc'), args=[ _shmemBackstagePass(), size, type, ExprLiteral.FALSE ]) |
args=[ _shmemBackstagePass(), size, type, ExprLiteral.FALSE ]) | args=[ _shmemBackstagePass(), size, type, unsafe ]) | def _shmemAlloc(size, type): # starts out UNprotected return ExprCall(ExprVar('Shmem::Alloc'), args=[ _shmemBackstagePass(), size, type, ExprLiteral.FALSE ]) |
initargs=[ _shmemAlloc(sizevar, typevar) ])) | initargs=[ _shmemAlloc(sizevar, typevar, unsafevar) ])) | def implementManagerIface(self): p = self.protocol routedvar = ExprVar('aRouted') idvar = ExprVar('aId') shmemvar = ExprVar('aShmem') rawvar = ExprVar('segment') sizevar = ExprVar('aSize') typevar = ExprVar('type') listenertype = Type('ChannelListener', ptr=1) |
[ sizevar, typevar, idvar ]))) | [ sizevar, typevar, unsafevar, idvar ]))) | def implementManagerIface(self): p = self.protocol routedvar = ExprVar('aRouted') idvar = ExprVar('aId') shmemvar = ExprVar('aShmem') rawvar = ExprVar('segment') sizevar = ExprVar('aSize') typevar = ExprVar('type') listenertype = Type('ChannelListener', ptr=1) |
allocShmem = MethodDefn(MethodDecl( 'AllocShmem', params=[ Decl(Type.SIZE, sizevar.name), Decl(_shmemTypeType(), typevar.name), Decl(_shmemType(ptr=1), memvar.name) ], ret=Type.BOOL)) ifallocfails = StmtIf(ExprNot(rawvar)) ifallocfails.addifstmt(StmtReturn.FALSE) allocShmem.addstmts([ StmtDecl(Decl(_shmemIdType(), id... | def allocShmemMethod(name, unsafe): method = MethodDefn(MethodDecl( name, params=[ Decl(Type.SIZE, sizevar.name), Decl(_shmemTypeType(), typevar.name), Decl(_shmemType(ptr=1), memvar.name) ], ret=Type.BOOL)) ifallocfails = StmtIf(ExprNot(rawvar)) ifallocfails.addifstmt(StmtReturn.FALSE) if unsafe: unsafe = Exp... | def makeShmemIface(self): p = self.protocol idvar = ExprVar('aId') sizevar = ExprVar('aSize') typevar = ExprVar('aType') memvar = ExprVar('aMem') outmemvar = ExprVar('aOutMem') rawvar = ExprVar('rawmem') |
ifallocfails, Whitespace.NL, StmtExpr(ExprAssn( ExprDeref(memvar), _shmemCtor(_autoptrForget(rawvar), idvar))), StmtReturn.TRUE ]) | ifallocfails, Whitespace.NL, StmtExpr(ExprAssn( ExprDeref(memvar), _shmemCtor(_autoptrForget(rawvar), idvar))), StmtReturn.TRUE ]) return method allocShmem = allocShmemMethod('AllocShmem', False) allocUnsafeShmem = allocShmemMethod('AllocUnsafeShmem', True) | def makeShmemIface(self): p = self.protocol idvar = ExprVar('aId') sizevar = ExprVar('aSize') typevar = ExprVar('aType') memvar = ExprVar('aMem') outmemvar = ExprVar('aOutMem') rawvar = ExprVar('rawmem') |
f.write(" (%d, (static, %s, %s, %s, 0, nanojit::ACCSET_STORE_ANY)))\n\n" | f.write(" (%d, (static, %s, %s, %s, 0, nanojit::ACC_STORE_ANY)))\n\n" | def writeTraceableQuickStub(f, customMethodCalls, member, stubName): assert member.traceable traceInfo = { 'type': getTraceInfoReturnType(member.realtype) + "_FAIL", 'params': ["CONTEXT", "THIS"] } haveCcx = memberNeedsCcx(member) customMethodCall = customMethodCalls.get(stubName, None) if customMethodCall is None:... |
print """TEST-UNEXPECTED-FAIL | %s | test failed (with xpcshell return code: %d), see following log: >>>>>>> %s <<<<<<<""" % (test, self.getReturnCode(proc), stdout) | print "TEST-UNEXPECTED-FAIL | %s | test failed (with xpcshell return code: %d), see following log:" % (test, self.getReturnCode(proc)) print_stdout(stdout) | def runTests(self, xpcshell, xrePath=None, symbolsPath=None, manifest=None, testdirs=[], testPath=None, interactive=False, verbose=False, keepGoing=False, logfiles=True, thisChunk=1, totalChunks=1, debugger=None, debuggerArgs=None, debuggerInteractive=False, profileName=None): """Run xpcshell tests. |
print """>>>>>>>\n%s\n<<<<<<<""" % stdout | print_stdout(stdout) | def runTests(self, xpcshell, xrePath=None, symbolsPath=None, manifest=None, testdirs=[], testPath=None, interactive=False, verbose=False, keepGoing=False, logfiles=True, thisChunk=1, totalChunks=1, debugger=None, debuggerArgs=None, debuggerInteractive=False, profileName=None): """Run xpcshell tests. |
f.write(" return xpc_qsXPCOMObjectToJsval(lccx, " "ToSupports(result), xpc_qsGetWrapperCache(result), " "&NS_GET_IID(%s), &interfaces[k_%s], %s);\n" | f.write(" return xpc_qsXPCOMObjectToJsval(lccx, result, " "xpc_qsGetWrapperCache(result), &NS_GET_IID(%s), " "&interfaces[k_%s], %s);\n" | def writeResultConv(f, type, jsvalPtr, jsvalRef): """ Emit code to convert the C++ variable `result` to a jsval. The emitted code contains a return statement; it returns JS_TRUE on success, JS_FALSE on error. """ # From NativeData2JS. typeName = getBuiltinOrNativeTypeName(type) if typeName is not None: template = resu... |
if isMethod: code = customMethodCall.get('code', None) elif isGetter: code = customMethodCall.get('getter_code', None) else: code = customMethodCall.get('setter_code', None) else: code = None if code is not None: | def writeQuickStub(f, customMethodCalls, member, stubName, isSetter=False): """ Write a single quick stub (a custom SpiderMonkey getter/setter/method) for the specified XPCOM interface-member. """ isAttr = (member.kind == 'attribute') isMethod = (member.kind == 'method') assert isAttr or isMethod isGetter = isAttr and ... | |
callTemplate = "" | code = None | def writeQuickStub(f, customMethodCalls, member, stubName, isSetter=False): """ Write a single quick stub (a custom SpiderMonkey getter/setter/method) for the specified XPCOM interface-member. """ isAttr = (member.kind == 'attribute') isMethod = (member.kind == 'method') assert isAttr or isMethod isGetter = isAttr and ... |
f.write(" nsCOMPtr<%s> debug_self;\n" " CallQueryInterface(self, getter_AddRefs(debug_self));\n" | f.write(" nsCOMPtr<%s> debug_self = do_QueryInterface(self);\n" | f.write("#ifdef DEBUG\n") |
f.write(" JSBool ok = xpc_qsXPCOMObjectToJsval(lccx, " "ToSupports(result), xpc_qsGetWrapperCache(result), " "&NS_GET_IID(%s), &interfaces[k_%s], &vp.array[0]);\n" % (type.name, type.name)) | f.write(" JSBool ok = xpc_qsXPCOMObjectToJsval(lccx, result, " "xpc_qsGetWrapperCache(result), &NS_GET_IID(%s), " "&interfaces[k_%s], &vp.array[0]);" "\n" % (type.name, type.name)) | def writeTraceableResultConv(f, type): typeName = getBuiltinOrNativeTypeName(type) if typeName is not None: template = traceableResultConvTemplates.get(typeName) if template is not None: values = { 'errorStr': getFailureString( getTraceInfoDefaultReturn(type), 2) } f.write(substitute(template, values)) return # else fa... |
if customMethodCall is None: customMethodCall = customMethodCalls.get(member.iface.name + '_', None) if customMethodCall is not None: assert not 'code' in customMethodCall | def writeTraceableQuickStub(f, customMethodCalls, member, stubName): assert member.traceable traceInfo = { 'type': getTraceInfoReturnType(member.realtype) + "_FAIL", 'params': ["CONTEXT", "THIS"] } haveCcx = memberNeedsCcx(member) customMethodCall = customMethodCalls.get(stubName, None) if customMethodCall is None:... | |
warn("Unable to unbox argument of type %s" % type.name) | warn("Unable to unbox argument of type %s (native type %s)" % (type.name, typeName)) | def writeArgumentUnboxing(f, i, name, type, haveCcx, optional, rvdeclared, nullBehavior, undefinedBehavior): # f - file to write to # i - int or None - Indicates the source jsval. If i is an int, the source # jsval is argv[i]; otherwise it is *vp. But if Python i >= C++ argc, # which can only happen if option... |
'[cstring]': | '[utf8string]': | def writeFailure(f, retval, indent): f.write(getFailureString(retval, indent)) |
parts.append(js_args) | parts += js_args | def set_js_cmd_prefix(self, js_path, js_args, debugger_prefix): parts = [] if debugger_prefix: parts += debugger_prefix parts.append(js_path) if js_args: parts.append(js_args) self.js_cmd_prefix = parts |
op.add_option('--args', dest='shell_args', | op.add_option('--args', dest='shell_args', default='', | def run_tests(tests, results): """Run the given tests, sending raw results to the given results accumulator.""" pb = None if not OPTIONS.hide_progress: try: from progressbar import ProgressBar pb = ProgressBar('', len(tests), 16) except ImportError: pass results.pb = pb test_list = [ TestTask(test) for test in tests ]... |
TestTask.set_js_cmd_prefix(JS, OPTIONS.shell_args, debugger_prefix) | TestTask.set_js_cmd_prefix(JS, OPTIONS.shell_args.split(), debugger_prefix) | def run_tests(tests, results): """Run the given tests, sending raw results to the given results accumulator.""" pb = None if not OPTIONS.hide_progress: try: from progressbar import ProgressBar pb = ProgressBar('', len(tests), 16) except ImportError: pass results.pb = pb test_list = [ TestTask(test) for test in tests ]... |
if e.errno == errno.ENOENT or \ (sys.platform == "win32" and e.errno == errno.EACCES): | if e.errno == errno.ENOENT or e.errno == errno.EACCES: | def lockFile(lockfile, max_wait = 600): '''Create and hold a lockfile of the given name, with the given timeout. To release the lock, delete the returned object. ''' while True: try: fd = os.open(lockfile, os.O_EXCL | os.O_RDWR | os.O_CREAT) # we created the lockfile, so we're the owner break except OSError, e: if e.e... |
struct = Class(sd.name, struct=1, final=1) | struct = Class(sd.name, final=1) | def _generateCxxStruct(sd): ''' ''' # compute all the typedefs and forward decls we need to make gettypedeps = _ComputeTypeDeps(sd.decl.type) for f in sd.fields: f.ipdltype.accept(gettypedeps) usingTypedefs = gettypedeps.usingTypedefs forwarddeclstmts = gettypedeps.forwardDeclStmts struct = Class(sd.name, struct=1, f... |
traceReturnTypeMap = { | traceTypeMap = { | f.write("#ifdef DEBUG\n") |
["jsval ", "JSVAL", "JSVAL_VOID"], | ["uint32 ", "UINT32", "UINT32", " 0"], | f.write("#ifdef DEBUG\n") |
["JSBool ", "BOOL", "JS_FALSE"], | ["JSBool ", "BOOL", "BOOL", " JS_FALSE"], | f.write("#ifdef DEBUG\n") |
["int32 ", "INT32", "0"], | ["int32 ", "INT32", "INT32", " 0"], | f.write("#ifdef DEBUG\n") |
["uint32 ", "UINT32", "0"], | ["uint32 ", "UINT32", "UINT32", " 0"], | f.write("#ifdef DEBUG\n") |
["jsdouble ", "DOUBLE", "0"], | ["jsdouble ", "DOUBLE", "DOUBLE", " 0"], | f.write("#ifdef DEBUG\n") |
["uint32 ", "UINT32", "0"] | ["uint32 ", "UINT32", "UINT32", " 0"], '[astring]': ["JSString *", "STRING", "STRING_OR_NULL", " nsnull"], '[domstring]': ["JSString *", "STRING", "STRING_OR_NULL", " nsnull"], '[cstring]': ["JSString *", "STRING", "STRING_OR_NULL", " nsnull"], 'string': ["JSString *", "STRING", "STRING_OR_NULL", " nsnull"], 'wstring':... | f.write("#ifdef DEBUG\n") |
traceTypeMap = { '[astring]': ["JSString *", "STRING", "nsnull"], '[domstring]': ["JSString *", "STRING", "nsnull"], '[cstring]': ["JSString *", "STRING", "nsnull"], 'string': ["JSString *", "STRING", "nsnull"], 'wstring': ["JSString *", "STRING", "nsnull"], '_default': ["jsval ", "JSVAL", "JSVAL_VOID"] } | f.write("#ifdef DEBUG\n") | |
type = getBuiltinOrNativeTypeName(type) traceType = traceReturnTypeMap.get(type) or traceTypeMap.get(type) or traceTypeMap.get("_default") assert traceType return traceType[0] | typeName = getBuiltinOrNativeTypeName(type) if typeName is not None: traceType = traceTypeMap.get(typeName)[0] else: assert isInterfaceType(type) traceType = "js::Value *" return traceType | def getTraceType(type): type = getBuiltinOrNativeTypeName(type) traceType = traceReturnTypeMap.get(type) or traceTypeMap.get(type) or traceTypeMap.get("_default") assert traceType return traceType[0] |
type = getBuiltinOrNativeTypeName(type) traceType = traceReturnTypeMap.get(type) or traceTypeMap.get("_default") assert traceType return traceType[0] | typeName = getBuiltinOrNativeTypeName(type) if typeName is not None: traceType = traceTypeMap.get(typeName)[0] else: assert isInterfaceType(type) traceType = "JSObject *" return traceType | def getTraceReturnType(type): type = getBuiltinOrNativeTypeName(type) traceType = traceReturnTypeMap.get(type) or traceTypeMap.get("_default") assert traceType return traceType[0] |
type = getBuiltinOrNativeTypeName(type) traceType = traceReturnTypeMap.get(type) or traceTypeMap.get(type) or traceTypeMap.get("_default") assert traceType return traceType[1] | typeName = getBuiltinOrNativeTypeName(type) if typeName is not None: traceType = traceTypeMap.get(typeName)[1] else: assert isInterfaceType(type) traceType = "VALUEPTR" return traceType | def getTraceInfoType(type): type = getBuiltinOrNativeTypeName(type) traceType = traceReturnTypeMap.get(type) or traceTypeMap.get(type) or traceTypeMap.get("_default") assert traceType return traceType[1] |
type = getBuiltinOrNativeTypeName(type) traceType = traceReturnTypeMap.get(type) or traceTypeMap.get("_default") assert traceType return traceType[1] | typeName = getBuiltinOrNativeTypeName(type) if typeName is not None: traceType = traceTypeMap.get(typeName)[2] else: assert isInterfaceType(type) traceType = "OBJECT_OR_NULL" return traceType | def getTraceInfoReturnType(type): type = getBuiltinOrNativeTypeName(type) traceType = traceReturnTypeMap.get(type) or traceTypeMap.get("_default") assert traceType return traceType[1] |
type = getBuiltinOrNativeTypeName(type) traceType = traceTypeMap.get(type) or traceTypeMap.get("_default") assert traceType return traceType[2] | typeName = getBuiltinOrNativeTypeName(type) if typeName is not None: traceType = traceTypeMap.get(typeName)[3] else: assert isInterfaceType(type) traceType = " nsnull" return traceType | def getTraceInfoDefaultReturn(type): type = getBuiltinOrNativeTypeName(type) traceType = traceTypeMap.get(type) or traceTypeMap.get("_default") assert traceType return traceType[2] |
"XPCVariant::newVariant(ccx, ${argVal})));\n" | "XPCVariant::newVariant(ccx, *js::Jsvalify(${argVal}))));\n" | def writeTraceableArgumentConversion(f, member, i, name, type, haveCcx, rvdeclared): argVal = "_arg%d" % i params = { 'name': name, 'argVal': argVal } typeName = getBuiltinOrNativeTypeName(type) if typeName is not None: template = traceableArgumentConversionTemplates.get(typeName) if template is not None: f.write(sub... |
"cx, %s, &%s, &%sref.ptr, &vp.array[%d]);\n" | "cx, *js::Jsvalify(%s), &%s, &%sref.ptr, &vp.array[%d]);\n" | def writeTraceableArgumentConversion(f, member, i, name, type, haveCcx, rvdeclared): argVal = "_arg%d" % i params = { 'name': name, 'argVal': argVal } typeName = getBuiltinOrNativeTypeName(type) if typeName is not None: template = traceableArgumentConversionTemplates.get(typeName) if template is not None: f.write(sub... |
" return JSVAL_VOID;\n", | " return 0;\n", | def writeTraceableArgumentConversion(f, member, i, name, type, haveCcx, rvdeclared): argVal = "_arg%d" % i params = { 'name': name, 'argVal': argVal } typeName = getBuiltinOrNativeTypeName(type) if typeName is not None: template = traceableArgumentConversionTemplates.get(typeName) if template is not None: f.write(sub... |
" jsval rval;\n" " if (!xpc_qsStringToJsval(cx, result, &rval)) {\n" | " JSString *rval;\n" " if (!xpc_qsStringToJsstring(cx, result, &rval)) {\n" | def writeTraceableArgumentConversion(f, member, i, name, type, haveCcx, rvdeclared): argVal = "_arg%d" % i params = { 'name': name, 'argVal': argVal } typeName = getBuiltinOrNativeTypeName(type) if typeName is not None: template = traceableArgumentConversionTemplates.get(typeName) if template is not None: f.write(sub... |
" return rval;\n", | " return rval;\n" | def writeTraceableArgumentConversion(f, member, i, name, type, haveCcx, rvdeclared): argVal = "_arg%d" % i params = { 'name': name, 'argVal': argVal } typeName = getBuiltinOrNativeTypeName(type) if typeName is not None: template = traceableArgumentConversionTemplates.get(typeName) if template is not None: f.write(sub... |
onconnected = MethodDefn(MethodDecl('OnChannelConnected')) | onconnected = MethodDefn(MethodDecl('OnChannelConnected', params=[ Decl(Type.INT32, 'pid') ])) | def makeHandlerMethod(name, switch, hasReply, dispatches=0): params = [ Decl(Type('Message', const=1, ref=1), msgvar.name) ] if hasReply: params.append(Decl(Type('Message', ref=1, ptr=1), replyvar.name)) method = MethodDefn(MethodDecl(name, virtual=True, params=params, ret=_Result.Type())) if dispatches: routevar = Ex... |
f.write(" (%d, (static, %s, %s, %s, 0, 0)))\n\n" | f.write(" (%d, (static, %s, %s, %s, 0, nanojit::ACC_STORE_ANY)))\n\n" | def writeTraceableQuickStub(f, customMethodCalls, member, stubName): assert member.traceable traceInfo = { 'type': getTraceInfoReturnType(member.realtype) + "_FAIL", 'params': ["CONTEXT", "THIS"] } haveCcx = memberNeedsCcx(member) customMethodCall = customMethodCalls.get(stubName, None) if customMethodCall is not N... |
if singleFile in [os.path.basename(x) for x in testfiles]: testfiles = [os.path.join(testdir, singleFile)] | if self.singleFile in [os.path.basename(x) for x in testfiles]: testfiles = [os.path.join(testdir, self.singleFile)] | def getTestFiles(self, testdir): """ Ff a single test file was specified, we only want to execute that test, otherwise return a list of all tests in a directory |
if testPath and not testdir.endswith(testPath): | if self.testPath and not testdir.endswith(self.testPath): | def runTests(self, xpcshell, xrePath=None, symbolsPath=None, manifest=None, testdirs=[], testPath=None, interactive=False, logfiles=True, debuggerInfo=None): """Run xpcshell tests. |
path_to_new = header_path('new', compiler) | def main(outdir, compiler, template_file, header_list_file): if not os.path.isdir(outdir): os.mkdir(outdir) template = open(template_file, 'r').read() for header in open(header_list_file, 'r'): header = header.rstrip() if 0 == len(header) or is_comment(header): continue path = header_path(header, compiler) try: f = ... | |
HEADER_PATH=path)) | HEADER_PATH=path, NEW_HEADER_PATH=path_to_new)) | def main(outdir, compiler, template_file, header_list_file): if not os.path.isdir(outdir): os.mkdir(outdir) template = open(template_file, 'r').read() for header in open(header_list_file, 'r'): header = header.rstrip() if 0 == len(header) or is_comment(header): continue path = header_path(header, compiler) try: f = ... |
" qsObjectHelper helper(ToSupports(result));\n" " helper.SetNode(result);\n" " helper.SetCanonical(ToCanonicalSupports(result));\n" | def writeResultConv(f, type, jsvalPtr, jsvalRef): """ Emit code to convert the C++ variable `result` to a jsval. The emitted code contains a return statement; it returns JS_TRUE on success, JS_FALSE on error. """ # From NativeData2JS. typeName = getBuiltinOrNativeTypeName(type) if typeName is not None: template = resu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.