Пример #1
0
    sempath = os.path.join(cpath, 'semantics')
    contractpath = os.path.join(cpath, 'ktacontracts')

    capp = CApplication(sempath, cfilename, contractpath=contractpath)
    cfile = capp.get_cfile()
    cfile.create_contract(contractpath)

    ktadvpath = capp.path
    xfilename = UF.get_cfile_filename(ktadvpath, cfilename)

    if not os.path.isfile(xfilename):
        print(
            UP.err_msg([
                'No semantics files found for ' + args.cfile,
                '  Expected to find the file ' + xfilename,
                '  Please parse the file first with chc_parse_file.py or ' +
                'check the directory name'
            ]))
        exit(1)

    am = AnalysisManager(capp,
                         onefile=True,
                         wordsize=args.wordsize,
                         thirdpartysummaries=wssummaries)
    am.create_file_primary_proofobligations(cfilename)
    am.reset_tables(cfilename)
    capp.collect_post_assumes()

    am.generate_and_check_file(cfilename, 'vllrisp')
    # am.generate_and_check_file(cfilename,'llv')
    am.reset_tables(cfilename)
Пример #2
0
    sempath = os.path.join(cpath, 'semantics')

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

    excludefiles = ['io.c', 'main_linux.c', 'std_thread.c']

    capp = CApplication(sempath, excludefiles=excludefiles)

    d = UF.get_juliet_reference(args.path)

    if d is None:
        print(
            UP.err_msg([
                'No score key found for juliet test ', '  ' + cpath,
                '  Please create a score key first'
            ]))
        exit(1)

    testset = JulietTestSetRef(d)

    try:
        julietppos = JTS.get_julietppos(testset)

        ppopairs = JTS.get_ppo_pairs(julietppos, capp)
        print(JTS.testppo_results_tostring(ppopairs, capp))
    except IndexedTableError as e:
        print('\n' + ('*' * 80) +
              '\nThe format of the analysis results has changed' +
              '\nPlease re-run the analysis first' + '\n' + ('*' * 80))
        exit(1)
Пример #3
0
def timing(activity):
    t0 = time.time()
    yield
    print('\n' + ('=' * 80) + 
          '\nCompleted ' + activity + ' in ' + str(time.time() - t0) + ' secs' +
          '\n' + ('=' * 80))

if __name__ == '__main__':

    logging.basicConfig(filename='ktadvance.log',level=logging.WARNING)
    
    args = parse()
    cpath = os.path.abspath(args.path)

    if not os.path.isdir(cpath):
        print(UP.err_msg(['Directory ', '   ' + cpath, '   not found']))
        exit(1)

    if not os.path.isfile(os.path.join(cpath,args.cfile)):
        print(UP.err_msg(['C File ' + args.cfile + ' not found in directory ',
                                    '   ' + cpath ]))
        exit(1)

    sempath = os.path.join(cpath,'semantics')
    if (not os.path.isdir(sempath)) or args.deletesemantics:
        success = UF.unpack_tar_file(cpath,args.deletesemantics)
        if not success:
            print(UP.err_msg(['No file or directory found with semantics',
                                  '   Expected to find a directory ' + sempath,
                                  '   or a file semantics_linux.tar.gz in ' + cpath]))
            exit(1)