def runManageWithWait(command_line, silent=False): global verbose global wait_time global wait_loops manageWait = ManageWait(verbose, command_line, wait_time, wait_loops) return manageWait.exec_manage(silent)
def generate_full_status(manageProject): mpName = os.path.splitext(os.path.basename(manageProject))[0] report_name = mpName + "_full_report.html" try: from vector.apps.DataAPI.vcproject_api import VCProjectApi api = VCProjectApi(manageProject) from vector.apps.ReportBuilder.custom_report import CustomReport CustomReport.report_from_api(api, report_type="MANAGE_STATUS_FULL_REPORT", formats=["HTML"], output_file=report_name, environments=api.Environment.all(), levels = [] ) shutil.copy(report_name,report_name + "_tmp") fixup_reports.fixup_2020_reports(report_name + "_tmp") api.close() except: from managewait import ManageWait cmd = "--project " + manageProject + " --full-status=" + report_name manageWait = ManageWait(False, cmd, 30, 1) out_mgt = manageWait.exec_manage(True) shutil.copy(report_name,report_name + "_tmp") return out_mgt
def __init__(self, ManageProject, useCILicense, useCBT, level, environment, verbose, print_exc, timing, buildlog): # setup default values self.print_exc = print_exc self.timing = timing self.verbose = verbose self.FullMP = ManageProject self.mpName = os.path.basename(ManageProject)[:-4] if useCILicense: self.useCI = " --ci " else: self.useCI = "" if useCBT: self.useCBT = " --incremental " else: self.useCBT = "" self.build_log = None self.useLevelEnv = False self.environment = None self.level = None self.compiler = "" self.testsuite = "" self.reportsName = "" self.env_option = "" self.level_option = "" self.build_log_name = buildlog # if a manage level was specified... if level: self.useLevelEnv = True self.level = level # try level being Compiler/TestSuite try: self.compiler, self.testsuite = level.split("/") self.reportsName = "_" + self.compiler + "_" + self.testsuite except: # just use the compiler name self.compiler = level self.reportsName = "_" + self.compiler self.level_option = "--level " + level + " " # if an environment was specified if environment: # afix the proper settings for commands later and report names self.useLevelEnv = True self.environment = environment self.env_option = "--environment " + environment + " " self.reportsName += "_" + self.environment if self.useLevelEnv: self.build_log_name = "build" + self.reportsName + ".log" self.manageWait = ManageWait(self.verbose, "", 30, 1, self.FullMP, self.useCI)
class AzureExecute(object): def __init__(self, ManageProject, useCILicense, useCBT, level, environment, verbose, print_exc, timing, buildlog): # setup default values self.print_exc = print_exc self.timing = timing self.verbose = verbose self.FullMP = ManageProject self.mpName = os.path.basename(ManageProject)[:-4] if useCILicense: self.useCI = " --ci " else: self.useCI = "" if useCBT: self.useCBT = " --incremental " else: self.useCBT = "" self.build_log = None self.useLevelEnv = False self.environment = None self.level = None self.compiler = "" self.testsuite = "" self.reportsName = "" self.env_option = "" self.level_option = "" self.build_log_name = buildlog # if a manage level was specified... if level: self.useLevelEnv = True self.level = level # try level being Compiler/TestSuite try: self.compiler, self.testsuite = level.split("/") self.reportsName = "_" + self.compiler + "_" + self.testsuite except: # just use the compiler name self.compiler = level self.reportsName = "_" + self.compiler self.level_option = "--level " + level + " " # if an environment was specified if environment: # afix the proper settings for commands later and report names self.useLevelEnv = True self.environment = environment self.env_option = "--environment " + environment + " " self.reportsName += "_" + self.environment if self.useLevelEnv: self.build_log_name = "build" + self.reportsName + ".log" self.manageWait = ManageWait(self.verbose, "", 30, 1, self.FullMP, self.useCI) def runMetrics(self): # read in build log for CBT analysis if os.path.exists(self.build_log_name): print("Using build log: " + self.build_log_name) self.build_log = open(self.build_log_name, "r").read() else: print( "Build log not found. Trying to generate complete log from individual build logs" ) self.build_log = "" for file in glob.glob("build*.log"): if self.verbose: print(file) self.build_log += open(file, "r").read() + "\n" cbt = ParseConsoleForCBT(args.verbose) cbtDict = None # don't show skipped tests as Azure shows them as "Other" instead of skipped # if self.build_log: # cbtDict = cbt.parse(self.build_log) # else: # print("Could not find any build logs...skipping CBT Analysis") generate_results.verbose = self.verbose generate_results.print_exc = self.print_exc generate_results.timing = self.timing generate_results.buildReports(self.FullMP, self.level, self.environment, True, self.timing, cbtDict) for file in glob.glob("xml_data/coverage_results_*.*"): try: os.remove(file) except: print( "Error removing file after failed to remove directory: " + file) cobertura.azure = True cobertura.generateCoverageResults(self.FullMP) def runReports(self): self.manageWait.exec_manage_command( "--create-report=aggregate --output=" + self.mpName + "_aggregate_report.html") self.manageWait.exec_manage_command( "--create-report=metrics --output=" + self.mpName + "_metrics_report.html") self.manageWait.exec_manage_command( "--create-report=environment --output=" + self.mpName + "_environment_report.html") def runExec(self): self.manageWait.exec_manage_command("--status") self.manageWait.exec_manage_command("--force --release-locks") self.manageWait.exec_manage_command( "--config VCAST_CUSTOM_REPORT_FORMAT=HTML") if self.useLevelEnv: output = "--output " + self.mpName + self.reportsName + "_rebuild.html" else: output = "" self.build_log = self.manageWait.exec_manage_command( "--build-execute " + self.useCBT + self.level_option + self.env_option + output) open(self.build_log_name, "w").write(self.build_log)