Skip to content

Commit 5b822e5

Browse files
author
me
committed
more cov
1 parent adb916f commit 5b822e5

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

.github/workflows/coverage.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
-DCMAKE_C_COMPILER=clang \
2828
-DCMAKE_CXX_COMPILER=clang++ \
2929
-DHTTP_BUILD_FUZZERS=ON
30-
cmake --build build --target request_parser response_parser --parallel
30+
cmake --build build --target request_parser response_parser sha1 --parallel
3131
3232
- name: Extract corpus
3333
run: |
@@ -36,17 +36,20 @@ jobs:
3636
- name: Run fuzzers
3737
run: |
3838
mkdir -p /tmp/corpus
39-
LLVM_PROFILE_FILE="request.profraw" ./build/request_parser /tmp/corpus/ seeds/request_parser/ -max_total_time=30
40-
LLVM_PROFILE_FILE="response.profraw" ./build/response_parser /tmp/corpus/ seeds/response_parser/ -max_total_time=30
39+
LLVM_PROFILE_FILE="request.profraw" ./build/request_parser /tmp/corpus/ seeds/request_parser/ -max_total_time=30
40+
LLVM_PROFILE_FILE="response.profraw" ./build/response_parser /tmp/corpus/ seeds/response_parser/ -max_total_time=30
41+
LLVM_PROFILE_FILE="sha1.profraw" ./build/sha1 -max_total_time=30
4142
4243
- name: Generate coverage report
4344
run: |
4445
llvm-profdata merge -o coverage.profdata \
4546
request.profraw \
46-
response.profraw
47+
response.profraw \
48+
sha1.profraw
4749
llvm-cov export -format=lcov -instr-profile coverage.profdata \
4850
-object ./build/request_parser \
4951
-object ./build/response_parser \
52+
-object ./build/sha1 \
5053
-sources ./src \
5154
> coverage_${{github.sha}}.txt
5255

examples/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,5 @@ if (HTTP_BUILD_FUZZERS)
7575

7676
add_fuzz(request_parser fuzz/request_parser.cpp)
7777
add_fuzz(response_parser fuzz/response_parser.cpp)
78+
add_fuzz(sha1 fuzz/sha1.cpp)
7879
endif()

examples/fuzz/sha1.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include <cstdint>
2+
#include <cstddef>
3+
#include <http.h>
4+
5+
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
6+
{
7+
auto sum = http::sha1{}.push(size, data).finish();
8+
return 0;
9+
}

0 commit comments

Comments
 (0)