-
Notifications
You must be signed in to change notification settings - Fork 6
Add a script to produce combined fuzzing coverage profiles. #24
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 1 commit
9054ca1
acc2b82
8240fe5
1a1ab30
8877c95
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 | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,66 @@ | ||||||
| #!/bin/bash | ||||||
| # | ||||||
| # Fetches coverage data for each fuzz test, combines them, and produces a | ||||||
| # coverage profile that can be analyzed. | ||||||
|
|
||||||
| set -e | ||||||
|
|
||||||
| if [[ "$#" -ne 1 ]]; then | ||||||
| echo "Usage: $0 LND_DIR" | ||||||
| exit 1 | ||||||
| fi | ||||||
|
|
||||||
| readonly LND_DIR=$1 | ||||||
| readonly CACHE_DIR=$(mktemp -d) | ||||||
|
|
||||||
| # Get the directory of cov_profiles.sh in case it is being called not in | ||||||
| # lnd-fuzz. | ||||||
| readonly BASE_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||||||
|
|
||||||
| readonly PACKAGES=("lnwire" "brontide" "htlcswitch/hop" "tlv" "watchtower/wtwire" "watchtower/wtclient" "zpay32") | ||||||
|
|
||||||
| # collect_combine_cov_profiles collects coverage for each fuzzing package and | ||||||
| # then combines them. | ||||||
| function collect_combine_cov_profiles { | ||||||
| local coverage_dirs=() | ||||||
|
|
||||||
| # Collect coverage profiles. | ||||||
| for p in ${PACKAGES[@]}; do | ||||||
| pushd "${BASE_DIR}/${p}/testdata/fuzz" | ||||||
|
Contributor
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. AFAICT this |
||||||
|
|
||||||
| for f in $(ls $PWD); do | ||||||
|
||||||
| for f in $(ls $PWD); do | |
| for f in ./*; do |
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.
For some reason this did not work for me
Roasbeef marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Roasbeef marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
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.
At this point I think we should do rm -r "${CACHE_DIR}/${f}" to ensure that fuzz targets with the same name will never cross-contaminate each others' corpus.
Uh oh!
There was an error while loading. Please reload this page.