def ensureBuild(options): if options.existingBuildDir: # Pre-downloaded treeherder builds (browser only for now) bDir = options.existingBuildDir bType = 'local-build' bSrc = bDir bRev = '' manyTimedRunArgs = [] elif not options.useTreeherderBuilds: if options.testType == "js": # Compiled js shells options.buildOptions = buildOptions.parseShellOptions(options.buildOptions) options.timeout = options.timeout or machineTimeoutDefaults(options) with LockDir(compileShell.getLockDirPath(options.buildOptions.repoDir)): bRev = hgCmds.getRepoHashAndId(options.buildOptions.repoDir)[0] cshell = compileShell.CompiledShell(options.buildOptions, bRev) compileShell.obtainShell(cshell, updateLatestTxt=True) bDir = cshell.getShellCacheDir() # Strip out first 3 chars or else the dir name in fuzzing jobs becomes: # js-js-dbg-opt-64-dm-linux # This is because options.testType gets prepended along with a dash later. bType = buildOptions.computeShellType(options.buildOptions)[3:] bSrc = ( 'Create another shell in shell-cache like this one:\n' + 'python -u %s -b "%s -R %s" -r %s\n\n' % ( os.path.join(path3, 'compileShell.py'), options.buildOptions.buildOptionsStr, options.buildOptions.repoDir, bRev ) + '==============================================\n' + '| Fuzzing %s js shell builds\n' % cshell.getRepoName() + '| DATE: %s\n' % sps.dateStr() + '==============================================\n\n') manyTimedRunArgs = mtrArgsCreation(options, cshell) print 'buildDir is: ' + bDir print 'buildSrc is: ' + bSrc else: # Compiled browser options.buildOptions = buildBrowser.parseOptions(options.buildOptions.split()) bDir = options.buildOptions.objDir bType = platform.system() + "-" + os.path.basename(options.buildOptions.mozconfig) bSrc = repr(hgCmds.getRepoHashAndId(options.buildOptions.repoDir)) bRev = '' manyTimedRunArgs = [] success = buildBrowser.tryCompiling(options.buildOptions) if not success: raise Exception('Building a browser failed.') else: # Treeherder js shells and browser # Download from Treeherder and call it 'build' # FIXME: Put 'build' somewhere nicer, like ~/fuzzbuilds/. Don't re-download a build that's up to date. # FIXME: randomize branch selection, get appropriate builds, use appropriate known dirs bDir = 'build' bType = downloadBuild.defaultBuildType(options.repoName, None, True) bSrc = downloadBuild.downloadLatestBuild(bType, './', getJsShell=(options.testType == 'js')) bRev = '' # These two lines are only used for treeherder js shells: shell = os.path.join(bDir, "dist", "js.exe" if sps.isWin else "js") manyTimedRunArgs = ["--random-flags", str(JS_SHELL_DEFAULT_TIMEOUT), "mozilla-central", shell] return BuildInfo(bDir, bType, bSrc, bRev, manyTimedRunArgs)
def ensureBuild(options): if options.existingBuildDir: # Pre-downloaded treeherder builds (browser only for now) bDir = options.existingBuildDir bType = 'local-build' bSrc = bDir bRev = '' manyTimedRunArgs = [] elif not options.useTreeherderBuilds: if options.testType == "js": # Compiled js shells options.buildOptions = buildOptions.parseShellOptions( options.buildOptions) options.timeout = options.timeout or machineTimeoutDefaults( options) with LockDir( compileShell.getLockDirPath(options.buildOptions.repoDir)): bRev = hgCmds.getRepoHashAndId(options.buildOptions.repoDir)[0] cshell = compileShell.CompiledShell(options.buildOptions, bRev) compileShell.obtainShell(cshell, updateLatestTxt=True) bDir = cshell.getShellCacheDir() # Strip out first 3 chars or else the dir name in fuzzing jobs becomes: # js-js-dbg-opt-64-dm-linux # This is because options.testType gets prepended along with a dash later. bType = buildOptions.computeShellType(options.buildOptions)[3:] bSrc = ( 'Create another shell in shell-cache like this one:\n' + 'python -u %s -b "%s -R %s" -r %s\n\n' % (os.path.join(path3, 'compileShell.py'), options.buildOptions.buildOptionsStr, options.buildOptions.repoDir, bRev) + '==============================================\n' + '| Fuzzing %s js shell builds\n' % cshell.getRepoName() + '| DATE: %s\n' % sps.dateStr() + '==============================================\n\n') manyTimedRunArgs = mtrArgsCreation(options, cshell) print 'buildDir is: ' + bDir print 'buildSrc is: ' + bSrc else: # Compiled browser options.buildOptions = buildBrowser.parseOptions( options.buildOptions.split()) bDir = options.buildOptions.objDir bType = platform.system() + "-" + os.path.basename( options.buildOptions.mozconfig) bSrc = repr(hgCmds.getRepoHashAndId(options.buildOptions.repoDir)) bRev = '' manyTimedRunArgs = [] success = buildBrowser.tryCompiling(options.buildOptions) if not success: raise Exception('Building a browser failed.') else: # Treeherder js shells and browser # Download from Treeherder and call it 'build' # FIXME: Put 'build' somewhere nicer, like ~/fuzzbuilds/. Don't re-download a build that's up to date. # FIXME: randomize branch selection, get appropriate builds, use appropriate known dirs bDir = 'build' bType = downloadBuild.defaultBuildType(options.repoName, None, True) bSrc = downloadBuild.downloadLatestBuild( bType, './', getJsShell=(options.testType == 'js')) bRev = '' # These two lines are only used for treeherder js shells: shell = os.path.join(bDir, "dist", "js.exe" if sps.isWin else "js") manyTimedRunArgs = [ "--random-flags", str(JS_SHELL_DEFAULT_TIMEOUT), "mozilla-central", shell ] return BuildInfo(bDir, bType, bSrc, bRev, manyTimedRunArgs)