[dvsim] Added --fixed-seed switch - Added a --fixed-seed <integer> switch that will fix the seed value to be used for running ALL tests. - Setting this option on the command line will enforce --reseed 1, since there is no point in running multiple seeds. Signed-off-by: Srikrishna Iyer <sriyer@google.com>
diff --git a/util/dvsim/Deploy.py b/util/dvsim/Deploy.py index c4c21ed..aba91e8 100644 --- a/util/dvsim/Deploy.py +++ b/util/dvsim/Deploy.py
@@ -537,6 +537,7 @@ # Initial seed values when running tests (if available). seeds = [] + fixed_seed = None # Register all runs with the class items = [] @@ -609,7 +610,11 @@ @staticmethod def get_seed(): + # If --seeds option is passed, then those custom seeds are consumed + # first. If --fixed-seed <val> is also passed, the subsequent tests + # (once the custom seeds are consumed) will be run with the fixed seed. if not RunTest.seeds: + if RunTest.fixed_seed: return RunTest.fixed_seed for i in range(1000): seed = random.getrandbits(32) RunTest.seeds.append(seed)