From cddd8b7ba31395ca1e14e6e35e4d49d60f9af8b3 Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Tue, 19 Mar 2024 10:13:27 -0400 Subject: [PATCH] teuthology/suite: initialize lua prng using run's seed When a script may use Lua's prng, we want it to produce the same sequence during a rerun. Signed-off-by: Patrick Donnelly --- teuthology/describe_tests.py | 6 ++++-- teuthology/suite/merge.py | 3 +++ teuthology/suite/run.py | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/teuthology/describe_tests.py b/teuthology/describe_tests.py index 3ea7d71b6c..c0054adc16 100644 --- a/teuthology/describe_tests.py +++ b/teuthology/describe_tests.py @@ -137,7 +137,8 @@ def output_summary(path, limit=0, filter_in=filter_in, filter_out=filter_out, filter_all=filter_all, - filter_fragments=filter_fragments) + filter_fragments=filter_fragments, + seed=seed) for c in configs: if limit and count >= limit: break @@ -185,7 +186,8 @@ def get_combinations(suite_dir, filter_in=filter_in, filter_out=filter_out, filter_all=filter_all, - filter_fragments=filter_fragments) + filter_fragments=filter_fragments, + seed=seed) for _, fragment_paths, __ in configs: if limit > 0 and num_listed >= limit: break diff --git a/teuthology/suite/merge.py b/teuthology/suite/merge.py index 647fe6e1d5..1f8271fdc8 100644 --- a/teuthology/suite/merge.py +++ b/teuthology/suite/merge.py @@ -115,6 +115,9 @@ def config_merge(configs, suite_name=None, **kwargs): the entire job (config) from the list. """ + seed = kwargs.get('seed', 1) + log.debug("configuring Lua randomseed to %d", seed) + L.eval(f'local math = require"math"; math.randomseed({seed});') new_script = L.eval('new_script') yaml_cache = {} for desc, paths in configs: diff --git a/teuthology/suite/run.py b/teuthology/suite/run.py index b69b80b58e..bea31432ff 100644 --- a/teuthology/suite/run.py +++ b/teuthology/suite/run.py @@ -591,6 +591,7 @@ def schedule_suite(self): filter_out=self.args.filter_out, filter_all=self.args.filter_all, filter_fragments=self.args.filter_fragments, + seed=self.args.seed, suite_name=suite_name)) if self.args.dry_run: