1 Star 0 Fork 0

prestige111/jos

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
grade-lab1 1.32 KB
一键复制 编辑 原始数据 按行查看 历史
Anish Athalye 提交于 2018-08-31 03:17 +08:00 . Lab 1
#!/usr/bin/env python
import re
from gradelib import *
r = Runner(save("jos.out"),
stop_breakpoint("readline"))
@test(0, "running JOS")
def test_jos():
r.run_qemu()
@test(20, parent=test_jos)
def test_printf():
r.match("6828 decimal is 15254 octal!")
BACKTRACE_RE = r"^ *ebp +f01[0-9a-z]{5} +eip +f0100[0-9a-z]{3} +args +([0-9a-z]+)"
@test(10, parent=test_jos)
def test_backtrace_count():
matches = re.findall(BACKTRACE_RE, r.qemu.output, re.MULTILINE)
assert_equal(len(matches), 8)
@test(10, parent=test_jos)
def test_backtrace_arguments():
matches = re.findall(BACKTRACE_RE, r.qemu.output, re.MULTILINE)
assert_equal("\n".join(matches[:7]),
"\n".join("%08x" % n for n in [0,0,1,2,3,4,5]))
@test(5, parent=test_jos)
def test_backtrace_symbols():
matches = re.findall(r"kern/init.c:[0-9]+: +([^+]*)\+", r.qemu.output)
assert_equal("\n".join(matches[:7]),
"\n".join(["test_backtrace"] * 6 + ["i386_init"]))
@test(5, parent=test_jos)
def test_backtrace_lines():
matches = re.findall(r"([^ ]*init.c:([0-9]+):) +test_backtrace\+", r.qemu.output)
assert matches, "No line numbers"
if any(int(m[1]) < 5 or int(m[1]) > 50 for m in matches):
assert_equal("\n".join(m[0] for m in matches),
"Line numbers between 5 and 50")
run_tests()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/prestige111/jos.git
git@gitee.com:prestige111/jos.git
prestige111
jos
jos
lab5

搜索帮助