def test_dep_graph(): #pytest.set_trace() args = ["ignore_arg0", "--action=build,test", "--config=debug"] o = bs.Options(args) g = bs.DependencyGraph("all-test", o) ready_builds = g.ready_builds() assert (ready_builds) built = [] loop_count = 0 while ready_builds: loop_count += 1 for bi in g.ready_builds(): assert str(bi) not in built built.append(str(bi)) g.build_complete(bi) ready_builds = g.ready_builds() assert (loop_count > 2)
datetime.datetime.now().isoformat()) os.rename(bisect_dir, mvdir) cmd = ["rsync", "-rlptD", "/".join(dirnames[:-1]) + "/", bisect_dir] bs.run_batch_command(cmd) bs.rmtree(bisect_dir + "/test") bs.rmtree(bisect_dir + "/piglit-test") bs.rmtree(bisect_dir + "/deqp-test") bs.rmtree(bisect_dir + "/cts-test") bs.rmtree(bisect_dir + "/crucible-test") j = bs.Jenkins(_revspec, bisect_dir) o = bs.Options(["bisect_all.py"]) o.result_path = bisect_dir o.retest_path = args.result_path depGraph = bs.DependencyGraph(["piglit-gpu-all"], o) print "Retesting mesa to: " + bisect_dir try: j.build_all(depGraph, print_summary=False) except bs.BuildFailure: print "ERROR: some builds failed" # make sure there is enough time for the test files to sync to nfs time.sleep(20) reproduced_failures = bs.TestLister(bisect_dir + "/test/") print "Found failures:" reproduced_failures.Print() for a_fail in reproduced_failures.Tests():
def main(): # reuse the options from the gasket o = bs.Options([sys.argv[0]]) description = "builds a component on jenkins" parser = argparse.ArgumentParser(description=description, parents=[o._parser], conflict_handler="resolve") parser.add_argument('--branch', type=str, default="mesa_master", help="Branch specification to build. "\ "See build_specification.xml/branches") parser.add_argument('--revision', type=str, default="", help="specific set of revisions to build.") parser.add_argument('--test', type=str, default=None, help="Name of test to execute. Arch/hardware suffix "\ "will override those options") args = parser.parse_args() branch = args.branch revision = args.revision test = args.test # some build_local params are not handled by the Options, which is # used by other modules. This code strips out incompatible args o = bs.Options(["bogus"]) vdict = vars(args) del vdict["branch"] del vdict["revision"] del vdict["test"] # override hardware/arch with suffix if available if not test: print "ERROR: --test argument required" sys.exit(-1) test_suffix = test.split(".")[-1] if test_suffix[-3:] in ["m32", "m64"]: vdict["arch"] = test_suffix[-3:] vdict["hardware"] = test_suffix[:-3] else: if vdict["hardware"] == "builder": # can't run tests on a builder vdict["hardware"] = "bdwgt2" # set the suffix in the way that piglit-test expects, eg "ilkm32" test = test + "." + vdict["hardware"] + vdict["arch"] o.__dict__.update(vdict) sys.argv = ["bogus"] + o.to_list() # check out the branch, refined by any manually-specfied revisions bspec = bs.BuildSpecification() bspec.checkout(branch) if (revision): revspec = bs.RevisionSpecification.from_cmd_line_param( revision.split()) revspec.checkout() revspec = bs.RevisionSpecification() print "Building revision: " + revspec.to_cmd_line_param() # create a result_path that is unique for this set of builds spec_xml = bs.ProjectMap().build_spec() results_dir = spec_xml.find("build_master").attrib["results_dir"] result_path = "/".join([ results_dir, branch, revspec.to_cmd_line_param().replace(" ", "_"), "single_test" ]) o.result_path = result_path # allow re-execution of tests (if different test was specified) bs.rmtree(result_path + "/test") depGraph = bs.DependencyGraph("piglit-test", o) bi = bs.ProjectInvoke(project="piglit-test", options=o) # remove the test build, because we want to build it directly depGraph.build_complete(bi) bi.set_info("status", "single-test-rebuild") jen = bs.Jenkins(result_path=result_path, revspec=revspec) jen.build_all(depGraph) jen.build(bi, extra_arg="--piglit_test=" + test) jen.wait_for_build() time.sleep(10) pm = bs.ProjectMap() out_test_dir = pm.output_dir() if os.path.exists(out_test_dir): bs.rmtree(out_test_dir) os.makedirs(out_test_dir) collate_tests(result_path, out_test_dir)
def main(): parser = argparse.ArgumentParser(description='Build projects locally.') # TODO: provide a pull action to update the repos parser.add_argument('--action', type=str, default=["build"], choices=CsvChoice('fetch', 'build', 'clean', 'test'), action=CsvAction, help="Action to recurse with. 'build', 'clean' "\ "or 'test'. (default: %(default)s)") parser.add_argument('--project', dest='project', type=str, default="mesa", help='project to build. (default: %(default)s)') parser.add_argument('--arch', dest='arch', type=str, default='m64', choices=['m64', 'm32'], help='arch to build. (default: %(default)s)') parser.add_argument('--config', type=str, default="release", choices=['release', 'debug'], help="Release or Debug build. (default: %(default)s)") parser.add_argument('--type', type=str, default="developer", choices=['developer', 'percheckin', 'daily', 'release'], help="category of tests to run. "\ "(default: %(default)s)") parser.add_argument('--branch', type=str, default="none", help="Branch specification to build. "\ "See build_specification.xml/branches") parser.add_argument( '--env', type=str, default="", help="If specified, overrides environment variable settings" "EG: 'LIBGL_DEBUG=1 INTEL_DEBUG=perf'") parser.add_argument('--hardware', type=str, default='builder', help="The hardware to be targeted for test " "('builder', 'snbgt1', 'ivb', 'hsw', 'bdw'). " "(default: %(default)s)") args = parser.parse_args() project = args.project if "fetch" in args.action: # fetch not supported by build.py scripts, which will parse argv bs.RepoSet().fetch() branch = args.branch if (branch != "none"): bs.BuildSpecification().checkout(branch) # some build_local params are not handled by the Options, which is # used by other modules o = bs.Options(["bogus"]) vdict = vars(args) del vdict["project"] del vdict["branch"] if "fetch" in vdict["action"]: vdict["action"].remove("fetch") o.__dict__.update(vdict) sys.argv = ["bogus"] + o.to_list() if "clean" in args.action: bs.rmtree(bs.ProjectMap().build_root()) graph = bs.DependencyGraph(project, o) ready = graph.ready_builds() pm = bs.ProjectMap() while ready: for bi in ready: graph.build_complete(bi) proj_build_dir = pm.project_build_dir(bi.project) script = proj_build_dir + "/build.py" if os.path.exists(script): bs.run_batch_command([sys.executable, script] + o.to_list()) ready = graph.ready_builds()
def main(): # reuse the options from the gasket o = bs.Options([sys.argv[0]]) description = "builds a component on jenkins" parser = argparse.ArgumentParser(description=description, parents=[o._parser], conflict_handler="resolve") parser.add_argument('--project', dest='project', type=str, default="", help='Project to build. Default project is specified '\ 'for the branch in build_specification.xml') parser.add_argument('--branch', type=str, default="mesa_master", help="Branch specification to build. "\ "See build_specification.xml/branches") parser.add_argument('--revision', type=str, default="", help="specific set of revisions to build.") parser.add_argument('--rebuild', type=str, default="false", choices=['true', 'false'], help="specific set of revisions to build." "(default: %(default)s)") parser.add_argument("--tar", help="generate tar for email notification", action="store_true") parser.add_argument('--results_subdir', type=str, default="", help="Subdirectory under results_dir to place results." " Use this to prevent conflicts when running" "multiple concurrent tests on the same branch.") args = parser.parse_args() projects = [] if args.project: projects = args.project.split(",") branch = args.branch revision = args.revision rebuild = args.rebuild results_subdir = args.results_subdir or branch # some build_local params are not handled by the Options, which is # used by other modules. This code strips out incompatible args o = bs.Options(["bogus"]) vdict = vars(args) del vdict["project"] del vdict["branch"] del vdict["revision"] del vdict["rebuild"] o.__dict__.update(vdict) sys.argv = ["bogus"] + o.to_list() bspec = bs.BuildSpecification() pm = bs.ProjectMap() bs.rmtree(pm.source_root() + "/test_summary.txt") bs.rmtree(pm.source_root() + "results/test/results.tgz") # start with the specified branch, then layer any revision spec on # top of it bspec.checkout(branch) revspec = None if (revision): revspec = bs.RevisionSpecification.from_cmd_line_param( revision.split()) revspec.checkout() revspec = bs.RevisionSpecification() print "Building revision: " + revspec.to_cmd_line_param() hashstr = revspec.to_cmd_line_param().replace(" ", "_") # create a result_path that is unique for this set of builds spec_xml = pm.build_spec() results_dir = spec_xml.find("build_master").attrib["results_dir"] result_path = "/".join([results_dir, results_subdir, hashstr, o.type]) o.result_path = result_path if rebuild == "true" and os.path.exists(result_path): print "Removing existing results." mvdir = os.path.normpath(result_path + "/../" + datetime.datetime.now().isoformat()) os.rename(result_path, mvdir) if not projects: branchspec = bspec.branch_specification(branch) projects = [branchspec.project] # use a global, so signal handler can abort builds when scheduler # is interrupted global jen jen = bs.Jenkins(result_path=result_path, revspec=revspec) depGraph = bs.DependencyGraph(projects, o) out_test_dir = pm.output_dir() if os.path.exists(out_test_dir): bs.rmtree(out_test_dir) os.makedirs(out_test_dir) # to collate all logs in the scheduler out_log_dir = pm.output_dir() if os.path.exists(out_log_dir): bs.rmtree(out_log_dir) os.makedirs(out_log_dir) # Add a revisions.xml file if not os.path.exists(result_path): os.makedirs(result_path) revspec.to_elementtree().write(os.path.join(result_path, 'revisions.xml')) # use a global, so signal handler can abort builds when scheduler # is interrupted try: jen.build_all(depGraph, branch=branch) finally: collate_tests(result_path, out_test_dir, make_tar=args.tar)
def main(): # reuse the options from the gasket o = bs.Options([sys.argv[0]]) description="builds a component on jenkins" parser= argparse.ArgumentParser(description=description, parents=[o._parser], conflict_handler="resolve") parser.add_argument('--project', dest='project', type=str, default="", help='Project to build. Default project is specified '\ 'for the branch in build_specification.xml') parser.add_argument('--revision', type=str, default="", help="mesa revision to test.") args = parser.parse_args() projects = [] if args.project: projects = args.project.split(",") revision = args.revision bspec = bs.BuildSpecification() bspec.checkout("mesa_perf") mesa_repo = git.Repo(bs.ProjectMap().project_source_dir("mesa")) if ":" in revision: (start_rev, end_rev) = revision.split(":") if not end_rev: # user selected the last point in a plot. Build current master revision = "mesa=" + mesa_repo.git.rev_parse("HEAD", short=True) elif not start_rev: print "ERROR: user-generated perf builds cannot add older data points to the plot" sys.exit(-1) else: commits = [] start_commit = mesa_repo.commit(start_rev) found = False for commit in mesa_repo.iter_commits(end_rev, max_count=8000): if commit == start_commit: found = True break commits.append(commit.hexsha) if not found: print "ERROR: " + start_rev + " not found in history of " + end_rev sys.exit(-1) revision = "mesa=" + commits[len(commits)/2] # some build_local params are not handled by the Options, which is # used by other modules. This code strips out incompatible args o = bs.Options(["bogus"]) vdict = vars(args) del vdict["project"] del vdict["revision"] o.__dict__.update(vdict) sys.argv = ["bogus"] + o.to_list() pm = bs.ProjectMap() bs.rmtree(pm.source_root() + "/test_summary.txt") # checkout the desired revision on top of recent revisions if not revision: # randomly select a commit post 11.2 branch_commit = mesa_repo.tags["17.0-branchpoint"].commit.hexsha commits = [] for commit in mesa_repo.iter_commits('origin/master', max_count=8000): if commit.hexsha == branch_commit: break commits.append(commit.hexsha) revision = "mesa=" + str(commits[int(random.random() * len(commits))]) revspec = bs.RevisionSpecification(from_cmd_line=revision.split()) revspec.checkout() revspec = bs.RevisionSpecification() hashstr = "mesa=" + revspec.revision("mesa") print "Building revision: " + hashstr # create a result_path that is unique for this set of builds spec_xml = pm.build_spec() results_dir = spec_xml.find("build_master").attrib["results_dir"] result_path = "/".join([results_dir, "perf", hashstr]) o.result_path = result_path if not projects: projects = ["perf-all"] # use a global, so signal handler can abort builds when scheduler # is interrupted global jen jen = bs.Jenkins(result_path=result_path, revspec=revspec) depGraph = bs.DependencyGraph(projects, o) for i in depGraph.all_builds(): if i.project != "mesa-perf": i.set_info("status", "rebuild") # use a global, so signal handler can abort builds when scheduler # is interrupted try: jen.build_all(depGraph, branch="mesa_master") except Exception as e: print "ERROR: encountered failure: " + str(e) raise