Skip to content

Commit 0748d12

Browse files
committed
fix paths for regression test pdf generator
1 parent c2362e2 commit 0748d12

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

build.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,3 +365,7 @@ Write-Host "Tests: ctest -C $BuildType -L regression --test-dir build" -Foregro
365365
Write-Host " ctest -C $BuildType -L unit --test-dir build" -ForegroundColor Gray
366366
Write-Host " Add -V for verbose output, --output-on-failure for failures only" -ForegroundColor DarkGray
367367
Write-Host ""
368+
Write-Host "Report: python tests/regression/utilities/generate_report.py --build-dir build --pdf" -ForegroundColor Gray
369+
Write-Host " Generates regression test report (markdown + PDF) in build/bin/report/" -ForegroundColor DarkGray
370+
Write-Host " Requires: pip install pypandoc (or pandoc on PATH)" -ForegroundColor DarkGray
371+
Write-Host ""

tests/regression/utilities/generate_report.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,11 @@ def get_test_results(categorized_plots):
226226

227227
return test_results
228228

229+
def _relative_plot_path(plot_file, output_dir):
230+
"""Compute the relative path from the report output directory to a plot file."""
231+
rel = os.path.relpath(plot_file, output_dir).replace('\\', '/')
232+
return rel.replace(' ', '%20')
233+
229234
def generate_markdown_report(categorized_plots, output_dir, build_dir, html_styling=False):
230235
"""Generate the markdown report content."""
231236

@@ -358,10 +363,7 @@ def generate_markdown_report(categorized_plots, output_dir, build_dir, html_styl
358363
content.append("")
359364
for plot_file in model_plots['decay']:
360365
plot_name = plot_file.stem.replace('_', ' ').replace('comparison', '').strip()
361-
# Create path relative to report directory
362-
relative_path = f"../{model}/results/plots/{plot_file.name}"
363-
relative_path = relative_path.replace('\\', '/')
364-
relative_path = relative_path.replace(' ', '%20')
366+
relative_path = _relative_plot_path(plot_file, output_dir)
365367

366368
test_type = "Decay Test"
367369
# Get the actual test status
@@ -392,9 +394,7 @@ def generate_markdown_report(categorized_plots, output_dir, build_dir, html_styl
392394
content.append("")
393395
for plot_file in model_plots['regular_waves']:
394396
plot_name = plot_file.stem.replace('_', ' ').replace('comparison', '').strip()
395-
relative_path = f"../{model}/results/plots/{plot_file.name}"
396-
relative_path = relative_path.replace('\\', '/')
397-
relative_path = relative_path.replace(' ', '%20')
397+
relative_path = _relative_plot_path(plot_file, output_dir)
398398

399399
# Extract wave number if present
400400
wave_num = ""
@@ -433,9 +433,7 @@ def generate_markdown_report(categorized_plots, output_dir, build_dir, html_styl
433433
content.append("")
434434
for plot_file in model_plots['irregular_waves']:
435435
plot_name = plot_file.stem.replace('_', ' ').replace('comparison', '').strip()
436-
relative_path = f"../{model}/results/plots/{plot_file.name}"
437-
relative_path = relative_path.replace('\\', '/')
438-
relative_path = relative_path.replace(' ', '%20')
436+
relative_path = _relative_plot_path(plot_file, output_dir)
439437

440438
test_type = "Irregular Waves"
441439
# Get the actual test status
@@ -466,9 +464,7 @@ def generate_markdown_report(categorized_plots, output_dir, build_dir, html_styl
466464
content.append("")
467465
for plot_file in model_plots['other']:
468466
plot_name = plot_file.stem.replace('_', ' ').replace('comparison', '').strip()
469-
relative_path = f"../{model}/results/plots/{plot_file.name}"
470-
relative_path = relative_path.replace('\\', '/')
471-
relative_path = relative_path.replace(' ', '%20')
467+
relative_path = _relative_plot_path(plot_file, output_dir)
472468

473469
test_type = "Other Test"
474470
# Get the actual test status (try to infer from filename)

0 commit comments

Comments
 (0)