def mutate(test): global bugs tcopy = list(test) #randomly choose part of the chosen case i = rgen.randint(0,len(tcopy)) #replay to be the chosen state sut.replay(tcopy[:i],catchUncaught = True) e = sut.randomEnabled(rgen) #check whether it is correct ok = sut.safely(e) if not ok: bugs = bugs+1 errors.append(sut.currStatements()) fault_collection() trest = [e] for s in tcopy[i+1:]: if s[1](): trest.append(s) sut.safely(s) tcopy = test[:i]+trest #if we find new branches if len(sut.newCurrBranches()) != 0: print "NEW BRANCHES DUE TO MUTATION:",sut.newCurrBranches() return tcopy
def mutate(test,failureNum,start,timeout,running): tcopy = list(test) i = rgen.randint(0,len(tcopy)) sut.replay(tcopy[:i],catchUncaught = True) e = sut.randomEnabled(rgen) ok = sut.safely(e) ifRunning((time.time()-start),running,e) if not ok: f1_mutate = sut.test() failureNum = Failure(failureNum,f1_mutate) trest = [e] for s in tcopy[i+1:]: if time.time()-start > timeout: break if s[1](): trest.append(s) ok=sut.safely(s) newCovBran, newCovStat = ifRunning((time.time()-start),running,action) if not ok: f1_mutate = sut.test() failureNum = Failure(failureNum,f1_mutate) if newCovBran or newCovStat: BFSstartState = sut.state() failureNum = BFS(BFSstartState,failureNum,depthNum,lastCovTime,newCovTime) break tcopy = test[:i]+trest return tcopy,failureNum
def mutate(test): tcopy = list(test) i = rgen.randint(0,len(tcopy)) sut.replay(tcopy[i:]) e = sut.randomEnabled(rgen) ok = sut.safely(e) elapsed = time.time() - start if RUNNING: #should branch coverage be produced if sut.newBranches() != set([]): for b in sut.newBranches(): print elapsed,len(sut.allBranches()),"New branch",b if not ok: #found a bug, report it 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) print sut.failure() if FAULT: #save test to a file if FAULT is enabled filename = "failure" + str(bugs) + ".test" sut.saveTest(R,filename) trest = [e] for s in tcopy[i+1:]: if s[1](): trest.append(s) ok = sut.safely(s) if not ok: #found a bug, report it 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) print sut.failure() if FAULT: #save test to a file if FAULT is enabled filename = "failure" + str(bugs) + ".test" sut.saveTest(R,filename) tcopy = test[i:] +trest return tcopy
def mutate(okTest): tcopy = list(test) i = rgen.randint(0,len(tcopy)) e = sut.randomEnabled(rgen) sut.safely(e) trest = [e] for s in tcopy[i+1:]: if s[1](): trest.append(s) sut.safely(s) tcopy = test[:i]+trest if len(sut.newCurrBranches()) != 0: print "NEW BRANCHES DUE TO MUTATION:",sut.newCurrBranches() return tcopy
def newState(): global rgen,sut,collected_test,storedTest,action_cnt,bugfound for i in xrange(0,DEPTH): action = sut.randomEnabled(rgen) no_bug_found = sut.safely(action) if RUNNING: if sut.newBranches() != set([]): for d in sut.newBranches(): print time.time() - start,len(sut.allBranches()),"New Branches",d if len(sut.newStatements()) > 0: collected_test = sut.state() storedTest = True print "new statement:",sut.newStatements() if (not storedTest) and (lst_coverage != None) and (lst_coverage in sut.currStatements()): collected_test = sut.state() storedTest = True action_cnt += 1 if not no_bug_found: bugfound += 1 print "A failure happened here." rds = sut.reduce(sut.test(),sut.fails, True, True) sut.prettyPrintTest(rds) print sut.failure() break
def appendAndExecuteSeq(seq, n, eseqs, nseqs): ok = False propok = False classTable = dict.fromkeys(sut.actionClasses(), 0) timeover = time.time() - start >= timeout while n > 0: n -= 1 a = sut.randomEnabled(rgen) seq.append(a) if equal(seq, eseqs) or equal(seq, nseqs): continue ok = sut.safely(a) propok = sut.check() classTable[sut.actionClass(a)] += 1 if running: argRunning(a) if contract(ok, propok, seq, eseqs): break timeover = time.time() - start >= timeout if timeover: return (ok, propok, classTable, timeover) return (ok, propok, classTable, timeover)
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 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 randomAction(): global bug_no, time_start, allAction, ii action = sut.randomEnabled(rand) ok = sut.safely(action) elapsed = time.time() - time_start if RUNNING_DETAIL: if len(sut.newBranches()) > 0: print "ACTION:", action[0] for b in sut.newBranches(): print elapsed, len(sut.allBranches()), "New branch", b if not ok: # found a bug bug_no += 1 print "FOUND A BUG! #", bug_no print sut.failure() print("REDUCING") reduce = sut.reduce(sut.test(), sut.fails, True, True) sut.prettyPrintTest(reduce) print(sut.failure()) # write the bug to file if FAULT_ARGUMENT is enabled if (FAULT_CHECK): f = open((failure_file + str(bug_no) + ".test"), "w") print >> f, sut.failure() # print sequence that causes failure j = 0 for (s_reduces, _, _) in reduce: steps_reduce = "# STEP " + str(j) print >> f, sut.prettyName(s_reduces).ljust(80 - len(steps_reduce), ' '), steps_reduce j += 1 f.close() print "time: ", time.time() - time_start return ok
def crossover(test,test2): global bugs tcopy = list(test) #randomly choose part of test i = rgen.randint(0,len(tcopy)) #replay to be the chosen state sut.replay(tcopy[:i],catchUncaught = True) trest = [] for s in test2[i:]: if s[1](): trest.append(s) #check whether it is correct ok = sut.safely(s) if not ok: bugs = bugs+1 errors.append(sut.currStatements()) fault_collection() #to do crossover tcopy = test[:i]+trest #if we find new branches if len(sut.newCurrBranches()) != 0: print "NEW BRANCHES DUE TO CROSSOVER:",sut.newCurrBranches() return tcopy
def randomAction(): global actCount, bugs, visited act = sut.randomEnabled(rgen) actCount += 1 ok = sut.safely(act) elapsed = time.time() - start if not ok: bugs += 1 if FAULTS: name = "failure"+str(bugs)+".test" f = sut.test() sut.saveTest(f,name) else: if RUNNING: if sut.newBranches() != set([]): print "ACTION:",act[0] for d in sut.newBranches(): print elapsed,len(sut.allBranches()),"New branch",d sawNew = True else: sawNew = False if sut.newStatements() != set([]): print "ACTION:",act[0] for s in sut.newStatements(): print elapsed,len(sut.allStatements()),"New statement",s sawNew = True else: sawNew = False if len(sut.newStatements()) != 0: visited.append((list(sut.test()), set(sut.currStatements()))) return ok
def tester(): global sut,act,n,test,para,lCovered,actNum,bugs,M,flag, filename act = sut.randomEnabled(rgen) flag = 0 n = sut.safely(act) if running: if sut.newBranches() != set([]): for d in sut.newBranches(): print time.time() - start, len(sut.allBranches()),"New branch",d if len(sut.newStatements()) > 0: test = sut.state() para = True print sut.newStatements() if (para == False): if (lCovered != None): if (lCovered in sut.currStatements()): test = sut.state() para = True actNum += 1 if (n == 0): bugs += 1 print "A failure has been found!", bugs print sut.failure() M = sut.reduce(sut.test(),sut.fails, True, True) sut.prettyPrintTest(M) print sut.failure() filename ='failure%d.test'%bugs sut.saveTest(M,filename) flag = 1
def appendAndExecuteSeq(seq, n, eseqs, nseqs): global config, rgen, start ok = False propok = False timeover = time.time() - start >= config.timeout while n > 0: n -= 1 a = rgen.choice(getComponent()) seq.append(a) if equal(seq, eseqs) or equal(seq, nseqs): continue ok = sut.safely(a) propok = sut.check() if config.running: argRunning(a) if contract(ok, propok, seq, eseqs): break timeover = time.time() - start >= config.timeout if timeover: return (ok, propok, timeover) return (ok, propok, timeover)
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 Find_bugs(list_actions): # print "Find_bugs" global coverage_counter global bugs global Record global string safe = sut.safely(list_actions) running_oh() if not safe: bugs = bugs + 1 print " *** find a bug: ",bugs # bugs = bugs + 1 for t in sut.currStatements(): if t not in coverage_counter: coverage_counter[t]=0 coverage_counter[t] = coverage_counter[t] + 1 # Collect_coverage() print sut.failure() # string = str(sut.failure) Record = True print "reducing..." R = sut.reduce(sut.test(),sut.fails, True, True) sut.prettyPrintTest(R) # record_failures(R) if FAULTS: print"create file" # for x in xrange(1,bugs): # print "save" sut.saveTest(R, failure + str(bugs)+ ".test") # filename = "failure" + str(bugs) + ".test" # sut.saveTest(sut.test(), filename) # sut.restart() return safe
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 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 randomAct(): global actCount, bugs, R act = None act = sut.randomEnabled(R) actCount += 1 ok = sut.safely(act) if (not ok): failure() return ok
def randomAction(): global actCount, bugs, failPool act = sut.randomEnabled(rgen) actCount += 1 ok = sut.safely(act) if not ok: failures() else: Statement() return ok
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 randomAct(): global sut, actCount, R act = sut.randomEnabled(R) actCount += 1 ok = sut.safely(act) propok = sut.check() if (not ok) or ((not propok) and (config.check)): failure() else: savingTest() return ok
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 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 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 takeTest(actt): global fullPool,bugs,sut ok = sut.safely(actt) collectCoverage() if len(sut.newStatements()) != 0: fullPool.append((list(sut.test()), set(sut.currStatements()))) if not ok : bugs += 1 if Faults : R = sut.reduce(sut.test(),sut.fails, True, True) filename = "failure" + str(bugs) + ".test" sut.saveTest(R,filename)
def Find_bugs(a): #print "aaaaa" global coverage_counter global bugs safe = sut.safely(a) if not safe: print " find a bug: " bugs = bugs + 1 for s in sut.currStatements(): if s not in coverage_counter: coverage_counter[s]=0 coverage_counter[s] = coverage_counter[s] + 1 print sut.failure() R = sut.reduce(sut.test(),sut.fails, True, True) sut.prettyPrintTest(R)
import sut import time import random sut = sut.sut() rgen = random.Random() MEMORY = 5 TIMEOUT = 300 TEST_LENGTH = 200 PEXTEND = 0.2 goodTests = [] startTime = time.time() while (time.time() - startTime <= TIMEOUT): if (len(goodTests) > 0) and (rgen.random() < PEXTEND): sut.backtrack(rgen.choice(goodTests)[1]) else: sut.restart() for s in xrange(0, TEST_LENGTH): action = sut.randomEnabled(rgen) r = sut.safely(action) if len(sut.newBranches()) > 0: print time.time(), len( sut.allBranches()), 'NEW BRANCHES:', sut.newBranches() if MEMORY > 0: goodTests.append((sut.state(), sut.currBranches())) goodTests = sorted(goodTests, reverse=True)[:MEMORY]
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) print sut.failure() sut.restart() sut.internalReport()
rgen = random.Random() DEPTH = 100 #NUM_TESTS = 100 sut = sut.sut() sut.silenceCoverage() sut.restart() queue = [sut.state()] visited = [] d = 1 while d <= DEPTH: print "DEPTH",d,"QUEUE SIZE",len(queue),"VISITED SET",len(visited) d += 1 frontier = [] for s in queue: sut.backtrack(s) for a in sut.enabled(): sut.safely(a) s2 = sut.state() if s2 not in visited: visited.append(s2) frontier.append(s2) queue = frontier sut.internalReport()
while d <= GOAL_DEPTH: print "DEPTH", d, "QUEUE SIZE", len(queue), "VISITED SET", len(visited) d += 1 frontier = [] startLayer = time.time() scount = 0 for s in queue: scount += 1 sut.backtrack(s) allEnabled = sut.enabled() rgen.shuffle(allEnabled) for a in allEnabled: elapsed = time.time() - startLayer if elapsed >= LAYER_BUDGET: break ok = sut.safely(a) actCount += 1 if not ok: 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) print sut.failure() #sys.exit(1) s2 = sut.state() if s2 not in visited: visited.append(s2) frontier.append(s2) sut.backtrack(s)