Explorar o código

harness: add command and tool_version to all offline and TD receipt payloads.

Codex Resource Selftest hai 4 meses
pai
achega
c90e0cbd47
Modificáronse 1 ficheiros con 20 adicións e 0 borrados
  1. 20 0
      tools/prod2u_p4_harness.py

+ 20 - 0
tools/prod2u_p4_harness.py

@@ -1232,6 +1232,10 @@ def _run_icarus(
         "target_manifest": target_manifest,
         "safety": dict(SAFETY_BOUNDARY),
     }
+    result["command"] = " ".join(str(c) for c in compile_command)
+    if run_result is not None:
+        result["command"] += f"; {' '.join(str(c) for c in [str(vvp), str(output)])}"
+    result["tool_version"] = f"iverilog={iverilog}; vvp={vvp}"
     result.update(source_binding_fields(source_state(), verification_run_id=verification_run_id))
     return result
 
@@ -1335,6 +1339,8 @@ def _run_verilator(
         "target_manifest": target_manifest,
         "safety": dict(SAFETY_BOUNDARY),
     }
+    receipt["command"] = " ".join(str(c) for c in command)
+    receipt["tool_version"] = f"verilator={verilator}"
     receipt.update(source_binding_fields(source_state(), verification_run_id=verification_run_id))
     return receipt
 
@@ -1411,6 +1417,11 @@ def _run_cocotb(
         "target_manifest": target_manifest,
         "safety": dict(SAFETY_BOUNDARY),
     }
+    result["command"] = "; ".join(
+        " ".join(str(c) for c in [str(python_exe), "-B", str(ROOT / t["runner"])])
+        for t in targets
+    )
+    result["tool_version"] = f"cocotb (Python {python_exe})"
     result.update(source_binding_fields(source_state(), verification_run_id=verification_run_id))
     return result
 
@@ -1614,6 +1625,7 @@ def formal_payload(
         )
     assert resolved is not None
     results: list[dict[str, Any]] = []
+    formal_commands: list[str] = []
     for target in targets:
         sby_file = ROOT / target["sby"]
         property_counts = formal_property_counts(sby_file)
@@ -1627,9 +1639,11 @@ def formal_payload(
         task_env = formal_tool_env(resolved)
 
         def run_task(task_name: str, task_workdir: Path) -> dict[str, Any]:
+            nonlocal formal_commands
             command = [str(sby), "-f", "-d", str(task_workdir), str(sby_file)]
             if tasks:
                 command.append(task_name)
+            formal_commands.append(" ".join(command))
             try:
                 completed = subprocess.run(
                     command,
@@ -1782,6 +1796,8 @@ def formal_payload(
         "target_manifest": target_manifest,
         "safety": dict(SAFETY_BOUNDARY),
     }
+    result["command"] = "; ".join(formal_commands)
+    result["tool_version"] = f"sby={toolchain['sby']['version']}; yosys={toolchain['yosys']['version']}"
     result.update(source_binding_fields(source_state(), verification_run_id=verification_run_id))
     return result
 
@@ -1840,6 +1856,8 @@ def unit_payload(
         "stdout_tail": _tail(completed.stdout, 12000),
         "stderr_tail": _tail(completed.stderr, 12000),
     }
+    result["command"] = " ".join(str(c) for c in command)
+    result["tool_version"] = f"Python {sys.version.split()[0]}"
     result.update(source_binding_fields(source_state(), verification_run_id=verification_run_id))
     return result
 
@@ -1858,6 +1876,8 @@ def source_integrity_payload() -> dict[str, Any]:
         "stdout_tail": _tail(completed.stdout),
         "stderr_tail": _tail(completed.stderr),
         "source_state": state,
+        "command": "git diff --check HEAD",
+        "tool_version": "git",
     }