Exemple #1
0
def output_report(experiment_config: dict, in_progress=False):
    """Generate the HTML report and write it to |web_bucket|."""
    experiment_name = experiment_utils.get_experiment_name()
    web_filestore_path = posixpath.join(experiment_config['report_filestore'],
                                        experiment_name)

    reports_dir = get_reports_dir()

    # Don't merge with nonprivate experiments until the very end as doing it
    # while the experiment is in progress will produce unusable realtime
    # results.
    merge_with_nonprivate = (not in_progress and experiment_config.get(
        'merge_with_nonprivate', False))

    try:
        logger.debug('Generating report.')
        filesystem.recreate_directory(reports_dir)
        generate_report.generate_report(
            [experiment_name],
            str(reports_dir),
            in_progress=in_progress,
            merge_with_clobber_nonprivate=merge_with_nonprivate)
        filestore_utils.rsync(str(reports_dir),
                              web_filestore_path,
                              gsutil_options=[
                                  '-h',
                                  'Cache-Control:public,max-age=0,no-transform'
                              ])
        logger.debug('Done generating report.')
    except data_utils.EmptyDataError:
        logs.warning('No snapshot data.')
    except Exception:  # pylint: disable=broad-except
        logger.error('Error generating HTML report.')
Exemple #2
0
def output_report(experiment_config: dict,
                  in_progress=False,
                  coverage_report=False):
    """Generate the HTML report and write it to |web_bucket|."""
    experiment_name = experiment_utils.get_experiment_name()
    reports_dir = get_reports_dir()

    core_fuzzers = set(get_core_fuzzers())
    experiment_fuzzers = set(experiment_config['fuzzers'])
    fuzzers = experiment_fuzzers.union(core_fuzzers)

    # Calculate path to store report files in filestore.
    web_filestore_path = experiment_config['report_filestore']
    if not fuzzers.issubset(core_fuzzers):
        # This means that we are running an experimental report with fuzzers
        # not in the core list. So, store these in |experimental| sub-directory.
        web_filestore_path = os.path.join(web_filestore_path, 'experimental')
    web_filestore_path = posixpath.join(web_filestore_path, experiment_name)

    # Don't merge with nonprivate experiments until the very end as doing it
    # while the experiment is in progress will produce unusable realtime
    # results.
    merge_with_nonprivate = (not in_progress and experiment_config.get(
        'merge_with_nonprivate', False))

    try:
        logger.debug('Generating report.')
        filesystem.recreate_directory(reports_dir)
        generate_report.generate_report(
            [experiment_name],
            str(reports_dir),
            report_name=experiment_name,
            fuzzers=fuzzers,
            in_progress=in_progress,
            merge_with_clobber_nonprivate=merge_with_nonprivate,
            coverage_report=coverage_report)
        filestore_utils.rsync(
            str(reports_dir),
            web_filestore_path,
            delete=False,  # Don't remove existing coverage jsons.
            gsutil_options=[
                '-h', 'Cache-Control:public,max-age=0,no-transform'
            ])
        logger.debug('Done generating report.')
    except data_utils.EmptyDataError:
        logs.warning('No snapshot data.')
    except Exception:  # pylint: disable=broad-except
        logger.error('Error generating HTML report.')
Exemple #3
0
def output_report(web_bucket, in_progress=False):
    """Generate the HTML report and write it to |web_bucket|."""
    experiment_name = experiment_utils.get_experiment_name()
    reports_dir = get_reports_dir()

    try:
        logger.debug('Generating report.')
        filesystem.recreate_directory(reports_dir)
        generate_report.generate_report([experiment_name],
                                        str(reports_dir),
                                        in_progress=in_progress)
        gsutil.rsync(str(reports_dir),
                     web_bucket,
                     gsutil_options=[
                         '-h', 'Cache-Control:public,max-age=0,no-transform'
                     ])
        logger.debug('Done generating report.')
    except Exception:  # pylint: disable=broad-except
        logger.error('Error generating HTML report.')