mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-19 01:51:30 +00:00
scripts/fuzz-parser
: work around race condition from running cargo build
concurrently (#11039)
This commit is contained in:
parent
0ff25a540c
commit
fdbcb62adc
1 changed files with 11 additions and 6 deletions
|
@ -89,12 +89,17 @@ def fuzz_code(seed: Seed, only_new_bugs: bool) -> FuzzResult:
|
||||||
try:
|
try:
|
||||||
new_code = minimize_repro(code, contains_bug)
|
new_code = minimize_repro(code, contains_bug)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
# `pysource_minimize.minimize()` sometimes raises `ValueError` internally.
|
# `pysource_minimize.minimize()` failed to reproduce the bug.
|
||||||
# Just ignore it if so, and use the original generated code;
|
# This could indicate that `contains_bug()` failed due to a race condition
|
||||||
# minimizing the repro is a nice-to-have, but isn't crucial.
|
# from running `cargo build` concurrently, so double-check that the
|
||||||
new_code = code
|
# original snippet does actually reproduce the bug. If so, just go with the
|
||||||
return FuzzResult(seed, MinimizedSourceCode(new_code))
|
# original snippet; if not, report the fuzzing as successful:
|
||||||
return FuzzResult(seed, None)
|
maybe_bug = MinimizedSourceCode(code) if contains_bug(code) else None
|
||||||
|
else:
|
||||||
|
maybe_bug = MinimizedSourceCode(new_code)
|
||||||
|
else:
|
||||||
|
maybe_bug = None
|
||||||
|
return FuzzResult(seed, maybe_bug)
|
||||||
|
|
||||||
|
|
||||||
def run_fuzzer_concurrently(args: ResolvedCliArgs) -> list[FuzzResult]:
|
def run_fuzzer_concurrently(args: ResolvedCliArgs) -> list[FuzzResult]:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue