-
Notifications
You must be signed in to change notification settings - Fork 52
tests: fuzzing improvements #469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -8,7 +8,7 @@ file(GLOB_RECURSE libbpfilter_fuzz_srcs | |||||
| ${CMAKE_SOURCE_DIR}/src/libbpfilter/*.h ${CMAKE_SOURCE_DIR}/src/libbpfilter/*.c | ||||||
| ) | ||||||
|
|
||||||
| add_executable(fuzz_parser | ||||||
| add_executable(fuzz_parser EXCLUDE_FROM_ALL | ||||||
| ${CMAKE_CURRENT_SOURCE_DIR}/fuzz_parser.c | ||||||
| ${CMAKE_SOURCE_DIR}/src/bfcli/helper.c | ||||||
| ${CMAKE_SOURCE_DIR}/src/bfcli/ruleset.c | ||||||
|
|
@@ -57,7 +57,7 @@ add_dependencies(fuzz_parser bfcli_parser bfcli_lexer) | |||||
| file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/corpus) | ||||||
| file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findings) | ||||||
|
|
||||||
| add_test(NAME "fuzzing.parser" | ||||||
| add_test(NAME "fuzzing.parser.60" | ||||||
| COMMAND $<TARGET_FILE:fuzz_parser> | ||||||
| -artifact_prefix=${CMAKE_CURRENT_BINARY_DIR}/findings/ | ||||||
| -max_total_time=60 | ||||||
|
|
@@ -70,13 +70,36 @@ add_test(NAME "fuzzing.parser" | |||||
| ${CMAKE_CURRENT_SOURCE_DIR}/corpus | ||||||
| ) | ||||||
|
|
||||||
| set_tests_properties("fuzzing.parser.60" PROPERTIES | ||||||
| LABELS "fuzzing" | ||||||
| ENVIRONMENT "ROOT_DIR=${CMAKE_SOURCE_DIR};BUILD_DIR=${CMAKE_BINARY_DIR};GEN_INC_DIR=${lib_gen_inc_dir}/include" | ||||||
| ) | ||||||
|
|
||||||
| add_custom_target(fuzzing_quick | ||||||
| COMMAND ${CMAKE_CTEST_COMMAND} --verbose -R "fuzzing.parser.60" | ||||||
| DEPENDS fuzz_parser | ||||||
| COMMENT "Running fuzzing tests" | ||||||
| ) | ||||||
|
|
||||||
| add_test(NAME "fuzzing.parser" | ||||||
| COMMAND $<TARGET_FILE:fuzz_parser> | ||||||
| -artifact_prefix=${CMAKE_CURRENT_BINARY_DIR}/findings/ | ||||||
| -print_final_stats=1 | ||||||
| -only_ascii=1 | ||||||
| -close_fd_mask=3 | ||||||
| -dict=${CMAKE_CURRENT_SOURCE_DIR}/keywords.dict | ||||||
| -max_len=16384 | ||||||
| ${CMAKE_CURRENT_BINARY_DIR}/corpus | ||||||
| ${CMAKE_CURRENT_SOURCE_DIR}/corpus | ||||||
| ) | ||||||
|
|
||||||
| set_tests_properties("fuzzing.parser" PROPERTIES | ||||||
| LABELS "fuzzing" | ||||||
| ENVIRONMENT "ROOT_DIR=${CMAKE_SOURCE_DIR};BUILD_DIR=${CMAKE_BINARY_DIR};GEN_INC_DIR=${lib_gen_inc_dir}/include" | ||||||
| ) | ||||||
|
|
||||||
| add_custom_target(fuzzing | ||||||
| COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -L fuzzing | ||||||
| COMMAND ${CMAKE_CTEST_COMMAND} --verbose -R "fuzzing.parser" | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Claude: Consider anchoring the regex:
Suggested change
( Alternatively, rename the indefinite test to something that isn't a prefix of the other, e.g. |
||||||
| DEPENDS fuzz_parser | ||||||
| COMMENT "Running fuzzing tests" | ||||||
| ) | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Claude: Minor consistency note — the other CI test steps use label-based selection (
-L unit,-L e2e), while this now uses regex (-R). This works in practice, but the unescaped.characters are regex wildcards. For robustness you could escape them or keep using-L: