6 r
= Runner(save("jos.out"),
7 stop_breakpoint("readline"))
9 @test(0, "running JOS")
13 @test(20, parent
=test_jos
)
15 r
.match("6828 decimal is 15254 octal!")
17 BACKTRACE_RE
= r
"^ *ebp +f01[0-9a-z]{5} +eip +f0100[0-9a-z]{3} +args +([0-9a-z]+)"
19 @test(10, parent
=test_jos
)
20 def test_backtrace_count():
21 matches
= re
.findall(BACKTRACE_RE
, r
.qemu
.output
, re
.MULTILINE
)
22 assert_equal(len(matches
), 8)
24 @test(10, parent
=test_jos
)
25 def test_backtrace_arguments():
26 matches
= re
.findall(BACKTRACE_RE
, r
.qemu
.output
, re
.MULTILINE
)
27 assert_equal("\n".join(matches
[:7]),
28 "\n".join("%08x" % n
for n
in [0,0,1,2,3,4,5]))
30 @test(5, parent
=test_jos
)
31 def test_backtrace_symbols():
32 matches
= re
.findall(r
"kern/init.c:[0-9]+: +([^+]*)\+", r
.qemu
.output
)
33 assert_equal("\n".join(matches
[:7]),
34 "\n".join(["test_backtrace"] * 6 + ["i386_init"]))
36 @test(5, parent
=test_jos
)
37 def test_backtrace_lines():
38 matches
= re
.findall(r
"([^ ]*init.c:([0-9]+):) +test_backtrace\+", r
.qemu
.output
)
39 assert matches
, "No line numbers"
40 if any(int(m
[1]) < 5 or int(m
[1]) > 50 for m
in matches
):
41 assert_equal("\n".join(m
[0] for m
in matches
),
42 "Line numbers between 5 and 50")