Add clusterfuzz trials config file with presubmit checks

We can now specify the trials for clusterfuzz using the file
clusterfuzz_trials_config.json. There is also a presubmit check
to make sure that it is formatted correctly.

Change-Id: Iafb7063b63b1daeb7653830542d13b419cf187d6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3416191
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Almothana Athamneh <almuthanna@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78848}
This commit is contained in:
Al Muthanna Athamina 2022-01-28 14:46:13 +01:00 committed by V8 LUCI CQ
parent d96934c741
commit 5e294b1741
4 changed files with 101 additions and 3 deletions

View File

@ -5891,6 +5891,7 @@ group("v8_clusterfuzz") {
deps = [
":d8",
":v8_simple_inspector_fuzzer",
"tools/clusterfuzz:v8_clusterfuzz_resources",
]
if (v8_multi_arch_build) {

View File

@ -23,3 +23,8 @@ if (v8_correctness_fuzzer) {
outputs = [ "$root_out_dir/{{source_file_part}}" ]
}
}
copy("v8_clusterfuzz_resources") {
sources = [ "clusterfuzz_trials_config.json" ]
outputs = [ "$root_out_dir/{{source_file_part}}" ]
}

View File

@ -2,7 +2,62 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
try:
basestring # Python 2
except NameError: # Python 3
basestring = str
def _CheckTrialsConfig(input_api, output_api):
def FilterFile(affected_file):
return input_api.FilterSourceFile(
affected_file,
files_to_check=(r'.+clusterfuzz_trials_config\.json',))
results = []
for f in input_api.AffectedFiles(
file_filter=FilterFile, include_deletes=False):
with open(f.AbsoluteLocalPath()) as j:
try:
trials = json.load(j)
for trial in trials:
if not all (k in trial for k in ('app_args', 'app_name', 'probability')):
results.append('trial %s is not configured correctly' % trial)
if trial['app_name'] != 'd8':
results.append('trial %s has an incorrect app_name' % trial)
if not isinstance(trial['probability'], float):
results.append('trial %s probability is not a float' % trial)
if not (0 <= trial['probability'] <= 1):
results.append('trial %s has invalid probability value' % trial)
if not isinstance(trial['app_args'], basestring) or not trial['app_args']:
results.append('trial %s should have a non-empty string for app_args' % trial)
except Exception as e:
results.append(
'JSON validation failed for %s. Error:\n%s' % (f.LocalPath(), e))
return [output_api.PresubmitError(r) for r in results]
def _RunTests(input_api, output_api):
return input_api.RunTests(input_api.canned_checks.GetUnitTestsInDirectory(
input_api, output_api, '.', files_to_check=['v8_foozzie_test.py$']))
def _CommonChecks(input_api, output_api):
"""Checks common to both upload and commit."""
checks = [
_CheckTrialsConfig,
_RunTests,
]
return sum([check(input_api, output_api) for check in checks], [])
def CheckChangeOnCommit(input_api, output_api):
tests = input_api.canned_checks.GetUnitTestsInDirectory(
input_api, output_api, '.', files_to_check=['v8_foozzie_test.py$'])
return input_api.RunTests(tests)
results = []
results.extend(_CommonChecks(input_api, output_api))
return results
def CheckChangeOnUpload(input_api, output_api):
results = []
results.extend(_CommonChecks(input_api, output_api))
return results

View File

@ -0,0 +1,37 @@
[
{"app_args": "--assert-types", "app_name": "d8", "probability": 0.25},
{"app_args": "--budget_for_feedback_vector_allocation=0", "app_name": "d8", "probability": 0.05},
{"app_args": "--force-slow-path", "app_name": "d8", "probability": 0.05},
{"app_args": "--future", "app_name": "d8", "probability": 0.25},
{"app_args": "--interrupt-budget=1000", "app_name": "d8", "probability": 0.25},
{"app_args": "--jitless", "app_name": "d8", "probability": 0.1},
{"app_args": "--random-gc-interval=2000", "app_name": "d8", "probability": 0.05},
{"app_args": "--noanalyze-environment-liveness", "app_name": "d8", "probability": 0.1},
{"app_args": "--no-enable-avx", "app_name": "d8", "probability": 0.1},
{"app_args": "--no-enable-bmi1", "app_name": "d8", "probability": 0.1},
{"app_args": "--no-enable-bmi2", "app_name": "d8", "probability": 0.1},
{"app_args": "--no-enable-fma3", "app_name": "d8", "probability": 0.1},
{"app_args": "--no-enable-lzcnt", "app_name": "d8", "probability": 0.1},
{"app_args": "--no-enable-popcnt", "app_name": "d8", "probability": 0.1},
{"app_args": "--no-enable-sahf", "app_name": "d8", "probability": 0.1},
{"app_args": "--no-enable-sse3", "app_name": "d8", "probability": 0.1},
{"app_args": "--no-enable-sse4_1", "app_name": "d8", "probability": 0.1},
{"app_args": "--no-enable-sse4_2", "app_name": "d8", "probability": 0.1},
{"app_args": "--no-enable-ssse3", "app_name": "d8", "probability": 0.1},
{"app_args": "--no-lazy-feedback-allocation", "app_name": "d8", "probability": 0.35},
{"app_args": "--no-regexp-tier-up", "app_name": "d8", "probability": 0.2},
{"app_args": "--no-untrusted-code-mitigations", "app_name": "d8", "probability": 0.1},
{"app_args": "--no-use-ic", "app_name": "d8", "probability": 0.25},
{"app_args": "--no-wasm-generic-wrapper", "app_name": "d8", "probability": 0.1},
{"app_args": "--regexp-interpret-all", "app_name": "d8", "probability": 0.1},
{"app_args": "--simulate-errors", "app_name": "d8", "probability": 0.001},
{"app_args": "--stress-compaction-random", "app_name": "d8", "probability": 0.05},
{"app_args": "--stress-concurrent-inlining", "app_name": "d8", "probability": 0.25},
{"app_args": "--stress-concurrent-inlining-attach-code", "app_name": "d8", "probability": 0.25},
{"app_args": "--stress-flush-code", "app_name": "d8", "probability": 0.25},
{"app_args": "--stress-marking=100", "app_name": "d8", "probability": 0.05},
{"app_args": "--stress-scavenge=100", "app_name": "d8", "probability": 0.05},
{"app_args": "--turbo-instruction-scheduling", "app_name": "d8", "probability": 0.1},
{"app_args": "--turbo-stress-instruction-scheduling", "app_name": "d8", "probability": 0.1},
{"app_args": "--wasm-code-gc --stress-wasm-code-gc", "app_name": "d8", "probability": 0.1}
]