def main(): global ntests,start while time.time()-start < timeout: for ts in xrange(0,width): sut.restart() ntests += 1 if (Stest != None ) and (r.random() > 0.6): sut.backtrack(Stest) randomAction() for b in sut.currBranches(): if b not in covCount: covCount[b] = 0 covCount[b] += 1 sortedCov = sorted(covCount.keys(), key = lambda x: covCount[x]) LCov = sortedCov[0] if time.time()-start > timeout: print "THE TEST IS STOPPED SINCE TIMEOUT" break sortedCov = sorted(covCount.keys(), key = lambda x: covCount[x]) if coverage: print"Show Coverage" sut.internalReport() print ntests,"TOTAL TESTS" print "TOTAL BUGS",bugs print "TOTAL ACTIONS",actCount print "TOTAL RUNTIME",time.time()-start
def action(): global actCount, bugs, failPool act = sut.randomEnabled(rgen) actCount += 1 ok = sut.safely(act) if running == 1: if len(sut.newBranches()) > 0: print "ACTION:", act[0] for b in sut.newBranches(): print time.time() - start, len(sut.allBranches()), "New branch", b for s in sut.newStatements(): print time.time() - start, len(sut.allStatements()),"New statement",s if not ok: if faults: bugs += 1 print "FOUND A FAILURE" print sut.failure() print "REDUCING" failPool.append(sut.test()) collectCoverage() R = sut.reduce(sut.test(),sut.fails, True, True) sut.prettyPrintTest(R) print sut.failure() fname="failure" + str(bugs) + ".test" sut.saveTest(sut.test(),fname) errorSeqs.append(sut.currStatements()) sut.restart() else: expand() return ok
def randomAction(): global actCount,bugs,j,running,actCount,r test = False for b in xrange(0,depth): act = sut.randomEnabled(r) # actCount += 1 ok = sut.safely(act) Scheck = sut.check() if len(sut.newBranches()) > 0: Stest = sut.state() test = True if (not test) and (LCov != None) and (LCov in sut.currBranches()): Stest = sut.start() test = True actCount += 1 if running == 1: if sut.newBranches() != set([]): print "ACTIONS:", act[0] for b in sut.newBranches(): print time.time()-start,len(sut.allBranches()),"New branch",b if faults == 1: if not ok: print "FOUND A FAILURE" j += 1 bugs += 1 fault = sut.failure() failurename = 'failure' + str(bugs) + '.test' sut.saveTest(sut.test(), failurename) print"the bugs is ",j sut.restart()
def phase1(timeLimit): global ntest BUDGET = timeLimit DEPTH = opts.depth print "-------------------------------------------" print "PHASE 1: Starting\t(BUDGET:",BUDGET,"seconds,","DEPTH:",DEPTH,"tests)" phase_start = time.time() phase_test = ntest pool = Pool("randomPool") elapsed = time.time()-phase_start while elapsed < BUDGET and (time.time() - start) < opts.timeout: sut.restart() ntest += 1 if opts.progress and ntest % 300: update_progress(elapsed/BUDGET) for s in xrange(0,DEPTH): if not randomAction(pool): break collectCoverage() # collecting coverage at the end of each test elapsed = time.time()-phase_start if opts.progress: update_progress(1.0) interval = time.time()-phase_start print "PHASE 1: Ending\t\t(EXECUTED:",(ntest - phase_test),"tests, USED:",round(interval,5),"seconds)" print "-------------------------------------------" return pool
def randomAction(): global actCount, bugs, coverageCount, belowMean,lastAddCoverage act = sut.randomEnabled(random.Random()) actCount += 1 ok = sut.safely(act) if running: if len(sut.newBranches()) > 0: print "ACTION:",sut.randomEnabled(random.Random(seed))[0] for b in sut.newBranches(): print time.time() - start, len(sut.allBranches()),"New branch",b for s1 in sut.newStatements(): print time.time() - start, len(sut.allStatements()),"New statement",b if not ok or not sut.check(): bugs += 1 print "FOUND A FAILURE" if faults: print("SHOW FAULT") print sut.failure() error.append(sut.test()) R = sut.reduce(sut.test(),sut.fails, True, True) sut.prettyPrintTest(R) print sut.failure() sut.restart() return ok
def randomAction(): global actCount, bugs, failPool, faults, start, failureFiles act = sut.randomEnabled(rgen) actCount += 1 ok = sut.safely(act) elapsed = time.time() - start if running: if len(sut.newBranches()) > 0: print "ACTION:", act[0] for branch in sut.newBranches(): print elapsed, len(sut.allBranches()), "New branch", branch if not ok: bugs += 1 print "FOUND A FAILURE, REDUCING..." failPool.append(sut.test()) collectCoverage() R = sut.reduce(sut.test(),sut.fails, True, True) if faults: print "SAVING INTO FILE NAMED failurefile"+str(bugs) failureFile = "failure" + str(bugs) + ".test" sut.saveTest(sut.test(), failureFile) failureFiles.append(failureFile) sut.restart() else: expandPool() return ok
def action(): global actCount, bugs, failPool act = sut.randomEnabled(rgen) actCount += 1 ok = sut.safely(act) if running == 1: if len(sut.newBranches()) > 0: print "ACTION:", act[0] for b in sut.newBranches(): print time.time() - start, len(sut.allBranches()), "New branch", b if faults: if not ok: bugs += 1 print "FOUND A FAILURE" print sut.failure() print "REDUCING" failPool.append(sut.test()) collectCoverage() R = sut.reduce(sut.test(),sut.fails, True, True) sut.prettyPrintTest(R) print sut.failure() f = open(("failure" + str(bugs) + ".test"),"w") f.writelines(str(sut.failure())) f.close() sut.restart() else: expand() return ok
def main(): global flag,timeout,sut,test,para,currStatements,coverageNum,sortedCov,weight,weightedCov,coverageWeightedBelowMean,bugs,actNum,start while time.time()-start < timeout: sut.restart() if (test != None): if (rgen.random() > 0.4): sut.backtrack(test) para = False print "Testing" for s in xrange(0,100): tester() if flag == 1: break for s in sut.currStatements(): if s not in coverageNum: coverageNum[s] = 0 coverageNum[s] += 1 sortedCov = sorted(coverageNum.keys(), key=lambda x: coverageNum[x]) print "Coverage" for c in sortedCov: weight = (100 - coverageNum[c]) weightedCov = c * weight if weightedCov > 25: coverageWeightedBelowMean.append(weightedCov) print c sut.internalReport() for s in sortedCov: print s, coverageNum[s] print bugs,"BUGS" print "TOTAL ACTIONS",actNum print "TOTAL RUNTIME",time.time()-start
def main(): global ntests while time.time()-start < timeout: for ts in xrange(0,width): sut.restart() ntests += 1 loopBug() for s in sut.currBranches(): if s not in covCount: covCount[s] = 0 covCount[s] += 1 sortedCov = sorted(covCount.keys(), key=lambda x: covCount[x]) LCov= sortedCov[0] if (time.time() - start > timeout): print "THE TEST IS STOPPED SINCE TIMEOUT" break sortedCov = sorted(covCount.keys(), key=lambda x: covCount[x]) if coverage == 1: print "SHOW COVERAGE" sut.internalReport() print ntests, "TOTAL TESTS" print "TOTAL BUGS",bugs print "TOTAL ACTIONS",actCount print "TOTAL RUNNINGTIME",time.time()-start
def randomAction(): global actCount, bugs,newseq,currseq act = sut.randomEnabled(R) actCount += 1 ok = sut.safely(act) if running: if len(sut.newBranches()) > 0: print "ACTION:",sut.randomEnabled(random.Random(seed))[0] for b in sut.newBranches(): print time.time() - start, len(sut.allBranches()),"New branch",b for s1 in sut.newStatements(): print time.time() - start, len(sut.allStatements()),"New statement",s1 if not ok: bugs += 1 print "FOUND A FAILURE" if faults: f = sut.reduce(sut.test(), sut.fails, True, True) sut.prettyPrintTest(f) currseq.append((f,set(sut.currStatements()))) print("SHOW FAULT") file = 'failure' + str(actCount) + '.test' sut.saveTest(sut.test(), file) sut.restart() print sut.failure() return ok
def main(): global flag,timeout,sut,test,para,currStatements,coverageNum,sortedCov,weight,weightedCov,coverageWBM,bugs,actNum,start while time.time()-start < timeout: sut.restart() if (test != None): if (rgen.random() > exp): sut.backtrack(test) para = False for s in xrange(0,lenth): tester() if flag == 1: break for s in sut.currStatements(): if s not in coverageNum: coverageNum[s] = 0 coverageNum[s] += 1 sortedCov = sorted(coverageNum.keys(), key=lambda x: coverageNum[x]) for c in sortedCov: weightedCov = c * (lenth - coverageNum[c]) if weightedCov > 20: coverageWBM.append(weightedCov) print c sut.internalReport() for s in sortedCov: print s, coverageNum[s] print bugs,"Failures have been found" print "TOTAL ACTIONS",actNum print "TOTAL RUNTIME",time.time()-start
def main(): global start,sut,R,noerror,error,actCount, bugs,ntest,newseq,currseq,states actCount = 0 bugs = 0 start = time.time() noerror = [] error = [] newseq = [] ntest=0 currseq=[] sut = sut.sut() R = random.Random(seed) states = [sut.state()] print "STARTING PHASE 1" while(time.time() < start + timeout): for st in states: ntest+=1 if (time.time() > start + timeout): break sut.restart() sut.backtrack(st) for s in xrange(0, depth): if (time.time() > start + timeout): break ok = randomAction() if not ok: break checkAlg() if coverage: sut.internalReport() print "TOTAL BUGS", bugs print "TOTAL ACTIONS",actCount print "TOTAL RUNTIME",time.time()-start
def phase2(randomPool, selectPool): global ntest DEPTH = opts.depth print "PHASE 2: Starting\t(FILTER SET:", len(selectStatements),"DEPTH:",DEPTH,"tests)" phase_start = time.time() phase_test = ntest mean = calculateMean(selectStatements) initialMean = mean while mean < threshold and (time.time() - start) < opts.timeout: sut.restart() test = selectPool.getRandom() #sut.replay(test[0]) sut.backtrack(test[1]) ntest += 1 if opts.progress and ntest % 10: update_progress((mean - initialMean)/threshold) for s in xrange(0,DEPTH): if not randomAction(selectPool): break mean = calculateMean(selectStatements) collectCoverage() # collecting coverage at the end of each test if opts.progress: update_progress(1.0) interval = time.time()-phase_start print "PHASE 2: Ending\t\t(EXECUTED:",(ntest - phase_test),"tests, USED:",round(interval,5),"seconds)" print "-------------------------------------------"
def randomAction(): global actCount, bugs, fails, errCount, newCount sawNew = False act = sut.randomEnabled(seeds) actCount += 1 ok = sut.safely(act) propok = sut.check() if running: if sut.newBranches() != set([]): for b in sut.newBranches(): print time.time()-start,len(sut.allBranches()),"New branch",b sawNew = True newCount += 1 else: sawNew = False if not ok or not propok: if faults: bugs += 1 fail.append(sut.test()) saveCover() sut.restart() print "FAILURE FOUND.....FAILURES ARE STORING IN FILES" errCount += 1 fault = sut.failure() fname = 'failure' + str(bugs) + '.test' sut.saveTest(sut.test(), fname) sut.restart() else: expandPool() return ok
def main(): global config, R, sut, bugs, actCount, branchCount, statementCount, ntest, start parsed_args, parser = parse_args() config = make_config(parsed_args, parser) print('Testing using config={}'.format(config)) R = random.Random(config.seed) sut = sut.sut() sut.silenceCoverage() bugs = 0 actCount = 0 coverageCount = {} branchCount = {} statementCount = {} ntest = 0 start = time.time() elapsed = time.time() - start print "Starting Test" while elapsed < config.timeout: sut.restart() ntest += 1 for i in xrange(0, config.depth): if not randomAct(): break elapsed = time.time() - start if config.running: showRunning() elapsed = time.time() - start if elapsed > config.timeout: print "Stopping test [TIMEOUT]" break collectCoverage() elapsed = time.time() - start print "Finishing Test" if time.time() - start > config.timeout: print "[TIMEOUT]" printCoverage() if config.coverage: sut.internalReport() print "Covered", len(sut.allBranches()), "branches" print "Covered", len(sut.allStatements()), "statements" print "Failed", bugs, "times" print "Total tests", ntest print "Total actions", actCount print "Total runtime", time.time() - start
def main(): global config,rgen,actCount,failCount,ntests,coverageCount parsed_args, parser = parse_args() config = make_config(parsed_args, parser) rgen = random.Random(config.seed) actCount = 0 failCount = 0 coverageCount = {} start = time.time() ntests = 0 while True: elapsed = time.time() - start if elapsed > config.timeout: print "STOPPING TEST DUE TO TIMEOUT, TERMINATED AT LENGTH",ntests break for i in xrange(0, config.depth): sut.restart() ntests += 1 for j in xrange(0, config.width): act = sut.randomEnabled(rgen) actCount += 1 ok = sut.safely(act) if not ok: failCount += 1 print "FOUND A FAILURE" collectCoverage() R = sut.reduce(sut.test(),sut.fails, True, True) sut.prettyPrintTest(R) print sut.failure() break if config.running: if sut.newBranches() != set([]): for b in sut.newBranches(): print time.time()-start, len(sut.allBranches()), "New branch", b if sut.newStatements() != set([]): for s in sut.newStatements(): print time.time()-start,len(sut.allStatements()),"New statement",s collectCoverage() if config.faults: print "TOTAL FAULTS", failCount if config.coverage: print len(sut.allBranches()),"BRANCHES COVERED" print len(sut.allStatements()),"STATEMENTS COVERED" print "TOTAL ACTIONS",actCount print "TOTAL RUNTIME",time.time()-start
def failure(): global bugs bugs += 1 collectCoverage() R = sut.reduce(sut.test(), sut.fails, True, True) if config.faults : filename = 'failure%d.test'%bugs sut.saveTest(sut.test(), filename) sut.prettyPrintTest(R) sut.restart() return
def failures(): bugs += 1 print "FOUND A FAILURE" print sut.failure() print "REDUCING" failPool.append(sut.test()) collectCoverage() R = sut.reduce(sut.test(),sut.fails, True, True) sut.prettyPrintTest(R) print sut.failure() sut.restart()
def main(): global config,rgen,actCount,failCount,ntests,fullPool parsed_args, parser = parse_args() config = make_config(parsed_args, parser) rgen = random.Random(config.seed) actCount = 0 failCount = 0 fullPool = [] start = time.time() ntests = 0 while time.time() - start < config.timeout: ntests += 1 sut.restart() for d in xrange(0, config.depth): act = sut.randomEnabled(rgen) actCount += 1 ok = sut.safely(act) expandPool() if config.running: if sut.newBranches() != set([]): for b in sut.newBranches(): print time.time()-start, len(sut.allBranches()), "New branch", b if sut.newStatements() != set([]): for s in sut.newStatements(): print time.time()-start, len(sut.allStatements()),"New statement",s if not ok: failCount += 1 if config.faults: failureHandle(failCount) print "FOUND A FAILURE" R = sut.reduce(sut.test(),sut.fails, True, True) sut.prettyPrintTest(R) print sut.failure() sut.restart() break if time.time() - start > config.timeout: print "STOPPING TEST DUE TO TIMEOUT, TERMINATED AT LENGTH",ntests break if config.faults: print "TOTAL FAULTS", failCount if config.coverage: sut.internalReport() print "TOTAL ACTIONS",actCount print "TOTAL RUNTIME",time.time()-start
def execute(statement): ok = sut.safely(statement) if not ok: if (opts.fault): captureFault() else: print "FAILURE LOCATED" sut.restart() if opts.plotting: capturePlotData() if opts.running: runtimeCoverage()
def main(): global running,start,TIMEBUDGET,sut,testSaving,gene,testStored,act,srun,flag,coverageCount,covrSort,calculateWei,allCoverage,cW,coverageWM,failCount,actionsCount,sd #global running,possible global config #global lastAddCoverage belowMeanCoverage = set([]) fullPoll = [] parsed_args, parser = parse_args() config = make_config(parsed_args, parser) while time.time()-start < TIMEBUDGET: sut.restart() if (testSaving != None) and (gene.random() > 0.3): sut.backtrack(testSaving) testStored = False #print "Firstly test the AVL tree" for s in xrange(0,config.depth): act = sut.randomEnabled(gene) srun = sut.safely(act) if config.running: if sut.newBranches() != set([]): for d in sut.newBranches(): print time.time()-start,len(sut.allBranches()),"New branch",d findFail() if flag == 1: break for sa in sut.currStatements(): if sa not in coverageCount: coverageCount[sa] = 0 coverageCount[sa] = coverageCount[sa] + 1 covrSort = sorted(coverageCount.keys(), key=lambda x: coverageCount[x]) #coverSum = sum(coverageCount.values()) #coverMean = coverSum / (1.0*len(coverageCount)) #print "the mean of coverage is:",coverMean #for st in covrSort: #print st, coverageCount[st] # if coverageCount[st]<coverMean: # belowMeanCoverage.add(st) # else: # break #print len(belowMeanCoverage), "statement below the mean coverage out of the total coverage:",len(coverageCount) for st in covrSort: if st*(allCoverage - coverageCount[st]) >25: coverageWM.append(st*(allCoverage - coverageCount[st])) print "Now I have the statement below coverage:", st for sd in covrSort: print sd,coverageCount[sd] sut.internalReport() print failCount,"FAILED" print len(sut.allBranches()),"BRANCH" print actionsCount,"TOTAL ACTIONS" print time.time()-start,"TOTAL RUNTIME"
def main(): global start,BUDGET,sut,COVERAGE_REPORT,savedcoverage,rgen,storedTest,act,ok,savedcoverage,running,savedcoverage,Num,faults,foundbug,savedTestState while time.time()-start < BUDGET: sut.restart() if (savedcoverage != None) and (rgen.random() > 0.3): print "Processing" sut.backtrack(savedcoverage) storedTest = False print "First: AVL tree" for s in xrange(0,100): act = sut.randomEnabled(rgen) ok = sut.safely(act) if running: if sut.newBranches() != set([]): ## print "ACTION:",a[0],tryStutter for d in sut.newBranches(): print time.time()-start,len(sut.allBranches()),"New branch",d if len(sut.newStatements()) > 0: savedcoverage = sut.state() storedTest = True if(running): print "New Statement",sut.newStatements() if (not storedTest) and (i != None) and (i in sut.currStatements()): savedcoverage = sut.state() storedTest = True Num += 1 if(faults): if not ok: foundbug += 1 print "Failed" print sut.failure() print "REDUCE" R = sut.reduce(sut.test(),sut.fails, True, True) sut.prettyPrintTest(R) print sut.failure() filename = 'failure%d.test'%bugs_found sut.saveTest(R,filename) break savedTestState = sut.state() expandNewState() if coverage: sut.internalReport() print foundbug,"FAILED" print "ACTIVE",Num print "RUNTIME",time.time()-start
def main(): global start,sut,R,noerror,error,actCount, bugs,ntest,newseq,currseq,states actCount = 0 bugs = 0 start = time.time() noerror = [] error = [] newseq = [] ntest=0 currseq=[] sut = sut.sut() R = random.Random() R.seed(seed) states = [sut.state()] print "STARTING PHASE 1" while(time.time() < start + timeout): for st in states: ntest+=1 if (time.time() > start + timeout): break sut.restart() sut.backtrack(st) for s in xrange(0, depth): if (time.time() > start + timeout): break ok = randomAction() if not ok: error.append(sut.currStatements()) break checkAlg() #if not error ==[]: # print "SHOW ERROR SEQUENCE" # print error # f = open(("error" + str(actCount) + ".test"), 'w') # f.write(str(error)) # f.close() #else: # print "Data in noerror sequence" # print noerror if coverage: sut.internalReport() print "TOTAL BUGS", bugs print "TOTAL ACTIONS",actCount print "TOTAL RUNTIME",time.time()-start
def failure(): global bugs, failPool bugs += 1 print "FOUND A FAILURE" print sut.failure() print "REDUCING" failPool.append(sut.test()) collectCoverage() R = sut.reduce(sut.test(),sut.fails, True, True) sut.prettyPrintTest(R) print sut.failure() fname="failure" + str(bugs) + ".test" sut.saveTest(sut.test(), fname) sut.restart() return
def mutate(test, r, bugs): tcopy = list(test) i = r.randint(0,len(tcopy)) act = sut.randomEnabled(r) isGood = sut.safely(act) if not isGood: bugs += 1 failures(sut) sut.restart() else: trest = [act] for s in tcopy[i+1:]: if s[1](): trest.append(s) sut.safely(s) tcopy = test[:i]+trest return tcopy
def newFunction(): global savecoverage_test,rgen,depth,explore,savecoverage_test,Number,sut,BUDGET,seed,width,faults,coverage,running,bugs_found,Cover_percent,Coverage_W,Least,weight,Coverage_all,start sut.restart() if (savecoverage_test != None) and (rgen.random() > explore): print "processing" sut.backtrack(savecoverage_test) storedTest = False print "part1: AVL" for s in xrange(0,100): act = sut.randomEnabled(rgen) ok = sut.safely(act) if len(sut.newStatements()) > 0: savecoverage_test = sut.state() storedTest = True print "New state",sut.newStatements() if (not storedTest) and (Least != None) and (Least in sut.currStatements()): #print "SAW LEAST COVERED STATEMENT, STORING TEST" savecoverage_test = sut.state() storedTest = True Number += 1 if not ok: bugs_found += 1 print "FAILURE" #sut.prettyPrintTest(sut.test()) print sut.failure() R = sut.reduce(sut.test(),sut.fails, True, True) sut.prettyPrintTest(R) print sut.failure() break for s in sut.currStatements(): if s not in Cover_percent: Cover_percent[s] = 0 Cover_percent[s] += 1 sortedCov = sorted(Cover_percent.keys(), key=lambda x: Cover_percent[x]) # go through the sortedCov and assign weights on them print "part2: coverage" # weight is calculated by: coverage * (mean - Cover_percent), # the greater the difference between the mean and the coverage count, # the larger your weight will be for t in sortedCov: weight = (Coverage_all - Cover_percent[t]) weightedCov = t*weight if weightedCov > 20: Coverage_W.append(weightedCov) print "Coverage:", t
def randomAction(pool): 'Execute a random enabled action from the SUT, catch bugs or add to pool' global nbug act = sut.randomEnabled(rgen) ok = sut.safely(act) if not ok: nbug += 1 if (opts.fault): captureFault() else: print "FAILURE LOCATED" collectCoverage() # collecting coverage because sut.restart() resets internal coverage sut.restart() else: if (opts.running): runtimeCoverage() pool.addTest(sut.test(),sut.state(),set(sut.currStatements())) return ok
def main(): global start,sut,R,noerror,error,reduceTime,actCount, bugs,ntest,newseq,currseq,states, beforeReduceS, beforeReduceB,quickCount actCount = 0 bugs = 0 start = time.time() noerror = [] error = [] newseq = [] ntest=0 currseq=[] sut = sut.sut() reduceTime = 0.0 R = random.Random() R.seed(seed) beforeReduceS = set(sut.allStatements()) beforeReduceB = set(sut.allBranches()) states = [sut.state()] quickCount=0 print "STARTING PHASE 1" while(time.time() < start + timeout): for st in states: ntest+=1 if (time.time() > start + timeout): break sut.restart() sut.backtrack(st) for s in xrange(0, depth): if (time.time() > start + timeout): break ok = randomAction() if not ok: break checkAlg() if coverage: sut.internalReport() if quickTests==1: #if (sut.newCurrBranches() != set([])) or (sut.newCurrStatements() != set([])): handle_failure(sut.test(), "NEW COVERAGE", False, newCov=True) print "TOTAL BUGS", bugs print "TOTAL ACTIONS",actCount print "TOTAL RUNTIME",time.time()-start
def randomAct(): global actCount, bugs, R act = None act = sut.randomEnabled(R) actCount += 1 ok = sut.safely(act) propok = sut.check() if ((not ok) or (not propok)): bugs += 1 if config.faults == 1: test_file.write(str(sut.failure()) + "\n") R = sut.reduce(sut.test(), sut.fails, True, True) sut.prettyPrintTest(R) print sut.failure() sut.restart() return ok
def randomAction(): global actCount, bugs, failPool act = sut.randomEnabled(rgen) actCount += 1 ok = sut.safely(act) if not ok: bugs += 1 print "FOUND A FAILURE" print sut.failure() print "REDUCING" failPool.append(sut.test()) collectCoverage() R = sut.reduce(sut.test(),sut.fails, True, True) sut.prettyPrintTest(R) print sut.failure() sut.restart() else: expandPool() return ok
actCount = 0 BUDGET = 60.0 sut = sut.sut() k = int(sys.argv[1]) actionCount = {} for action in sut.actions(): actionCount[abstract(action[0])] = 0 bugs = 0 start = time.time() while time.time() - start < BUDGET: sut.restart() for s in xrange(0, depth): acts = sut.randomEnableds(rgen, k) sortActs = sorted(acts, key=lambda x: actionCount[abstract(x[0])]) act = sortActs[0] ok = sut.safely(act) actCount += 1 actionCount[abstract(act[0])] += 1 if not ok: bugs += 1 print "FOUND A FAILURE" #sut.prettyPrintTest(sut.test()) print sut.failure() print "REDUCING" R = sut.reduce(sut.test(), sut.fails, True, True) sut.prettyPrintTest(R)