uploading coverage info
Hi,
I want to upload coverage info to clusterfuzz GCP.
I am following the instructions at https://google.github.io/clusterfuzz/using-clusterfuzz/advanced/code-coverage/.
i have uploaded multiple jobs on cfz but I want to upload coverage only for 1 fuzz target.
i have per fuzzer json file. I think summary.json should also be same as $fuzzer.json because I am uploading data only for one fuzzer. please clarify if I am incorrect.
i uploaded both files as mentioned
gsutil cp summary.json gs://
gsutil cp fuzz_target.json gs://
fuzz_target is the name of fuzzer.
I am little confused on how do I upload HTML report ?
"html_report_url": "https://link_to_the_main_page_of_the_report",
I am not getting of what "https://link_to_the_main_page_of_the_report" means ?
Also you have shown a example for zlib. you have considered zlib as project name. In my case the job name is libfuzzer_asan_temp and fuuzer name is fuzz_target. i am not sure which name I should pick up for project?
will it be fuzz_target or libFuzzer_fuzz_target or something else ?
Also how do i upload HTML file ? whether it should be same gsutil or something else ?
Thanks in advance.
@ravi50041 thank you for trying out this functionality and for reaching out with questions. It'll help us to improve that page / workflow.
i have per fuzzer json file. I think summary.json should also be same as $fuzzer.json because I am uploading data only for one fuzzer. please clarify if I am incorrect.
That's right.
To provide ClusterFuzz coverage information, you need to upload one file, which is called "Coverage information file" (https://google.github.io/clusterfuzz/using-clusterfuzz/advanced/code-coverage/#coverage-information-file), which would contain the following values in your case:
{
"report_date": "20200924",
"fuzzer_stats_dir": "gs:///fuzz_target/fuzzer_stats/20200924/",
"report_summary_path": "gs:///fuzz_target/reports/20200924/linux/summary.json",
"html_report_url": "https://link_to_the_main_page_of_the_report",
}
I am little confused on how do I upload HTML report ?
The html_report_url can actually point anywhere, not necessarily a file in the GCS bucket. If you want to use GCS, you need to follow the following page for setting up the bucket: https://cloud.google.com/storage/docs/hosting-static-website
And then you can upload your HTML report files using gsutil. You'll probably use gsutil -r to upload a directory.
Also you have shown a example for zlib. you have considered zlib as project name. In my case the job name is libfuzzer_asan_temp and fuuzer name is fuzz_target. i am not sure which name I should pick up for project?
There are two places where project name is specified:
- It's the name of the "coverage information file". In our example it's
zlib.json, in your case it has to beyour_project_name.json PROJECT_NAME = your_project_nam>in the job definition. If you don't specify that, the default project name from the yaml config will be used (e.g. https://github.com/google/clusterfuzz/blob/3115846993948fbd2b54c0fc96efe75b8c4f278d/configs/test/project.yaml#L65)
Action items for us to improve the docs:
- [ ] Clarify
project_namevalue
Thanks for the reply.
my fuzzing binary is fuzz_target and job name I gave was libfuzzer_asan_temp.
so I should use temp as project name to upload the coverage data right ?
also can i use any random(available preferably the coverage bucket) bucket to put index.html and point in the coverage information file instead to creating new bucket ?
After putting all data, I will see coverage info in fuzzer-statistics page right. for example edge-covearge and cov_report fields are empty as of now.
so I should use temp as project name to upload the coverage data right ?
No. The project can be specified in either job description (via PROJECT_NAME env variable) or in the project.yaml config (PROJECT_NAME as well -- it's the default project name for your ClusterFuzz instance).
also can i use any random(available preferably the coverage bucket) bucket to put index.html and point in the coverage information file instead to creating new bucket ?
Yes. It's not even necessary to be a GCS bucket. Can be a real website or any other link.
After putting all data, I will see coverage info in fuzzer-statistics page right. for example edge-covearge and cov_report fields are empty as of now.
Yes, there's a fuzzer coverage cron task that runs daily. You can run it manually from the GCP panel ("App Engine" -> "Cron Jobs" page) after putting all the data in the coverage info bucket.
will index.html be used to get data on fuzzer statistics tab(edge coverage and cov_report ?)
basically i just want cov data to be present at fuzzer statistics tab.
if i point to index.html some invalid URL like below
"html_report_url": "https://abc.com"
is it fine ?
will index.html be used to get data on fuzzer statistics tab(edge coverage and cov_report ?)
no, the link provided in html_report_url will be the link you get in the Coverage Report column on the Fuzzer Stats page. It's fine to put any value in there if you only need coverage statistics and not the visual report.