def load(self): self.total_hits = 0 self.active_hits = 0 lvlset = self.args["lvlset"] _, lvls = loadBoogieLvlSet(lvlset) if self.lvls is None: self.lvls = lvls.keys() try: self.exp = Experiment(self.name) except IOError: print "Error loading experiment %s" % self.name # Ignore missing experiments return self.total_hits = len(self.exp.server_runs) self.active_hits = sum(sr.hit_id in hits and isHitActive(hits[sr.hit_id]) for sr in self.exp.server_runs)
s = sessionF() if args.bpl: if args.auto or args.read or args.write: print "--auto, --modes, --read, --write are not supported with --bpl" exit(1) try: lvl = loadBoogieFile(args.bpl, False) except Exception as e: print "Couldn't load boogie file--is it desugared?" raise e elif args.lvlset: if args.auto and not args.read: print "--read must be specified with --auto" exit(1) lvlset, lvls = loadBoogieLvlSet(args.lvlset) else: print "Either --bpl or --lvlset must be specified" exit(1) additionalInvs = {} if args.additionalInvs: with open(args.additionalInvs) as f: r = csv.reader(f, delimiter=",") for row in r: if not row: continue invs = [] for invstr in invlist.split(";"): if not len(invstr.strip()): continue
p = argparse.ArgumentParser(description="improved trace dumper") p.add_argument("--lvlset", type=str, default="unsolved", help="lvlset to use for benchmarks") p.add_argument("--lvl", type=str, default="s-diamond_true-unreach-call1", help="lvl to use for generating traces") p.add_argument("--write", action="store_true") args = p.parse_args() # Process arguments lvlset_path = "lvlsets/%s.lvlset" % args.lvlset curLevelSetName, lvls = levels.loadBoogieLvlSet(lvlset_path) lvl = lvls[args.lvl] trace_dir = None if args.write: trace_dir = lvl["path"][0][:-4] + ".new_fuzz_traces" print "Making trace directory:", trace_dir try: os.mkdir(trace_dir) except OSError: pass print print "=== LEVEL ===" print lvl
help='If set print user stats'); p.add_argument('--lvlset', type=str, help='Path to levelset used in experiment', required=True); p.add_argument('--timeout', type=int, default=10, help='Timeout in seconds for z3 queries.') p.add_argument('--additionalInvs', type=str, help='Path to a .csv file with additional invariants.') def isSrcUser(srcId): return srcId != 'verifier' if __name__ == "__main__": args = p.parse_args(); s = open_sqlite_db("../logs/" + args.ename + "/events.db")() lvlsetName, lvls = loadBoogieLvlSet(args.lvlset) otherInvs = { } if (args.additionalInvs): with open(args.additionalInvs) as f: r = csv.reader(f, delimiter=","); for row in r: (lvl, invs) = row bInvs = [] for inv in [x for x in invs.split(";") if len(x.strip()) != 0]: try: bInv = parseExprAst(inv) if (tautology(expr_to_z3(bInv, AllIntTypeEnv()))): continue bInvs.append(bInv) except RuntimeError:
import lib.boogie.ast import levels import tabulate from levels import getEnsamble from random import randint from json import dumps from os import mkdir p = argparse.ArgumentParser(description="trace dumper") p.add_argument("--lvlset", type=str, default="single-loop-conditionals", help="lvlset to use for benchmarks") args = p.parse_args() curLevelSetName, lvls = levels.loadBoogieLvlSet(args.lvlset) for lvl_name in lvls: print "Trying random values for ", lvl_name lvl = lvls[lvl_name] traces = getEnsamble(lvl["loop"], lvl["program"], 1000, 5,\ lambda: randint(-100, 100)) if (len(traces) == 0): print "Found ", len(traces), " traces." continue print "Found ", len(traces), " traces with ", sum(map(len, traces)), \ " total rows ", " and ", sum(map(len, traces))*1.0/len(traces), \ " average length." dirN = lvl["path"][0][:-4] + ".fuzz_traces"
help="lvlset to use for benchmarks") p.add_argument("--lvl", type=str, default="18", help="lvl to use for generating traces") p.add_argument("--nunrolls", type=int, default=20, help="number of times to unroll loops") args = p.parse_args() # Process arguments LVLSET_PATH = "lvlsets/%s.lvlset" % args.lvlset curLevelSetName, lvls = levels.loadBoogieLvlSet(LVLSET_PATH) lvl = lvls[args.lvl] print print "=== LEVEL ===" print lvl trace = levels.getInitialData(lvl["loop"], lvl["program"], args.nunrolls, [boogie.ast.parseExprAst(inv)[0] for inv in []]) # Invariant placeholder print print "=== RAW TRACE ===" print trace vars_ = lvl["variables"] vars_.sort()