Ejemplo n.º 1
0
def dfs (test):
    print len(test), len(covertool.getCoverage())
    elapsed = time.time()-start
    if (elapsed > config.timeout):
        print "EXITING DUE TO TIMEOUT"
        sys.exit(2)
    if len(test) == config.depth:
        return
    old = t.state()
    visited.append(old)
    allt = t.enabled()
    if config.random:
        random.shuffle(allt)
    for tran in t.enabled():
        newtest = list(test)
        newtest.append(tran[0])
        try:
            tran[2]()
        except:
            pass
        if not t.check():
            print "EXITING DUE TO FAILED TEST"
            sys.exit(1)
        if t.state() not in visited:
            dfs (newtest)
        t.backtrack(old)
Ejemplo n.º 2
0
def dfs(test):
    print len(test), len(covertool.getCoverage())
    elapsed = time.time() - start
    if (elapsed > config.timeout):
        print "EXITING DUE TO TIMEOUT"
        sys.exit(2)
    if len(test) == config.depth:
        return
    old = t.state()
    visited.append(old)
    allt = t.enabled()
    if config.random:
        random.shuffle(allt)
    for tran in t.enabled():
        newtest = list(test)
        newtest.append(tran[0])
        try:
            tran[2]()
        except:
            pass
        if not t.check():
            print "EXITING DUE TO FAILED TEST"
            sys.exit(1)
        if t.state() not in visited:
            dfs(newtest)
        t.backtrack(old)
Ejemplo n.º 3
0
ntests = 0
while (config.maxtests == -1) or (ntests < config.maxtests):
    ntests += 1

    t.restart()
    test = []

    print ntests, len(covertool.getTotalCoverage())

    for s in xrange(0,config.depth):
        possible = t.enabled()
        random.shuffle(possible)
        old = t.state()
        last = min(config.k, len(possible))
        pos = 0
        cov = covertool.getCoverage()
        for (name, guard, act) in possible[:config.k]:
            elapsed = time.time()-start
            if elapsed > config.timeout:
                print "EXITING DUE TO TIMEOUT"
                print ntests, "EXECUTED"
                sys.exit(2)
            pos += 1
            test.append(name)
            try:
                act()
            except:
                pass
            if not t.check():
                print "FAILING TEST:", test
                sys.exit(1)
Ejemplo n.º 4
0
start = time.time()
elapsed = time.time()-start

t = SUT.t()

covertool.clearCoverage()

ntests = 0
while (config.maxtests == -1) or (ntests < config.maxtests):
    ntests += 1

    t.restart()
    test = []

    print ntests, len(covertool.getCoverage())

    for s in xrange(0,config.depth):
        a = random.choice(t.enabled())
        test.append(a[0])
        
        cov = covertool.getCoverage()
        
        try:
            a[2]()
        except:
            pass
        
        covNew = covertool.getCoverage()
        if len(covNew) > len(cov):
            elapsed = time.time()-start
Ejemplo n.º 5
0
start = time.time()
elapsed = time.time() - start

t = SUT.t()

covertool.clearCoverage()

ntests = 0
while (config.maxtests == -1) or (ntests < config.maxtests):
    ntests += 1

    t.restart()
    test = []

    print ntests, len(covertool.getCoverage())

    for s in xrange(0, config.depth):
        a = random.choice(t.enabled())
        test.append(a[0])

        cov = covertool.getCoverage()

        try:
            a[2]()
        except:
            pass

        covNew = covertool.getCoverage()
        if len(covNew) > len(cov):
            elapsed = time.time() - start
Ejemplo n.º 6
0
ntests = 0
while (config.maxtests == -1) or (ntests < config.maxtests):
    ntests += 1

    t.restart()
    test = []

    print ntests, len(covertool.getTotalCoverage())

    for s in xrange(0, config.depth):
        possible = t.enabled()
        random.shuffle(possible)
        old = t.state()
        last = min(config.k, len(possible))
        pos = 0
        cov = covertool.getCoverage()
        for (name, guard, act) in possible[:config.k]:
            elapsed = time.time() - start
            if elapsed > config.timeout:
                print "EXITING DUE TO TIMEOUT"
                print ntests, "EXECUTED"
                sys.exit(2)
            pos += 1
            test.append(name)
            try:
                act()
            except:
                pass
            if not t.check():
                print "FAILING TEST:", test
                sys.exit(1)