mirror of
https://git.nju.edu.cn/oslab2023/oslab.git
synced 2024-06-13 04:44:31 +08:00
31 lines
621 B
Python
Executable File
31 lines
621 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import os
|
|
import re
|
|
import subprocess
|
|
from gradelib import *
|
|
|
|
STOPS = [stop_on_line(".*passed!.*"),
|
|
stop_on_line(".*failed.*"),
|
|
stop_on_line(".*Abort @.*")]
|
|
|
|
r = Runner(save("qemu.out"))
|
|
|
|
@test(50, "loadkernel")
|
|
def test_loadkernel():
|
|
r.run_qemu(*STOPS, stop_on_line('^Hello from OS!$'))
|
|
r.match('Hello from OS!', isregs=[False])
|
|
|
|
@test(50, "loaduser")
|
|
def test_loaduser():
|
|
s = """
|
|
^Hello, I am at 0x010[0-9a-f]{5}
|
|
loaduser test: start
|
|
loaduser test: passed!
|
|
"""
|
|
_, exps, isregs = parse_script(s)
|
|
r.run_qemu(*STOPS)
|
|
r.match(*exps, isregs=isregs)
|
|
|
|
run_tests()
|