597 def run(self, test: WorkflowTest):
598 self.logger.info("-----------------------------------------------------")
599 self.logger.info(f"Running {test.ID} FPE Check")
600
601 result = True
602 for step in test.steps:
603 log = test.validation_path / f"log.{step}"
604 fpes = {}
605 stack_traces = {}
606 with log.open() as file:
607 last_stack_trace = None
608 for line in file:
609 if "WARNING FPE" in line:
610 last_stack_trace = None
611 fpe = None
612 for part in reversed(line.split()):
613 if "[" in part:
615 break
616 if fpe:
617 if fpe in fpes:
618 fpes[fpe] += 1
619 else:
620 fpes[fpe] = 1
621 last_stack_trace = []
622 stack_traces[fpe] = last_stack_trace
623 elif "FPE stacktrace" in line and last_stack_trace is not None:
624 line = next(file)
625 last_stack_trace.append(line.strip()[9:])
626
627 if fpes.keys():
628 msgLvl = logging.WARNING if test.run in self.ignoreTestRuns or test.type in self.ignoreTestTypes or test.ID in self.ignoreTestIDs else logging.ERROR
629 result = False
630 self.logger.log(msgLvl, f" {step} validation test step FPEs")
631 for fpe, count in sorted(fpes.items(), key=lambda item: item[1]):
632 self.logger.log(msgLvl, f"{count:>5} {fpe}")
633 for fpe in fpes:
634 self.logger.log(msgLvl, "-----------------------------------------------------")
635 self.logger.log(msgLvl, f" first stack trace for algorithm {fpe}:")
636 for line in stack_traces[fpe]:
637 self.logger.log(msgLvl, line)
638 self.logger.log(msgLvl, "-----------------------------------------------------")
639
640 if result:
641 self.logger.info("Passed!\n")
642 elif test.run in self.ignoreTestRuns or test.type in self.ignoreTestTypes or test.ID in self.ignoreTestIDs:
643 self.logger.warning("Failed!")
644 self.logger.warning("Check disabled due to irreproducibilities!\n")
645 result = True
646 else:
647 self.logger.
error(
"Failed!\n")
648
649 return result
std::string replace(std::string s, const std::string &s2, const std::string &s3)
int run(int argc, char *argv[])