Download testing/agent_evaluation/functions/read_run_log.py from yuhanqin/ut-evaluation: direct link, hf CLI and curl.
- Browser
- Download file 1.3 kB
-
https://huggingface.co/datasets/yuhanqin/ut-evaluation/resolve/main/testing/agent_evaluation/functions/read_run_log.py
- Command line
-
hf download hf://datasets/yuhanqin/ut-evaluation/testing/agent_evaluation/functions/read_run_log.py
-
curl -L -o read_run_log.py https://huggingface.co/datasets/yuhanqin/ut-evaluation/resolve/main/testing/agent_evaluation/functions/read_run_log.py
1.3 kB
| """Read one ``run_<TC>_<SEED>.log`` body. | |
| Markers come from the env-gen checker and testbench templates and from the | |
| generated Makefile's log grep. Text that matches none of them stays unset. | |
| """ | |
| from __future__ import annotations | |
| import re | |
| from dataclasses import dataclass | |
| # checker.sv.tmpl, tb_top.sv.tmpl, and generate_makefile.py. | |
| _FUNCTIONAL = re.compile( | |
| r"\[SB\] mismatch|\[SB\] unexpected output|\[SVA\]|\[EOC\] scoreboard|" | |
| r"\[SB_SUMMARY\][^\n]*(?:failed=[1-9]\d*|residue=[1-9]\d*)" | |
| ) | |
| _CLEAN = re.compile(r"\*\*\* PASS|\[SB_SUMMARY\][^\n]*failed=0\b[^\n]*residue=0\b|\[WATCHDOG\]") | |
| class RunLogSummary: | |
| """Whether one run log shows a functional failure. | |
| ``None`` means the log could not be judged. It is not a miss. | |
| """ | |
| functional_hit: bool | None | |
| def read_run_log(text: str) -> RunLogSummary: | |
| """Return whether ``text`` shows a scoreboard or assertion failure.""" | |
| if not isinstance(text, str): | |
| raise TypeError("text must be a string") | |
| if not text.strip(): | |
| return RunLogSummary(functional_hit=None) | |
| if _FUNCTIONAL.search(text): | |
| return RunLogSummary(functional_hit=True) | |
| if _CLEAN.search(text): | |
| return RunLogSummary(functional_hit=False) | |
| return RunLogSummary(functional_hit=None) | |