MCPcopy Create free account
hub / github.com/NVIDIA/SOL-ExecBench / TestInit

Class TestInit

tests/sol_execbench/driver/test_problem_packager.py:131–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129
130
131class TestInit:
132 def test_definition_json_written(
133 self, tmp_path, definition, workloads, python_solution, config
134 ):
135 pkg = _make_packager(tmp_path, definition, workloads, python_solution, config)
136 path = pkg.output_dir / "definition.json"
137 assert path.exists()
138 assert json.loads(path.read_text())["name"] == "test_vecadd"
139
140 def test_workload_jsonl_written(
141 self, tmp_path, definition, workloads, python_solution, config
142 ):
143 pkg = _make_packager(tmp_path, definition, workloads, python_solution, config)
144 path = pkg.output_dir / "workload.jsonl"
145 assert path.exists()
146 lines = [l for l in path.read_text().splitlines() if l.strip()]
147 assert len(lines) == 2
148
149 def test_solution_json_written(
150 self, tmp_path, definition, workloads, python_solution, config
151 ):
152 pkg = _make_packager(tmp_path, definition, workloads, python_solution, config)
153 path = pkg.output_dir / "solution.json"
154 assert path.exists()
155 assert json.loads(path.read_text())["name"] == "vecadd_python"
156
157 def test_config_json_written(
158 self, tmp_path, definition, workloads, python_solution, config
159 ):
160 pkg = _make_packager(tmp_path, definition, workloads, python_solution, config)
161 path = pkg.output_dir / "config.json"
162 assert path.exists()
163 parsed = json.loads(path.read_text())
164 assert parsed["lock_clocks"] is False
165
166 def test_python_sources_written(
167 self, tmp_path, definition, workloads, python_solution, config
168 ):
169 pkg = _make_packager(tmp_path, definition, workloads, python_solution, config)
170 kernel = pkg.output_dir / "kernel.py"
171 assert kernel.exists()
172 assert "def run(x, y):" in kernel.read_text()
173
174 def test_cuda_sources_written(
175 self, tmp_path, definition, workloads, cuda_solution, config
176 ):
177 pkg = _make_packager(tmp_path, definition, workloads, cuda_solution, config)
178 kernel = pkg.output_dir / "kernel.cu"
179 assert kernel.exists()
180 assert "cuda kernel" in kernel.read_text()
181
182
183# ── compile() ─────────────────────────────────────────────────────────────────

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected