-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a target to reproduce fuzz testcase (#3553)
* Add a make target to facilitate fuzz testing locally. Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com> * missing target.... Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
- Loading branch information
1 parent
87ca7a4
commit a76a178
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// +build gofuzz | ||
|
||
package logql | ||
|
||
import ( | ||
"io/ioutil" | ||
"os" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
const fuzzTestCaseEnvName = "FUZZ_TESTCASE_PATH" | ||
|
||
func Test_Fuzz(t *testing.T) { | ||
fuzzTestPath := os.Getenv(fuzzTestCaseEnvName) | ||
data, err := ioutil.ReadFile(fuzzTestPath) | ||
require.NoError(t, err) | ||
_, _ = ParseExpr(string(data)) | ||
} |