Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/grizzly/reduce/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,15 @@ def _on_replay_iteration(self) -> None:
self._status.iterations += 1
self._status.report()

def run_reliability_analysis(self) -> tuple[int, int]:
def run_reliability_analysis(self, post_launch_delay: int) -> tuple[int, int]:
"""Run several analysis passes of the current testcase to find `run` parameters.

The number of repetitions and minimum number of crashes are calculated to
maximize the chances of observing the expected crash.

Arguments:
None
post_launch_delay: Time in seconds before continuing after the browser
is launched.

Returns:
Values for `repeat` and `min_crashes` resulting from analysis.
Expand Down Expand Up @@ -323,6 +324,7 @@ def run_reliability_analysis(self) -> tuple[int, int]:
idle_delay=self._idle_delay,
idle_threshold=self._idle_threshold,
on_iteration_cb=self._on_replay_iteration,
post_launch_delay=post_launch_delay,
services=self._services,
)
try:
Expand Down Expand Up @@ -478,7 +480,9 @@ def run(
with self._status.measure("final"):
if self._use_analysis:
with self._status.measure("analysis"):
(repeat, min_results) = self.run_reliability_analysis()
(repeat, min_results) = self.run_reliability_analysis(
post_launch_delay=post_launch_delay
)
any_success = True # analysis ran and didn't raise
# multi part test cases should always use relaunch == 1
# since that can mean a delay is required
Expand Down
2 changes: 1 addition & 1 deletion src/grizzly/reduce/test_reduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def replay_run(_tests, _time_limit, **kw):
log_path,
use_harness=use_harness,
) as mgr:
repeat, min_crashes = mgr.run_reliability_analysis()
repeat, min_crashes = mgr.run_reliability_analysis(-1)

observed = {
"replay_iters": replayer.run.call_count,
Expand Down
Loading