[foozzie] Migrate extra-flags generation to clusterfuzz side

NOTRY=true

Bug: chromium:813833,chromium:983128
Change-Id: I449796b761f53bb15a3563604d5a4a9018035cb6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1697255
Reviewed-by: Tamer Tas <tmrts@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62662}
This commit is contained in:
Michael Achenbach 2019-07-11 16:12:06 +02:00 committed by Commit Bot
parent 4786c5c8f1
commit ccd3747222
5 changed files with 36 additions and 28 deletions

View File

@ -11,7 +11,7 @@
# Flags of x64,ignition:
--correctness-fuzzer-suppressions --expose-gc --allow-natives-syntax --invoke-weak-callbacks --omit-quit --es-staging --no-wasm-async-compilation --suppress-asm-messages --random-seed 12345 --turbo-filter=~ --noopt --liftoff --no-wasm-tier-up --flag1 --flag2=0
# Flags of x64,ignition_turbo:
--correctness-fuzzer-suppressions --expose-gc --allow-natives-syntax --invoke-weak-callbacks --omit-quit --es-staging --no-wasm-async-compilation --suppress-asm-messages --random-seed 12345 --flag3 --stress-scavenge=100
--correctness-fuzzer-suppressions --expose-gc --allow-natives-syntax --invoke-weak-callbacks --omit-quit --es-staging --no-wasm-async-compilation --suppress-asm-messages --random-seed 12345 --flag3
#
# Difference:
- unknown

View File

@ -11,7 +11,7 @@
# Flags of x64,ignition:
--correctness-fuzzer-suppressions --expose-gc --allow-natives-syntax --invoke-weak-callbacks --omit-quit --es-staging --no-wasm-async-compilation --suppress-asm-messages --random-seed 12345 --turbo-filter=~ --noopt --liftoff --no-wasm-tier-up
# Flags of x64,ignition_turbo:
--correctness-fuzzer-suppressions --expose-gc --allow-natives-syntax --invoke-weak-callbacks --omit-quit --es-staging --no-wasm-async-compilation --suppress-asm-messages --random-seed 12345 --stress-scavenge=100
--correctness-fuzzer-suppressions --expose-gc --allow-natives-syntax --invoke-weak-callbacks --omit-quit --es-staging --no-wasm-async-compilation --suppress-asm-messages --random-seed 12345
#
# Difference:
- unknown

View File

@ -88,22 +88,6 @@ CONFIGS = dict(
],
)
# Additional flag experiments. List of tuples like
# (<likelihood to use flags in [0,1)>, <flag>).
ADDITIONAL_FLAGS = [
(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'),
]
# Timeout in seconds for one d8 run.
TIMEOUT = 3
@ -316,7 +300,6 @@ def print_difference(
def main():
options = parse_args()
rng = random.Random(options.random_seed)
# Suppressions are architecture and configuration specific.
suppress = v8_suppressions.get_suppression(
@ -339,13 +322,6 @@ def main():
second_config_flags = (common_flags + CONFIGS[options.second_config] +
options.second_config_extra_flags)
# TODO(machenbach): Deprecate calculating flag experiements in this script
# and instead pass flags as extra flags on command line.
# Add additional flags to second config based on experiment percentages.
for p, flag in ADDITIONAL_FLAGS:
if rng.random() < p:
second_config_flags.append(flag)
def run_d8(d8, config_flags, config_label=None, testcase=options.testcase):
preamble = PREAMBLE[:]
if options.first_arch != options.second_arch:

View File

@ -41,8 +41,9 @@ class ConfigTest(unittest.TestCase):
'--first-config=ignition',
'--second-config=ignition_turbo',
'--second-d8=d8',
'--second-config-extra-flags=--stress-scavenge=100',
],
v8_fuzz_config.Config('foo', Rng()).choose_foozzie_flags(),
v8_fuzz_config.Config('foo', Rng(), 42).choose_foozzie_flags(),
)

View File

@ -23,6 +23,22 @@ FOOZZIE_EXPERIMENTS = [
[5, 'ignition', 'ignition', 'clang_x86_v8_arm/d8'],
]
# Additional flag experiments. List of tuples like
# (<likelihood to use flags in [0,1)>, <flag>).
ADDITIONAL_FLAGS = [
(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):
"""
@ -36,12 +52,27 @@ class Config(object):
"""
self.name = 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 v8_foozzie.py 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)
else:
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:
@ -51,5 +82,5 @@ class Config(object):
'--first-config=' + first_config,
'--second-config=' + second_config,
'--second-d8=' + second_d8,
]
] + extra_flags
assert False