コード例 #1
0
def get_ppo_project_variant_totals(variant, cwe):
    variantfile = 'x' + variant
    ppoprojecttotals = {}  # project -> dm -> dmtotal
    spoprojecttotals = {}
    nosummary = []

    for p in get_juliet_projects(cwe):
        path = os.path.join(UF.get_juliet_path(), p)
        results = UF.read_project_summary_results(path)
        if results is None:
            nosummary.append(p)
            continue
        pd = results

        if variantfile in pd['fileresults']['ppos']:
            ppod = pd['fileresults']['ppos'][variantfile]
            if variantfile in pd['fileresults']['spos']:
                spod = pd['fileresults']['spos'][variantfile]
            else:
                spod = {}
            if not 'violated' in ppod:
                ppod['violated'] = 0
            if not 'violated' in spod:
                spod['violated'] = 0
            ppoprojecttotals[p] = ppod
            spoprojecttotals[p] = spod

        else:
            vfiles = get_variant_files(variant)
            if len(vfiles) > 0 and vfiles[0] in pd['fileresults']['ppos']:
                ppoprojecttotals[p] = {}
                spoprojecttotals[p] = {}
                for f in vfiles:
                    if f in pd['fileresults']['ppos']:
                        ppod = pd['fileresults']['ppos'][f]
                        if not 'violated' in ppod:
                            ppod['violated'] = 0
                        for dm in ppod:
                            if not dm in ppoprojecttotals[p]:
                                ppoprojecttotals[p][dm] = 0
                            ppoprojecttotals[p][dm] += ppod[dm]
                    if f in pd['fileresults']['spos']:
                        spod = pd['fileresults']['spos'][f]
                        if not 'violated' in spod:
                            spod['violated'] = 0
                        for dm in spod:
                            if not dm in spoprojecttotals[p]:
                                spoprojecttotals[p][dm] = 0
                            spoprojecttotals[p][dm] += spod[dm]
    return (ppoprojecttotals, spoprojecttotals, nosummary)
コード例 #2
0
    ppodmtotals = {}  # dm -> totals list (per test)
    spodmtotals = {}  # dm -> totals list (per test)
    plotlegend = []
    for dm in dsmethods:
        ppodmtotals[dm] = []
    for dm in dsmethods:
        spodmtotals[dm] = []
    width = 0.67
    N = 0
    ptotals = []  # totals list   (per test)
    stotals = []  # totals list   (per test)

    for p in get_juliet_projects(cwe):
        path = os.path.join(UF.get_juliet_path(), p)
        results = UF.read_project_summary_results(path)
        if results is None:
            continue
        pd = results
        ppod = pd['tagresults']['ppos']  # ppotype -> dm -> count
        spod = pd['tagresults']['spos']  # ppotype -> dm -> count

        for t in ppod:
            if not 'violated' in ppod[t]: ppod[t]['violated'] = 0
        for t in spod:
            if not 'violated' in spod[t]: spod[t]['violated'] = 0

        for t in ppod:
            if not 'contract' in ppod[t]: ppod[t]['contract'] = 0
        for t in spod:
            if not 'contract' in spod[t]: spod[t]['contract'] = 0
コード例 #3
0
        exit(0)

    cpath = UF.get_project_path(args.path)

    if not os.path.isdir(cpath):
        print(UP.cpath_not_found_err_msg(cpath))
        exit(1)

    sempath = os.path.join(cpath, 'semantics')

    if not os.path.isdir(sempath):
        print(UP.semantics_not_found_err_msg(cpath))
        exit(1)

    with timing('summarize'):
        summaries = UF.read_project_summary_results(cpath)
        try:
            if summaries == None:
                capp = CApplication(sempath)
                timestamp = os.stat(capp.path).st_ctime
                result = RP.project_proofobligation_stats_to_dict(capp)
                result['timestamp'] = timestamp
                result['project'] = cpath
                UF.save_project_summary_results(cpath, result)
                UF.save_project_summary_results_as_xml(cpath, result)
                summaries = UF.read_project_summary_results(cpath)
            print(RP.project_proofobligation_stats_dict_to_string(summaries))
        except IndexedTableError as e:
            print('\n' + ('*' * 80) +
                  '\nThe analysis results format has changed' +
                  '\nYou may have to re-run the analysis first: ' + '\n' +