Closed DanielGuoVT closed 4 years ago
Hello Daniel,
I expected this code to be out of the loop, why should it be in? Here is how I understood the code:
convert AFL files into Klee format keeping track of the biggest file size:
for input_id_map in input_id_map_list:
#--generate klee seed ktest
# print input_id_map
afl_input = input_id_map['input']
if max_input_size < os.path.getsize(afl_input):
max_input_size = os.path.getsize(afl_input)
klee_seed = klee_seed_dir+"/"+str(input_counter).zfill(6)+".ktest"
# print "before calling converter"
self.call_converter("a2k", afl_input, klee_seed, self.bitmodel, self.input_type)
input_counter += 1
if not os.path.exists(klee_seed):
print "no seed" + klee_seed
continue
After this step "klee_seed_dir" contains the N seeds for the next klee run.
run klee with klee_seed_dir only once for a set of seeds
new_sync_dir = self.sync_dir_base+"/klee_instance_conc_"+str(pid).zfill(6)+"/queue"
utils.mkdir_force(new_sync_dir)
#--build klee instance cmd
edge_ids = [x for x in input_id_map['interesting_edges']]
klee_cmd = self.build_cmd(klee_seed_dir, edge_ids, new_sync_dir, max_input_size, afl_input, cov_file)
print ' '.join(klee_cmd)
#--construct process meta data, add to jobs list
kw = {'mock_eof':True, 'mem_cap': self.max_mem, 'use_shell':True}
p = multiprocessing.Process(target=utils.exec_async, args=[klee_cmd], kwargs=kw)
p.daemon = True
if it is correct, the code should not be inside the first loop.
Indent the code block into the scope of the "for" loop (start from line 148).