[infra] Code Coverage: copy /usr/include headers and upload logs to GCS (follow-up #1547). (#1764)

This commit is contained in:
Max Moroz 2018-08-27 08:25:29 -07:00 committed by GitHub
parent 699e697f0f
commit c5a9204ae7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 6 deletions

View File

@ -68,7 +68,7 @@ BUILD_CMD="bash -eux $SRC/build.sh"
# We need to preserve source code files for generating a code coverage report.
# We need exact files that were compiled, so copy both $SRC and $WORK dirs.
COPY_SOURCES_CMD="cp -rL $SRC $WORK $OUT"
COPY_SOURCES_CMD="cp -rL --parents $SRC $WORK /usr/include $OUT"
if [ "${BUILD_UID-0}" -ne "0" ]; then
adduser -u $BUILD_UID --disabled-password --gecos '' builder

View File

@ -29,9 +29,7 @@ GCS_URL_BASENAME = 'https://storage.googleapis.com/'
# Where code coverage reports need to be uploaded to.
COVERAGE_BUCKET_NAME = 'oss-fuzz-coverage'
UPLOAD_FUZZER_STATS_URL_FORMAT = (
'gs://%s/{0}/fuzzer_stats/{1}' % COVERAGE_BUCKET_NAME)
UPLOAD_REPORT_URL_FORMAT = 'gs://%s/{0}/reports/{1}' % COVERAGE_BUCKET_NAME
UPLOAD_URL_FORMAT= 'gs://%s/{project}/{type}/{date}' % COVERAGE_BUCKET_NAME
def skip_build(message):
@ -151,7 +149,8 @@ def get_build_steps(project_dir):
'args': [
'-m', 'rsync', '-r', '-d',
os.path.join(out, 'report'),
UPLOAD_REPORT_URL_FORMAT.format(project_name, report_date),
UPLOAD_URL_FORMAT.format(
project=project_name, type='reports', date=report_date),
],
},
# Upload the fuzzer stats.
@ -160,7 +159,18 @@ def get_build_steps(project_dir):
'args': [
'-m', 'rsync', '-r', '-d',
os.path.join(out, 'fuzzer_stats'),
UPLOAD_FUZZER_STATS_URL_FORMAT.format(project_name, report_date),
UPLOAD_URL_FORMAT.format(
project=project_name, type='fuzzer_stats', date=report_date),
],
},
# Upload the fuzzer logs.
{
'name': 'gcr.io/cloud-builders/gsutil',
'args': [
'-m', 'rsync', '-r', '-d',
os.path.join(out, 'logs'),
UPLOAD_URL_FORMAT.format(
project=project_name, type='logs', date=report_date),
],
},
])