Files
kernbench2/tests/test_cli_verify_data.py
T
ywkang 049e3d8bb3 benches: package as kernbench.benches, add @bench registry + list subcommand
Move benches/ -> src/kernbench/benches/ and src/kernbench/cli/probe.py ->
src/kernbench/probes/probe.py. Each bench self-registers via
@bench(name=..., description=...); kernbench list enumerates benches
with auto-assigned indices, --bench accepts kebab-case name or numeric
index. Audit at package-import time fails if any non-underscore module
forgets the decorator. ADR-0010 (EN + KO) updated to reflect the new
resolver path, list subcommand, and probes package separation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 14:42:10 -07:00

50 lines
1.4 KiB
Python

"""Tests for --verify-data CLI flag (Phase 1 verification)."""
import kernbench.cli.main as cli_main
def test_cli_verify_data_flag_parsed(monkeypatch):
"""--verify-data flag is parsed and stored as True."""
def fake_cmd_run(args) -> int:
assert args.verify_data is True
return 0
monkeypatch.setattr(cli_main, "cmd_run", fake_cmd_run)
rc = cli_main.main([
"run", "--topology", "topology.yaml", "--bench", "qkv-gemm",
"--verify-data",
])
assert rc == 0
def test_cli_verify_data_flag_default(monkeypatch):
"""Without --verify-data, flag defaults to False."""
def fake_cmd_run(args) -> int:
assert args.verify_data is False
return 0
monkeypatch.setattr(cli_main, "cmd_run", fake_cmd_run)
rc = cli_main.main([
"run", "--topology", "topology.yaml", "--bench", "qkv-gemm",
])
assert rc == 0
def test_cmd_run_verify_data_enables_engine():
"""--verify-data runs full pipeline with enable_data=True and DataExecutor."""
rc = cli_main.main([
"run", "--topology", "topology.yaml", "--bench", "qkv-gemm",
"--device", "sip:0", "--verify-data",
])
assert rc == 0
def test_cmd_run_without_verify_data_no_op_log():
"""Without --verify-data, engine runs in timing-only mode (no op_log)."""
rc = cli_main.main([
"run", "--topology", "topology.yaml", "--bench", "qkv-gemm",
"--device", "sip:0",
])
assert rc == 0