Exemplo n.º 1
0
def main():
    result = 0
    test = core.TestUnit("condition variable")
    test.send_command("sy3")
    for i in range(5):
        for i in range(31, -1, -1):
            out = test.look_for('Thread ' + str(i))
            if out < 0:
                result = -1  # failure
                break
        if result == -1:  # get out of outer loop on failure
            break
    if result == 0:
        test.look_for_and_print_result('CV test done', 10)
    else:  # no partial mark
        test.print_result(0, 10)
Exemplo n.º 2
0
def main():
    test = core.TestUnit("crash")

    out = warm_up(test, 4)
    if not out:
        test.print_result(0, total)
        return

    print "START TEST"
    keylist = outputs.keys()
    keylist.sort()
    for i in keylist:
        runtest(test, i, outputs[i], 1)

    # the 'o' option with virtual memory will take substantially longer
    test.set_timeout(540)
    runtest(test, "o", 3, crash_o_mark)
Exemplo n.º 3
0
def main():
    test = core.TestUnit("console")
    test.runprogram("/testbin/console")
    test.look_for_and_print_result("hello world", 1)
    test.look_for_and_print_result("false warning", 1)
    send_key(test, "\n")
    send_key(test, "6")
    for i in [1, 2, 3, 4, 5]:
        test.look_for_and_print_result(r"%d\.\.\. passed\." % i, 1)
    for i in [6, 7, 8]:
        res = test.look_for_and_print_result(r"%d\.\.\. passed\." % i, 1)
        if res == -1:
            # send a random key to trigger the next command in sequence
            test.send_command("\n", 0)
    for i in [9, 10, 11]:
        test.look_for(r"test case %d\.\.\." % i)
        send_key(test, "I")
Exemplo n.º 4
0
def main():
    out = 0
    test = core.TestUnit("stacktest")
    test.set_timeout(30)

    for i in xrange(numrun):
        print "RUN %d/%d" % (i + 1, numrun)
        test.runprogram("/testbin/stacktest")

        for i in range(4000):
            check = "\ncalling foo: n-i = " + str(i)
            out = test.look_for([test.menu, check])
            if out <= 0:
                break

        if out <= 0:
            test.print_result(0, mark)
            return

    test.print_result(mark, mark)
Exemplo n.º 5
0
def main():
    test = core.TestUnit("forktest")
    test.runprogram("/testbin/forktest")
    test.set_timeout(15)

    out = test.look_for("([0123]{30,30})$")
    if out < 0:
        test.print_result(0, mark)
        return

    output = test.kernel.match.group(0)
    output_array = [0] * 4
    for i in range(len(output)):
        index = int(output[i])
        output_array[index] = output_array[index] + 1
    if (output_array[0] == 2) and (output_array[1] == 4) and \
            (output_array[2] == 8) and (output_array[3] == 16):
        test.print_result(mark, mark)
    else:
        test.print_result(0, mark)
Exemplo n.º 6
0
def main():
    test = core.TestUnit("forktest")
    test.set_timeout(150)
    mark = 0
    next = 8
    
    for i in xrange(nruns):
        print "RUN %d/%d"%(i+1, nruns)
        test.runprogram("/testbin/forktest")
        out = test.look_for([test.menu, "([0123]{30,30})$"])
        
        # if we crash or timeout, end test immediately
        if out < 0:
            break
        elif out == 0:
            # did not find expected output, just go again
            print "FAIL"
            continue
        
        # found possible candidate of expected output, check and see
        output = test.kernel.match.group(0)
        output_array = [0] * 4
        for c in output:
            index = int(c)
            output_array[index] += 1
        if (output_array[0] == 2) and (output_array[1] == 4) and \
                (output_array[2] == 8) and (output_array[3] == 16):
            mark += next
            next = next/2
            print "PASS"
        else:
            # did not find correct output 
            print "FAIL"
    
    # either all 4 runs finished or OS crashed at some point        
    test.print_result(mark, total)  
Exemplo n.º 7
0
def main():
    test = core.TestUnit("addexec")
    test.runprogram("/testbin/addexec")
    test.look_for_and_print_result('Answer: 1234567', 10)
Exemplo n.º 8
0
def testlock(i):
    global test
    test = core.TestUnit("lock")
    test.send_command("sy2")
    return test.look_for(['Test failed', 'Lock test done.'])
Exemplo n.º 9
0
def main():
    out = 0
    test = core.TestUnit("bigprog")
    check = "Passed bigprog test"
    test.runprogram("/testbin/bigprog")
    out = test.look_for_and_print_result(check, mark, menu=1)
Exemplo n.º 10
0
def main():
    test = core.TestUnit("malloctest")
    for (testnum, mark, timeout, check) in tests:
        test.runprogram("/testbin/malloctest", str(testnum))
        test.set_timeout(timeout)
        test.look_for_and_print_result(check, mark, menu=1)
Exemplo n.º 11
0
def main():
    test = core.TestUnit("facts")
    test.runprogram("/testbin/facts")
    test.set_timeout(15)
    output = "12! +11! +10! +9! +8! +7! +6! +5! +4! +3! +2! +1! = 522956313"
    test.look_for_and_print_result(re.escape(output), 24)
Exemplo n.º 12
0
def main():
    test = core.TestUnit("matmult")
    test.runprogram("/testbin/matmult")
    test.set_timeout(180)
    test.look_for_and_print_result('answer is: 8772192', mark, menu=1)
Exemplo n.º 13
0
def main():
    test = core.TestUnit("timeit")
    test.runprogram("/testbin/timeit")
    test.set_timeout(30)
    check = 'sieve: 2 runs took about \d+ seconds'
    test.look_for_and_print_result(check, mark, menu=1)