コード例 #1
0
ファイル: batch_klee.py プロジェクト: tum-i22/macke
                # link_return = os.system('llvm-link-3.4 -o '+dir_name+exec_name+' '+dir_name+'*.bc')
                
                #if not link_return==0:
                #    user_input = raw_input('Linking error')
                #    continue
                

                os.system(klee_command + '--output-dir=' + ud + main_name + '_' + func_name + '/ ' + dir_name+main_name + ' ' + klee_sym_args)
            os.system('mv ' + dir_name + main_name + '.c.bkp ' + dir_name + main_name + '.c')

    uncompiled_files.close()

    tot_cov = 0
    tot_seen = 0
    for c_filename in glob.glob(dir_name + '*.c'):
        cov, seen = source_coverage(c_filename)
        tot_cov += len(cov)
        tot_seen += len(seen)

    coverage = float(tot_cov)/tot_seen
    src_cov_file = open(dir_name + 'src.cov', 'w+')
    src_cov_file.write(str(coverage))
    src_cov_file.close()

    composition_file = open(dir_name+'composition.test', 'w+')
    all_funcs = []
    affected_funcs = []
    unaffected_funcs = []
    for c_filename in glob.glob(dir_name + '*.c'):
        re_pattern = dir_name + '(.*).c'
        re_match = re.search(re_pattern, c_filename)
コード例 #2
0
from source_coverage import source_coverage, get_source_coverage
import glob, os

cov_main = []
seen_main = []

cov_comp = []
seen_comp = []

for c in glob.glob('/mnt/ext-hdd/coreutils-6.10/src/*.c'):
    if os.path.exists(c[:-2]+'_main/'):
        cov_temp, seen_temp = get_source_coverage(c, c[:-2]+'_main/run.istats', [], [])
        cov_main.extend(cov_temp)
        seen_main.extend(seen_temp)

    cov_temp, seen_temp = source_coverage(c)
    cov_comp.extend(cov_temp)
    seen_comp.extend(seen_temp)

print(len(cov_main), len(seen_main))
print(len(cov_comp), len(seen_comp))
コード例 #3
0
from source_coverage import source_coverage, get_source_coverage
import glob, os

cov_main = []
seen_main = []

cov_comp = []
seen_comp = []

for c in glob.glob('/mnt/ext-hdd/coreutils-6.10/src/*.c'):
    if os.path.exists(c[:-2] + '_main/'):
        cov_temp, seen_temp = get_source_coverage(c,
                                                  c[:-2] + '_main/run.istats',
                                                  [], [])
        cov_main.extend(cov_temp)
        seen_main.extend(seen_temp)

    cov_temp, seen_temp = source_coverage(c)
    cov_comp.extend(cov_temp)
    seen_comp.extend(seen_temp)

print(len(cov_main), len(seen_main))
print(len(cov_comp), len(seen_comp))
コード例 #4
0
ファイル: batch_klee.py プロジェクト: yibit/macke
                #if not link_return==0:
                #    user_input = raw_input('Linking error')
                #    continue

                os.system(klee_command + '--output-dir=' + ud + main_name +
                          '_' + func_name + '/ ' + dir_name + main_name + ' ' +
                          klee_sym_args)
            os.system('mv ' + dir_name + main_name + '.c.bkp ' + dir_name +
                      main_name + '.c')

    uncompiled_files.close()

    tot_cov = 0
    tot_seen = 0
    for c_filename in glob.glob(dir_name + '*.c'):
        cov, seen = source_coverage(c_filename)
        tot_cov += len(cov)
        tot_seen += len(seen)

    coverage = float(tot_cov) / tot_seen
    src_cov_file = open(dir_name + 'src.cov', 'w+')
    src_cov_file.write(str(coverage))
    src_cov_file.close()

    composition_file = open(dir_name + 'composition.test', 'w+')
    all_funcs = []
    affected_funcs = []
    unaffected_funcs = []
    for c_filename in glob.glob(dir_name + '*.c'):
        re_pattern = dir_name + '(.*).c'
        re_match = re.search(re_pattern, c_filename)