mirror of
https://github.com/prometheus/prometheus.git
synced 2026-02-18 18:25:24 -05:00
fuzzing: fix artifact path and experimental parser flags
Fix two issues in fuzzing infrastructure: - Correct artifact upload path from promql/testdata/fuzz to util/fuzzing/testdata/fuzz to match where Go stores crash artifacts - Fix GetCorpusForFuzzParseExpr to preserve original parser flag values instead of always resetting them to false, which was disabling experimental features before actual fuzzing ran Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
This commit is contained in:
parent
4afa76d083
commit
66bb47ade6
2 changed files with 8 additions and 6 deletions
2
.github/workflows/fuzzing.yml
vendored
2
.github/workflows/fuzzing.yml
vendored
|
|
@ -29,7 +29,7 @@ jobs:
|
|||
if: failure()
|
||||
with:
|
||||
name: fuzz-artifacts-${{ matrix.fuzz_test }}
|
||||
path: promql/testdata/fuzz/${{ matrix.fuzz_test }}
|
||||
path: util/fuzzing/testdata/fuzz/${{ matrix.fuzz_test }}
|
||||
fuzzing_status:
|
||||
# This status check aggregates the individual matrix jobs of the fuzzing
|
||||
# step into a final status. Fails if a single matrix job fails, succeeds if
|
||||
|
|
|
|||
|
|
@ -58,15 +58,17 @@ func GetCorpusForFuzzParseMetricSelector() []string {
|
|||
|
||||
// GetCorpusForFuzzParseExpr returns the seed corpus for FuzzParseExpr.
|
||||
func GetCorpusForFuzzParseExpr() ([]string, error) {
|
||||
// Save original values and restore them after parsing test expressions.
|
||||
defer func(funcs, durationExpr, rangeSelectors bool) {
|
||||
parser.EnableExperimentalFunctions = funcs
|
||||
parser.ExperimentalDurationExpr = durationExpr
|
||||
parser.EnableExtendedRangeSelectors = rangeSelectors
|
||||
}(parser.EnableExperimentalFunctions, parser.ExperimentalDurationExpr, parser.EnableExtendedRangeSelectors)
|
||||
|
||||
// Enable experimental features to parse all test expressions.
|
||||
parser.EnableExperimentalFunctions = true
|
||||
parser.ExperimentalDurationExpr = true
|
||||
parser.EnableExtendedRangeSelectors = true
|
||||
defer func() {
|
||||
parser.EnableExperimentalFunctions = false
|
||||
parser.ExperimentalDurationExpr = false
|
||||
parser.EnableExtendedRangeSelectors = false
|
||||
}()
|
||||
|
||||
// Get built-in test expressions.
|
||||
builtInExprs, err := promqltest.GetBuiltInExprs()
|
||||
|
|
|
|||
Loading…
Reference in a new issue