Skip to content

Commit 2a5b85e

Browse files
committed
print path for diff test --keep-input option
diff test framework has a --keep-input option to keep the generated trace, however it is often in some difficult to discover file in /tmp like Print the path to make the location obvious to the user
1 parent 6e853ac commit 2a5b85e

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

python/generators/diff_tests/runner.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,10 @@ def _run_test(self, test: TestCase,
183183
gen_trace_file.close()
184184
os.remove(trace_path)
185185

186+
print_trace_path = gen_trace_file and self.config.keep_input
186187
run_str = self._process_test_result(result, trace_path,
187188
extension_descriptor_paths,
188-
trace_descriptor_path)
189+
trace_descriptor_path, print_trace_path)
189190
return test.name, run_str, result
190191

191192
def _process_test_result(
@@ -194,6 +195,7 @@ def _process_test_result(
194195
trace_path: str,
195196
extension_descriptor_paths: List[str],
196197
trace_descriptor_path: str,
198+
print_trace_path: bool,
197199
) -> str:
198200
colors = ColorFormatter(self.config.no_colors)
199201

@@ -219,6 +221,7 @@ def write_cmdlines() -> str:
219221
return res
220222

221223
run_str = f"{colors.yellow('[ RUN ]')} {result.test.name}\n"
224+
run_diagnostics = [f"trace_path: {trace_path}"] if print_trace_path else []
222225
if result.exit_code != 0 or not result.passed:
223226
result.passed = False
224227
run_str += result.stderr
@@ -230,13 +233,15 @@ def write_cmdlines() -> str:
230233
else:
231234
run_str += write_cmdlines()
232235

233-
run_str += (f"{colors.red('[ FAILED ]')} {result.test.name}\n")
236+
run_str += (f"{colors.red('[ FAILED ]')} {result.test.name}")
234237
else:
235238
assert result.perf_result
236-
run_str += (
237-
f"{colors.green('[ OK ]')} {result.test.name} "
238-
f"(ingest: {result.perf_result.ingest_time_ns / 1000000:.2f} ms "
239-
f"query: {result.perf_result.real_time_ns / 1000000:.2f} ms)\n")
239+
run_str += f"{colors.green('[ OK ]')} {result.test.name}"
240+
run_diagnostics.append(
241+
f"ingest: {result.perf_result.ingest_time_ns / 1000000:.2f} ms")
242+
run_diagnostics.append(
243+
f"query: {result.perf_result.real_time_ns / 1000000:.2f} ms")
244+
run_str += f" ({' '.join(run_diagnostics)})\n" if run_diagnostics else "\n"
240245
return run_str
241246

242247
def _get_build_config(self) -> Set[str]:

0 commit comments

Comments
 (0)