Commit 76c57b56 authored by Michael Achenbach's avatar Michael Achenbach Committed by Commit Bot

[numfuzz] Add cpu-features extra flags to numfuzz

This combines flags switching off CPU-features randomly with all
other flags on the numfuzz fuzzers.

In a follow up we can add also other interesting flags for testing
more features.

Bug: chromium:1021463
No-Try: true
Change-Id: Ia27d1b8b82dff2bf497242b30ec0b6ef2dfd722d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1905846
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64858}
parent e465a152
......@@ -8,6 +8,29 @@ import time
from . import base
# Extra flags randomly added to all fuzz tests with numfuzz. List of tuples
# (probability, flag).
EXTRA_FLAGS = [
(0.1, '--no-enable-sse3'),
(0.1, '--no-enable-ssse3'),
(0.1, '--no-enable-sse4_1'),
(0.1, '--no-enable-sse4_2'),
(0.1, '--no-enable-sahf'),
(0.1, '--no-enable-avx'),
(0.1, '--no-enable-fma3'),
(0.1, '--no-enable-bmi1'),
(0.1, '--no-enable-bmi2'),
(0.1, '--no-enable-lzcnt'),
(0.1, '--no-enable-popcnt'),
]
def random_extra_flags(rng):
"""Returns a random list of flags chosen from the configurations in
EXTRA_FLAGS.
"""
return [flag for prob, flag in EXTRA_FLAGS if rng.random() < prob]
class FuzzerConfig(object):
def __init__(self, probability, analyzer, fuzzer):
"""
......@@ -92,7 +115,6 @@ class FuzzerProc(base.TestProcProducer):
return self._create_subtest(test, 'analysis', flags=analysis_flags,
keep_output=True)
def _result_for(self, test, subtest, result):
if not self._disable_analysis:
if result is not None:
......@@ -110,7 +132,7 @@ class FuzzerProc(base.TestProcProducer):
# analysis phase at all, so no fuzzer has it's own analyzer.
gens = []
indexes = []
for i, fuzzer_config in enumerate(self._fuzzer_configs):
for fuzzer_config in self._fuzzer_configs:
analysis_value = None
if analysis_result and fuzzer_config.analyzer:
analysis_value = fuzzer_config.analyzer.do_analysis(analysis_result)
......@@ -132,7 +154,7 @@ class FuzzerProc(base.TestProcProducer):
main_index = self._rng.choice(indexes)
_, main_gen = gens[main_index]
flags = next(main_gen)
flags = random_extra_flags(self._rng) + next(main_gen)
for index, (p, gen) in enumerate(gens):
if index == main_index:
continue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment