forked from karin0/buaa-co-cpu-judge
-
Notifications
You must be signed in to change notification settings - Fork 1
/
example-duet.py
44 lines (35 loc) · 1.25 KB
/
example-duet.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from judge import Mars, ISim, DuetJudge, resolve_paths, INFINITE_LOOP
from judge.utils import CachedList
project_path = 'ise-projects/mips7'
module_name = 'tb'
std_project_path = 'ise-projects/mips7-std'
cases = [
'cases/interrupts'
]
db = True
duration = 'all'
appendix = INFINITE_LOOP
timeout = 3
recompile = True
skip_passed_cases = True
include_handler = True
isim = ISim(project_path, module_name, duration=duration,
appendix=appendix, recompile=recompile, timeout=timeout)
std = ISim(std_project_path, module_name, duration=duration,
appendix=appendix, recompile=recompile, timeout=timeout)
mars = Mars(db=db, timeout=timeout)
judge = DuetJudge(isim, std, mars)
def main():
with CachedList('passes.json') as passes:
blocklist = passes if skip_passed_cases else None
paths = resolve_paths(cases,
blocklist=blocklist,
on_omit=lambda path: print('Omitting', path),
)
judge.all(paths,
self_handler=include_handler,
on_success=passes.append,
on_error=passes.close_some,
)
if __name__ == '__main__':
main()