diff --git a/.gitignore b/.gitignore index e752b94a2..fcae925db 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,6 @@ docker/generated.mk # Vim backup files. .*.swp + +# Diff files from matplotlib +*-failed-diff.png diff --git a/analysis/test_data/pairwise_unique_coverage_heatmap-failed-diff.png b/analysis/test_data/pairwise_unique_coverage_heatmap-failed-diff.png deleted file mode 100644 index 5dc618e44..000000000 Binary files a/analysis/test_data/pairwise_unique_coverage_heatmap-failed-diff.png and /dev/null differ diff --git a/experiment/measurer/coverage_utils.py b/experiment/measurer/coverage_utils.py index c6bd8bed1..c1115b9e5 100644 --- a/experiment/measurer/coverage_utils.py +++ b/experiment/measurer/coverage_utils.py @@ -150,18 +150,11 @@ def generate_coverage_summary_json(self): def generate_coverage_report(self): """Generates the coverage report and stores in bucket.""" command = [ - 'llvm-cov', - 'show', - '-format=html', + 'llvm-cov', 'show', '-no-warn', '-format=html', f'-path-equivalence=/,{self.source_files_dir}', - f'-output-dir={self.report_dir}', - '-Xdemangler', - 'c++filt', - '-Xdemangler', - '-n', - self.binary_file, - f'-instr-profile={self.merged_profdata_file}', - '-no-warn' + f'-output-dir={self.report_dir}', '-Xdemangler', 'c++filt', + '-Xdemangler', '-n', self.binary_file, + f'-instr-profile={self.merged_profdata_file}' ] result = new_process.execute(command, expect_zero=False) if result.retcode != 0: @@ -265,15 +258,9 @@ def generate_json_summary(coverage_binary, """Generates the json summary file from |coverage_binary| and |profdata_file|.""" command = [ - 'llvm-cov', - 'export', - '-format=text', - '-num-threads=1', - '-region-coverage-gt=0', - '-skip-expansions', - coverage_binary, - f'-instr-profile={profdata_file}', - '-no-warn' + 'llvm-cov', 'export', '-no-warn', '-format=text', '-num-threads=1', + '-region-coverage-gt=0', '-skip-expansions', coverage_binary, + f'-instr-profile={profdata_file}' ] if summary_only: diff --git a/experiment/measurer/measure_manager.py b/experiment/measurer/measure_manager.py index 7c16edd2f..82baf0a9d 100644 --- a/experiment/measurer/measure_manager.py +++ b/experiment/measurer/measure_manager.py @@ -16,6 +16,7 @@ import collections import gc import glob +import gzip import multiprocessing import json import os @@ -614,16 +615,28 @@ def measure_snapshot_coverage( # pylint: disable=too-many-locals # Generate profdata and transform it into json form. snapshot_measurer.generate_coverage_information(cycle) - # Save profdata snapshot. - coverage_archive_dst = exp_path.filestore( - os.path.join(snapshot_measurer.trial_dir, 'coverage', - experiment_utils.get_coverage_archive_name(cycle))) - if filestore_utils.cp(snapshot_measurer.cov_summary_file, + # Compress and save the exported profdata snapshot. + coverage_archive_zipped = os.path.join( + snapshot_measurer.trial_dir, 'coverage', + experiment_utils.get_coverage_archive_name(cycle) + '.gz') + + coverage_archive_dir = os.path.dirname(coverage_archive_zipped) + if not os.path.exists(coverage_archive_dir): + os.makedirs(coverage_archive_dir) + + with gzip.open(str(coverage_archive_zipped), 'wb') as compressed: + with open(snapshot_measurer.cov_summary_file, 'rb') as uncompressed: + compressed.write(uncompressed.read()) + + coverage_archive_dst = exp_path.filestore(coverage_archive_zipped) + if filestore_utils.cp(coverage_archive_zipped, coverage_archive_dst, expect_zero=False).retcode: snapshot_logger.warning('Coverage not found for cycle: %d.', cycle) return None + os.remove(coverage_archive_zipped) # no reason to keep this around + # Run crashes again, parse stacktraces and generate crash signatures. crashes = snapshot_measurer.process_crashes(cycle) diff --git a/experiment/measurer/test_measure_manager.py b/experiment/measurer/test_measure_manager.py index c812239ec..033736faf 100644 --- a/experiment/measurer/test_measure_manager.py +++ b/experiment/measurer/test_measure_manager.py @@ -153,11 +153,10 @@ def test_generate_summary(mocked_get_coverage_binary, mocked_execute, snapshot_measurer.generate_summary(CYCLE) expected = [ - 'llvm-cov', 'export', '-format=text', '-num-threads=1', + 'llvm-cov', 'export', '-no-warn', '-format=text', '-num-threads=1', '-region-coverage-gt=0', '-skip-expansions', '/work/coverage-binaries/benchmark-a/fuzz-target', - '-instr-profile=/reports/data.profdata', - '-no-warn' + '-instr-profile=/reports/data.profdata' ] assert (len(mocked_execute.call_args_list)) == 1 diff --git a/requirements.txt b/requirements.txt index 56b835357..ca7b933cf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -21,7 +21,7 @@ redis==4.3.4 rq==1.11.1 scikit-posthocs==0.7.0 scipy==1.9.2 -seaborn==0.12.0 +seaborn==0.13.2 sqlalchemy==1.4.41 protobuf==3.20.3