Пример #1
0
    if not os.path.isdir(sempath):
        print(UP.semantics_not_found_err_msg(cpath))
        exit(1)
    
    capp = CApplication(sempath,args.cfile)
    cfile = capp.get_cfile()

    pofilter = lambda(p):True
    if args.predicates:
        pofilter = lambda(p):p.get_predicate_tag() in args.predicates

    openppos = cfile.get_open_ppos()
    violations = cfile.get_violations()
    delegated = cfile.get_delegated()

    print(UP.reportheader('Summary of open, delegated and violated proof obligations for ' + args.cfile))

    if len(openppos) > 0:
        print('Open proof obligations:\n' + ('=' * 80))
        print(RP.tag_file_function_pos_tostring(openppos,pofilter=pofilter))
    else:
        print('No open proof obligations found')

    if len(delegated) > 0:
        print('\n\nDelegated proof obligations:\n' +  ('=' * 80))
        print(RP.tag_file_function_pos_tostring(delegated,pofilter=pofilter))
    else:
        print('No delegated proof obligations found')

    if len(violations) > 0:
        print('\n\nViolations:\n' + ('=' * 80))
Пример #2
0
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# ------------------------------------------------------------------------------

import argparse

import advance.util.printutil as UP

from advance.app.CApplication import CApplication

def parse():
    parser = argparse.ArgumentParser()
    parser.add_argument('path',help='directory that holds ktadvance directory')
    args = parser.parse_args()
    return args

if __name__ == '__main__':

    args = parse()
    capp = CApplication(args.path)
    cfiles = capp.getfilenames()
    total = 0
    print(UP.reportheader('Source files included'))
    for f in sorted(cfiles): 
        linecount = capp.getsrcfile(f).getlinecount()
        total += linecount
        print(UP.ljust(f,24) + ': ' + UP.rjust(linecount,6))
    print('-' * 78)
    print('Total lines of code: ' + str(total))
Пример #3
0
def parse():
    parser = argparse.ArgumentParser()
    parser.add_argument('path',help='directory that holds the analysis results')
    parser.add_argument('cfile',help='relative filename of the c source file')
    args = parser.parse_args()
    return args

if __name__ == '__main__':

    args = parse()
    sempath = os.path.join(args.path,'semantics')
    capp = CApplication(sempath,args.cfile)
    cfile = capp.getcfile()

    print(UP.reportheader('Global definitions and declarations for ' + args.cfile))

    print('-' * 80)
    print('Global type definitions')
    print('-' * 80)
    gtypes = cfile.getgtypes()
    for gt in sorted(gtypes,key=lambda(t):t.gettypeinfo().getname()):
        tinfo = gt.gettypeinfo()
        print(str(tinfo.gettype()) + ': ' + tinfo.getname() +
              ' (' + gt.getlocation().getfile() + ')')

    print('-' * 80)
    print('Global struct definitions')
    print('-' * 80)
    gcomptags = cfile.getgcomptagdefs()
    for gc in sorted(gcomptags,key=lambda(t):t.getcompinfo().getname()):
Пример #4
0
            if d1.startswith('CWE'):
                if not (cwerequested == 'all' or cwerequested == d1): continue
                fd1 = os.path.join(path, d1)
                for d2 in os.listdir(fd1):
                    fd2 = os.path.join(fd1, d2)
                    if os.path.isdir(fd2):
                        if d2.startswith('s0') or d2.startswith('s1'):
                            for d3 in os.listdir(fd2):
                                fd3 = os.path.join(fd2, d3)
                                if os.path.isdir(fd3):
                                    dname = os.path.join(
                                        os.path.join(d1, d2), d3)
                                    result[dname] = getjulietstatus(fd3)
                        else:
                            dname = os.path.join(d1, d2)
                            result[dname] = getjulietstatus(fd2)

    print(
        UP.reportheader('Juliet test sets currently provided (' +
                        str(len(result)) + ')'))
    print('\n  ' + 'directory'.ljust(44) + 'analysis time    score time')
    print('-' * 80)
    for d in sorted(result):
        ktmodtime = UP.chtime(result[d][0])
        scmodtime = UP.chtime(result[d][1])
        if ktmodtime == '0': ktmodtime = 'no results'
        if scmodtime == '0': scmodtime = 'no results'
        print('  ' + d.ljust(44) + ktmodtime.rjust(16) + '  ' +
              scmodtime.rjust(16))
    print(('-' * 80) + '\n')