示例#1
0
    args = parse()
    config = Config()

    if args.path in config.projects:
        pdir = config.projects[args.path]
        cpath = os.path.join(config.testdir, pdir)
    else:
        cpath = os.path.abspath(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):
        success = UF.unpack_tar_file(cpath)
        if not success:
            print(UP.semantics_tar_not_found_err_msg(cpath))
            exit(1)

    capp = CApplication(sempath)
    if args.contractpath is None:
        contractpath = os.path.join(cpath, 'ktacontracts')
    else:
        contractpath = args.contractpath

    ignorefns = {}

    if not args.ignorefile is None:
        if os.path.isfile(args.ignorefile):
            with open(args.ignorefile, 'r') as fp:
示例#2
0
            exit(1)

        testfilename = os.path.join(cpath, testname + '.json')
        if not os.path.isfile(testfilename):
            print('*' * 80)
            print('Test directory does not contain a test specification.')
            print('Expected to find the file')
            print('    ' + testfilename + '.')
            print('*' * 80)
            exit(1)

        #parsemanager = ParseManager(cpath,cpath,verbose=False)
        testmanager = TestManager(cpath, cpath, testname, verbose=args.verbose)
        testmanager.clean()
        try:
            if testmanager.test_parser() or UF.unpack_tar_file(cpath):
                testmanager.test_ppos()
                testmanager.test_ppo_proofs(delaytest=True)
                testmanager.test_spos(delaytest=True)
                testmanager.test_spo_proofs(delaytest=True)
                testmanager.test_spos(delaytest=True)
                testmanager.test_spo_proofs(delaytest=True)
                testmanager.test_ppo_proofs()
                testmanager.test_spos()
                testmanager.test_spo_proofs()
                if testmanager.verbose:
                    testmanager.print_test_results()
                else:
                    testmanager.print_test_results_line_summary()
            else:
                print('\n' + ('*' * 80) +
示例#3
0
    args = parse()
    config = Config()

    if args.path in config.projects:
        pdir = config.projects[args.path]
        cpath = os.path.join(config.testdir, pdir)
    else:
        cpath = os.path.abspath(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)):
        success = UF.unpack_tar_file(cpath, False)
        if not success:
            print(UP.semantics_tar_not_found_err_msg(cpath))
            exit(1)

    def indexfile(cfile):
        if args.verbose: print('- ' + cfile.name)

        def indexfn(cfun):
            if not cfun.name in functionindex:
                functionindex[cfun.name] = []
            cfunrecord = {}
            cfunrecord['f'] = cfile.name
            cfunrecord['s'] = cfun.svar.get_vstorage()
            functionindex[cfun.name].append(cfunrecord)
示例#4
0
    args = parse()
    config = Config()

    if args.path in config.projects:
        pdir = config.projects[args.path]
        cpath = os.path.join(config.testdir, pdir)
    else:
        cpath = os.path.abspath(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):
        success = UF.unpack_tar_file(cpath, args.deletesemantics)
        if not success:
            print(UP.semantics_tar_not_found_err_msg(cpath))
            exit(1)

    if args.contractpath is None:
        contractpath = os.path.join(cpath, 'ktacontracts')
    else:
        contractpath = args.contractpath

    capp = CApplication(sempath, contractpath=contractpath)

    lines = []

    def f(fi):
        if fi.has_file_contracts():
示例#5
0
def parse():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        'path',
        help='directory that holds the semantics directory (or tar.gz file)')
    args = parser.parse_args()
    return args


if __name__ == '__main__':

    args = parse()
    semdir = os.path.join(args.path, 'semantics')
    if not os.path.isdir(semdir):
        success = UF.unpack_tar_file(args.path)
        if not success:
            print('No file or directory found with semantics')
            exit(1)

    capp = CApplication(semdir)
    linker = CLinker(capp)

    linker.link_compinfos()
    linker.link_varinfos()

    def save_xrefs(f):
        capp.indexmanager.save_xrefs(capp.path, f.name, f.index)

    capp.iter_files(save_xrefs)
示例#6
0
        print(UP.cpath_not_found_err_msg(cpath))
        exit(1)

    testfilename = os.path.join(cpath,testname + '.json')
    if not os.path.isfile(testfilename):
        print('*' * 80)
        print('Test directory does not contain a test specification.')
        print('Expected to find the file')
        print('    ' + testfilename + '.')
        print('*' * 80)
        exit(1)

    testmanager = TestManager(cpath,cpath,testname,saveref=args.saveref,verbose=args.verbose)
    testmanager.clean()
    try:
        if testmanager.test_parser(savesemantics=args.savesemantics) or UF.unpack_tar_file(cpath):
            testmanager.test_ppos()
            testmanager.test_ppo_proofs(delaytest=True)
            testmanager.test_spos(delaytest=True)
            testmanager.test_spo_proofs(delaytest=True)
            testmanager.test_spos(delaytest=True)
            testmanager.test_spo_proofs(delaytest=True)
            testmanager.test_ppo_proofs()
            testmanager.test_spos()
            testmanager.test_spo_proofs(delaytest=True)
            testmanager.test_spo_proofs(delaytest=True)
            testmanager.test_spo_proofs()
            if testmanager.verbose:
                testmanager.print_test_results()
            else:
                testmanager.print_test_results_summary()