|
19 | 19 | import os |
20 | 20 |
|
21 | 21 |
|
22 | | -GLOBAL_TIMEOUT = 600 |
| 22 | +GLOBAL_TIMEOUT = 900 |
23 | 23 | SHORT_TIMEOUT = 10 |
24 | 24 |
|
25 | 25 |
|
@@ -513,6 +513,31 @@ def __write_logs(self, stdout_data: List[str], stderr_data: List[str]): |
513 | 513 | with open(self.system_test_dir / "stderr.log", 'w') as stderr_file: |
514 | 514 | stderr_file.write("\n".join(stderr_data)) |
515 | 515 |
|
| 516 | + def __archive_diff_files(self): |
| 517 | + """ |
| 518 | + Copies any diff VTK files produced by fieldcompare into a dedicated |
| 519 | + diff-results/ folder inside the system test directory so they are |
| 520 | + included in the CI artifact and can be downloaded for inspection. |
| 521 | + """ |
| 522 | + precice_exports = self.system_test_dir / PRECICE_REL_OUTPUT_DIR |
| 523 | + diff_dest = self.system_test_dir / "diff-results" |
| 524 | + if not precice_exports.exists(): |
| 525 | + logging.debug("No precice-exports directory found, skipping diff file archiving") |
| 526 | + return |
| 527 | + diff_files = (list(precice_exports.rglob("*diff*.vtu")) + |
| 528 | + list(precice_exports.rglob("*diff*.vtk")) + |
| 529 | + list(precice_exports.rglob("*diff*.vtp"))) |
| 530 | + if not diff_files: |
| 531 | + logging.debug("No diff files found in precice-exports, skipping archiving") |
| 532 | + return |
| 533 | + diff_dest.mkdir(exist_ok=True) |
| 534 | + for diff_file in diff_files: |
| 535 | + dest_file = diff_dest / diff_file.name |
| 536 | + shutil.copy2(diff_file, dest_file) |
| 537 | + logging.info(f"Archived diff file: {diff_file.name} -> {diff_dest}") |
| 538 | + logging.info(f"Archived {len(diff_files)} diff file(s) to {diff_dest}") |
| 539 | + |
| 540 | + |
516 | 541 | def __prepare_for_run(self, run_directory: Path): |
517 | 542 | """ |
518 | 543 | Prepares the run_directory with folders and datastructures needed for every systemtest execution |
@@ -566,6 +591,7 @@ def run(self, run_directory: Path): |
566 | 591 | std_out.extend(fieldcompare_result.stdout_data) |
567 | 592 | std_err.extend(fieldcompare_result.stderr_data) |
568 | 593 | if fieldcompare_result.exit_code != 0: |
| 594 | + self.__archive_diff_files() |
569 | 595 | self.__write_logs(std_out, std_err) |
570 | 596 | logging.critical(f"Fieldcompare returned non zero exit code, therefore {self} failed") |
571 | 597 | return SystemtestResult( |
|
0 commit comments