blob: 0dcacf216bdab5fdb3c352fd1200649cc4ac02c2 [file] [log] [blame]
# Copyright 2018 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import random
# List of configuration experiments for correctness fuzzing.
# List of <probability>, <1st config name>, <2nd config name>, <2nd d8>.
# Probabilities must add up to 100.
[10, 'ignition', 'jitless', 'd8'],
[10, 'ignition', 'slow_path', 'd8'],
[5, 'ignition', 'slow_path_opt', 'd8'],
[26, 'ignition', 'ignition_turbo', 'd8'],
[2, 'ignition_no_ic', 'ignition_turbo', 'd8'],
[2, 'ignition', 'ignition_turbo_no_ic', 'd8'],
[18, 'ignition', 'ignition_turbo_opt', 'd8'],
[2, 'ignition_no_ic', 'ignition_turbo_opt', 'd8'],
[5, 'ignition_turbo_opt', 'ignition_turbo_opt', 'clang_x86/d8'],
[5, 'ignition_turbo', 'ignition_turbo', 'clang_x86/d8'],
[5, 'ignition', 'ignition', 'clang_x86/d8'],
[5, 'ignition', 'ignition', 'clang_x64_v8_arm64/d8'],
[5, 'ignition', 'ignition', 'clang_x86_v8_arm/d8'],
# Additional flag experiments. List of tuples like
# (<likelihood to use flags in [0,1)>, <flag>).
(0.1, '--stress-marking=100'),
(0.1, '--stress-scavenge=100'),
(0.1, '--stress-compaction-random'),
(0.1, '--random-gc-interval=2000'),
(0.2, '--noanalyze-environment-liveness'),
(0.1, '--stress-delay-tasks'),
(0.01, '--thread-pool-size=1'),
(0.01, '--thread-pool-size=2'),
(0.01, '--thread-pool-size=4'),
(0.01, '--thread-pool-size=8'),
(0.1, '--interrupt-budget=1000'),
class Config(object):
def __init__(self, name, rng=None, random_seed=None):
name: Name of the used fuzzer.
rng: Random number generator for generating experiments.
random_seed: Random-seed used for d8 throughout one fuzz session.
TODO(machenbach): Remove random_seed after a grace period of a couple of
days. We only have it to keep bisection stable. Afterwards we can just
use rng.
""" = name
self.rng = rng or random.Random()
self.random_seed = random_seed
def choose_foozzie_flags(self):
"""Randomly chooses a configuration from FOOZZIE_EXPERIMENTS.
Returns: List of flags to pass to fuzz harness.
# TODO(machenbach): Temporarily use same RNG state for all test cases in one
# fuzz session. See also TODO above.
if self.random_seed is not None:
flags_rng = random.Random(self.random_seed)
flags_rng = random.Random()
# Add additional flags to second config based on experiment percentages.
extra_flags = []
for p, flag in ADDITIONAL_FLAGS:
if flags_rng.random() < p:
extra_flags.append('--second-config-extra-flags=%s' % flag)
# Calculate flags determining the experiment.
acc = 0
threshold = self.rng.random() * 100
for prob, first_config, second_config, second_d8 in FOOZZIE_EXPERIMENTS:
acc += prob
if acc > threshold:
return [
'--first-config=' + first_config,
'--second-config=' + second_config,
'--second-d8=' + second_d8,
] + extra_flags
assert False