index int64 0 50.7k | project_path stringclasses 279
values | completion_path stringlengths 57 199 | signature_postion stringlengths 3 11 | class_position stringlengths 3 11 | function_name stringlengths 1 62 | class_name stringlengths 0 55 | body_position stringlengths 3 11 | body_position_with_comments stringlengths 3 11 | masked_class stringlengths 14 8.32k | masked_class_with_comment stringlengths 14 8.32k | func_body stringlengths 9 6.72k | func_body_with_comment stringlengths 9 6.72k | len_func_body int64 1 643 | len_input int64 10 2.02k | len_output int64 4 1.9k | total int64 20 2.05k | file_code stringlengths 14 442k | file_code_with_comment stringlengths 14 442k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
46,784 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/measurer/test_measure_manager.py | 285,289 | 280,341 | test_measure_snapshot_coverage | TestIntegrationMeasurement | 290,341 | 289,341 | class TestIntegrationMeasurement:
"""Integration tests for measurement."""
# TODO(metzman): Get this test working everywhere by using docker or a more
# portable binary.
@pytest.mark.skipif(not os.getenv('FUZZBENCH_TEST_INTEGRATION'),
reason='Not running integration tests.')
... | class TestIntegrationMeasurement:
"""Integration tests for measurement."""
# TODO(metzman): Get this test working everywhere by using docker or a more
# portable binary.
@pytest.mark.skipif(not os.getenv('FUZZBENCH_TEST_INTEGRATION'),
reason='Not running integration tests.')
... | # WORK is set by experiment to a directory that only makes sense in a
# fakefs. A directory containing necessary llvm tools is also added to
# PATH.
llvm_tools_path = get_test_data_path('llvm_tools')
os.environ['PATH'] += os.pathsep + llvm_tools_path
os.environ['WORK'] = ... | """Integration test for measure_snapshot_coverage."""
# WORK is set by experiment to a directory that only makes sense in a
# fakefs. A directory containing necessary llvm tools is also added to
# PATH.
llvm_tools_path = get_test_data_path('llvm_tools')
os.environ['PATH']... | 161 | 150 | 753 | 903 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,785 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/measurer/test_run_coverage.py | 47,48 | 1,107 | _assert_profraw_files | 49,56 | 48,56 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | pattern = coverage_dir
if not pattern.endswith('/'):
pattern += '/'
pattern += '*.profraw'
assert glob.glob(pattern)
| """Ensure |coverage_dir| has profraw files."""
pattern = coverage_dir
if not pattern.endswith('/'):
pattern += '/'
pattern += '*.profraw'
assert glob.glob(pattern)
| 14 | 1,300 | 53 | 1,353 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,786 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/measurer/test_run_coverage.py | 63,64 | 56,107 | test_integration_do_coverage_run_crash | TestIntegrationRunCoverage | 65,78 | 64,78 | @pytest.mark.skipif(not os.getenv('FUZZBENCH_TEST_INTEGRATION'),
reason='Not running integration tests.')
class TestIntegrationRunCoverage:
"""Integration tests for run_coverage.py"""
COVERAGE_BINARY_PATH = os.path.join(TEST_DATA_PATH, 'fuzz-target-clang-cov')
def test_integration_do_c... | @pytest.mark.skipif(not os.getenv('FUZZBENCH_TEST_INTEGRATION'),
reason='Not running integration tests.')
class TestIntegrationRunCoverage:
"""Integration tests for run_coverage.py"""
COVERAGE_BINARY_PATH = os.path.join(TEST_DATA_PATH, 'fuzz-target-clang-cov')
def test_integration_do_c... | units = _get_test_data_dir('crash-corpus')
coverage_dir = _make_coverage_dir(tmp_path)
profraw_file = os.path.join(coverage_dir, 'test_crash.profraw')
crashes_dir = _make_crashes_dir(tmp_path)
run_coverage.do_coverage_run(self.COVERAGE_BINARY_PATH, units,
... | """Test that do_coverage_run returns crashing inputs."""
units = _get_test_data_dir('crash-corpus')
coverage_dir = _make_coverage_dir(tmp_path)
profraw_file = os.path.join(coverage_dir, 'test_crash.profraw')
crashes_dir = _make_crashes_dir(tmp_path)
run_coverage.do_covera... | 31 | 620 | 225 | 845 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,787 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/measurer/test_run_crashes.py | 65,66 | 1,74 | test_filter_crash_state | 67,74 | 66,74 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | assert (run_crashes._filter_crash_state(
'Segv on unknown address:int* std::__1::fill_n<int*, long, int>\n'
'int arrow::util::RleDecoder::GetBatchWithDict<int>\n'
'parquet::DictDecoderImpl<parquet::PhysicalType<\n') ==
'Segv on unknown address:int* std::__1::fill_n\n'
... | """Tests _filter_crash_state."""
assert (run_crashes._filter_crash_state(
'Segv on unknown address:int* std::__1::fill_n<int*, long, int>\n'
'int arrow::util::RleDecoder::GetBatchWithDict<int>\n'
'parquet::DictDecoderImpl<parquet::PhysicalType<\n') ==
'Segv on unknown address... | 21 | 837 | 156 | 993 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,788 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/measurer/test_run_crashes.py | 33,34 | 26,55 | test_integration_do_coverage_run_crash | TestIntegrationRunCoverage | 35,55 | 34,55 | @pytest.mark.skipif(not os.getenv('FUZZBENCH_TEST_INTEGRATION'),
reason='Not running integration tests.')
class TestIntegrationRunCoverage:
"""Integration tests for run_crashes.py"""
APP_BINARY_PATH = os.path.join(TEST_DATA_PATH, 'fuzz-target')
def test_integration_do_coverage_run_cras... | @pytest.mark.skipif(not os.getenv('FUZZBENCH_TEST_INTEGRATION'),
reason='Not running integration tests.')
class TestIntegrationRunCoverage:
"""Integration tests for run_crashes.py"""
APP_BINARY_PATH = os.path.join(TEST_DATA_PATH, 'fuzz-target')
def test_integration_do_coverage_run_cras... | llvm_tools_path = os.path.abspath(
os.path.join(TEST_DATA_PATH, '..', 'llvm_tools'))
os.environ['PATH'] = llvm_tools_path + os.pathsep + os.environ['PATH']
crashes_dir = os.path.join(TEST_DATA_PATH, 'crash-corpus')
crashes = run_crashes.do_crashes_run(self.APP_BINARY_PATH, c... | """Test that do_coverage_run returns crashing inputs."""
llvm_tools_path = os.path.abspath(
os.path.join(TEST_DATA_PATH, '..', 'llvm_tools'))
os.environ['PATH'] = llvm_tools_path + os.pathsep + os.environ['PATH']
crashes_dir = os.path.join(TEST_DATA_PATH, 'crash-corpus')
... | 61 | 142 | 323 | 465 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,789 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/reporter.py | 45,48 | 1,97 | output_report | 49,97 | 48,97 | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | 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_f... | """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)
... | 153 | 460 | 690 | 1,150 | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | |
46,790 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/reproduce_experiment.py | 24,25 | 1,73 | validate_config | 28,39 | 25,39 | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | if 'benchmarks' not in config:
raise Exception('Must specify benchmarks, are you sure this is the'
'config file created by fuzzbench and not the one '
'you created?')
if 'fuzzers' not in config:
raise Exception('Must specify fuzzers, are you sure ... | """Quickly validates the config. We only do this because it is confusing
that FuzzBench internally creates another config file that is supposed to be
used to reproduce experiments."""
if 'benchmarks' not in config:
raise Exception('Must specify benchmarks, are you sure this is the'
... | 54 | 578 | 116 | 694 | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | |
46,792 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/run_experiment.py | 456,457 | 448,461 | start | BaseDispatcher | 458,461 | 457,461 | class BaseDispatcher:
"""Class representing the dispatcher."""
def __init__(self, config: Dict):
self.config = config
self.instance_name = experiment_utils.get_dispatcher_instance_name(
config['experiment'])
def start(self):
FILL_FUNC_BODY | class BaseDispatcher:
"""Class representing the dispatcher."""
def __init__(self, config: Dict):
self.config = config
self.instance_name = experiment_utils.get_dispatcher_instance_name(
config['experiment'])
def start(self):
"""Start the experiment on the dispatcher."""... | raise NotImplementedError
| """Start the experiment on the dispatcher."""
raise NotImplementedError
| 2 | 93 | 13 | 106 | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
46,793 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/run_experiment.py | 598,599 | 553,605 | write_startup_script | GoogleCloudDispatcher | 600,605 | 599,605 | class GoogleCloudDispatcher(BaseDispatcher):
"""Class representing the dispatcher instance on Google Cloud."""
def start(self):
"""Start the experiment on the dispatcher."""
with tempfile.NamedTemporaryFile(dir=os.getcwd(),
mode='w') as startup_script:
... | class GoogleCloudDispatcher(BaseDispatcher):
"""Class representing the dispatcher instance on Google Cloud."""
def start(self):
"""Start the experiment on the dispatcher."""
with tempfile.NamedTemporaryFile(dir=os.getcwd(),
mode='w') as startup_script:
... | startup_script = self._render_startup_script()
startup_script_file.write(startup_script)
startup_script_file.flush()
| """Get the startup script to start the experiment on the dispatcher."""
startup_script = self._render_startup_script()
startup_script_file.write(startup_script)
startup_script_file.flush()
| 5 | 599 | 47 | 646 | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
46,794 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/run_experiment.py | 468,469 | 461,553 | start | LocalDispatcher | 470,553 | 469,553 | class LocalDispatcher(BaseDispatcher):
"""Class representing the local dispatcher."""
def __init__(self, config: Dict):
super().__init__(config)
self.process = None
def start(self):
FILL_FUNC_BODY | class LocalDispatcher(BaseDispatcher):
"""Class representing the local dispatcher."""
def __init__(self, config: Dict):
super().__init__(config)
self.process = None
def start(self):
"""Start the experiment on the dispatcher."""
FILL_FUNC_BODY | container_name = 'dispatcher-container'
experiment_filestore_path = os.path.abspath(
self.config['experiment_filestore'])
filesystem.create_directory(experiment_filestore_path)
sql_database_arg = (
'SQL_DATABASE_URL=sqlite:///'
f'{os.path.join(experime... | """Start the experiment on the dispatcher."""
container_name = 'dispatcher-container'
experiment_filestore_path = os.path.abspath(
self.config['experiment_filestore'])
filesystem.create_directory(experiment_filestore_path)
sql_database_arg = (
'SQL_DATABAS... | 166 | 79 | 1,130 | 1,209 | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
46,797 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/schedule_measure_workers.py | 54,55 | 1,160 | initialize | 56,91 | 55,91 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | logger.info('Initializing worker scheduling.')
gce.initialize()
experiment = experiment_config['experiment']
project = experiment_config['project']
instance_template_name = get_measure_worker_instance_template_name(
experiment)
docker_image = posixpath.join(experiment_config['docker_regi... | """Initialize everything that will be needed to schedule measurers."""
logger.info('Initializing worker scheduling.')
gce.initialize()
experiment = experiment_config['experiment']
project = experiment_config['project']
instance_template_name = get_measure_worker_instance_template_name(
e... | 71 | 1,286 | 447 | 1,733 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,800 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/stop_experiment.py | 28,29 | 1,78 | stop_experiment | 30,67 | 29,67 | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | experiment_config = yaml_utils.read(experiment_config_filename)
if experiment_config.get('local_experiment', False):
raise NotImplementedError(
'Local experiment stop logic is not implemented.')
logger.info('Stopping experiment.')
cloud_project = experiment_config['cloud_project']
... | """Stop the experiment specified by |experiment_config_filename|."""
experiment_config = yaml_utils.read(experiment_config_filename)
if experiment_config.get('local_experiment', False):
raise NotImplementedError(
'Local experiment stop logic is not implemented.')
logger.info('Stoppi... | 92 | 389 | 400 | 789 | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | |
46,802 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/test_reporter.py | 41,61 | 1,86 | test_output_report_filestore | 63,86 | 61,86 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | experiment_config = _setup_experiment_files(fs)
experiment_config['fuzzers'] = experiment_fuzzers
experiment_benchmarks = set(experiment_config['benchmarks'])
with test_utils.mock_popen_ctx_mgr() as mocked_popen:
with mock.patch('analysis.generate_report.generate_report'
... | """Test that output_report writes the report and rsyncs it to the report
filestore."""
experiment_config = _setup_experiment_files(fs)
experiment_config['fuzzers'] = experiment_fuzzers
experiment_benchmarks = set(experiment_config['benchmarks'])
with test_utils.mock_popen_ctx_mgr() as mocked_po... | 47 | 760 | 338 | 1,098 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,804 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/test_run_experiment.py | 84,86 | 45,177 | test_missing_required_cloud | TestReadAndValdiateExperimentConfig | 88,104 | 86,104 | class TestReadAndValdiateExperimentConfig(unittest.TestCase):
"""Tests for read_and_validate_experiment_config."""
def setUp(self):
self.config_filename = 'config'
self.config = {
'experiment_filestore':
'gs://bucket',
'report_filestore':
... | class TestReadAndValdiateExperimentConfig(unittest.TestCase):
"""Tests for read_and_validate_experiment_config."""
def setUp(self):
self.config_filename = 'config'
self.config = {
'experiment_filestore':
'gs://bucket',
'report_filestore':
... | # All but each cloud_param defined in run_experiment.py.
cloud_params = {
'cloud_compute_zone', 'cloud_project', 'worker_pool_name'
}
for cloud_param in cloud_params:
test_config = self.config.copy()
del test_config[cloud_param]
with mock.p... | """Tests that an error is logged when the config file is missing a
required cloudconfig parameter."""
# All but each cloud_param defined in run_experiment.py.
cloud_params = {
'cloud_compute_zone', 'cloud_project', 'worker_pool_name'
}
for cloud_param in cloud... | 44 | 1,497 | 216 | 1,713 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,806 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/test_runner.py | 71,73 | 67,77 | get_stats | FuzzerAModule | 74,77 | 73,77 | class FuzzerAModule:
"""A fake fuzzer.py module that impolements get_stats."""
DEFAULT_STATS = '{"execs_per_sec":20.0}'
@staticmethod
def get_stats(output_directory, log_filename):
FILL_FUNC_BODY | class FuzzerAModule:
"""A fake fuzzer.py module that impolements get_stats."""
DEFAULT_STATS = '{"execs_per_sec":20.0}'
@staticmethod
def get_stats(output_directory, log_filename):
"""Returns a stats string."""
FILL_FUNC_BODY | return FuzzerAModule.DEFAULT_STATS
| """Returns a stats string."""
return FuzzerAModule.DEFAULT_STATS
| 2 | 88 | 19 | 107 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,807 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/test_runner.py | 145,147 | 142,150 | get_stats | FuzzerAModuleCustomGetStats | 148,150 | 147,150 | class FuzzerAModuleCustomGetStats:
"""Fake fuzzer.py that implements get_stats."""
@staticmethod
def get_stats(output_directory, log_filename):
FILL_FUNC_BODY | class FuzzerAModuleCustomGetStats:
"""Fake fuzzer.py that implements get_stats."""
@staticmethod
def get_stats(output_directory, log_filename):
"""Fake get_stats method that returns stats_data."""
FILL_FUNC_BODY | return stats_data
| """Fake get_stats method that returns stats_data."""
return stats_data
| 2 | 75 | 9 | 84 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,808 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/test_runner.py | 170,172 | 167,175 | get_stats | FuzzerAModuleGetStatsException | 173,175 | 172,175 | class FuzzerAModuleGetStatsException:
"""Fake fuzzer.py module that exceptions when get_stats is called."""
@staticmethod
def get_stats(output_directory, log_filename):
FILL_FUNC_BODY | class FuzzerAModuleGetStatsException:
"""Fake fuzzer.py module that exceptions when get_stats is called."""
@staticmethod
def get_stats(output_directory, log_filename):
"""Fake get_stats method that exceptions when called."""
FILL_FUNC_BODY | raise Exception()
| """Fake get_stats method that exceptions when called."""
raise Exception()
| 2 | 78 | 8 | 86 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,809 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/test_runner.py | 275,280 | 272,357 | test_integration_runner | TestIntegrationRunner | 280,357 | 280,357 | class TestIntegrationRunner:
"""Integration tests for the runner."""
@pytest.mark.skipif(not os.environ.get('TEST_EXPERIMENT_FILESTORE'),
reason='TEST_EXPERIMENT_FILESTORE is not set, '
'skipping integration test.')
@mock.patch('common.logs.error')
def te... | class TestIntegrationRunner:
"""Integration tests for the runner."""
@pytest.mark.skipif(not os.environ.get('TEST_EXPERIMENT_FILESTORE'),
reason='TEST_EXPERIMENT_FILESTORE is not set, '
'skipping integration test.')
@mock.patch('common.logs.error')
def te... | # pylint: disable=too-many-locals
"""Test that runner can run libFuzzer and saves snapshots to GCS."""
# Switch cwd so that fuzzers don't create tons of files in the repo.
os.chdir(tmp_path)
# Set env variables that would be set by the Dockerfile.
file_directory = pathli... | # pylint: disable=too-many-locals
"""Test that runner can run libFuzzer and saves snapshots to GCS."""
# Switch cwd so that fuzzers don't create tons of files in the repo.
os.chdir(tmp_path)
# Set env variables that would be set by the Dockerfile.
file_directory = pathli... | 220 | 127 | 1,130 | 1,257 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,810 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/experiment/test_runner.py | 420,421 | 402,437 | test_unpack_clusterfuzz_seed_corpus | TestUnpackClusterFuzzSeedCorpusIfNeeded | 422,437 | 421,437 | class TestUnpackClusterFuzzSeedCorpusIfNeeded:
"""Tests for _unpack_clusterfuzz_seed_corpus."""
CORPUS_DIRECTORY = '/corpus'
def _unpack_clusterfuzz_seed_corpus(self, fuzz_target_path):
return runner._unpack_clusterfuzz_seed_corpus( # pylint: disable=protected-access
fuzz_target_path, ... | class TestUnpackClusterFuzzSeedCorpusIfNeeded:
"""Tests for _unpack_clusterfuzz_seed_corpus."""
CORPUS_DIRECTORY = '/corpus'
def _unpack_clusterfuzz_seed_corpus(self, fuzz_target_path):
return runner._unpack_clusterfuzz_seed_corpus( # pylint: disable=protected-access
fuzz_target_path, ... | fs.create_dir(self.CORPUS_DIRECTORY)
fuzz_target_directory = os.path.join(
os.path.dirname(os.path.abspath(__file__)), 'test_data',
'test_runner')
seed_corpus_path = os.path.join(fuzz_target_directory,
'fuzz-target_seed_corpus.zip')... | """Tests unpack_clusterfuzz_seed_corpus can unpack a seed corpus."""
fs.create_dir(self.CORPUS_DIRECTORY)
fuzz_target_directory = os.path.join(
os.path.dirname(os.path.abspath(__file__)), 'test_data',
'test_runner')
seed_corpus_path = os.path.join(fuzz_target_dire... | 27 | 324 | 308 | 632 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,812 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzbench/jobs.py | 22,23 | 1,46 | build_image | 24,38 | 23,38 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | image_tag = os.path.join(BASE_TAG, image['tag'])
subprocess.run(['docker', 'pull', image_tag], check=True)
command = ['docker', 'build', '--tag', image_tag, image['context']]
cpu_options = ['--cpu-period', '100000', '--cpu-quota', '100000']
command.extend(cpu_options)
if 'dockerfile' in image:
... | """Builds a Docker image and returns whether it succeeds."""
image_tag = os.path.join(BASE_TAG, image['tag'])
subprocess.run(['docker', 'pull', image_tag], check=True)
command = ['docker', 'build', '--tag', image_tag, image['context']]
cpu_options = ['--cpu-period', '100000', '--cpu-quota', '100000'... | 42 | 270 | 203 | 473 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,813 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzbench/run_experiment.py | 26,27 | 1,82 | run_experiment | 28,67 | 27,67 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | print('Initializing the job queue.')
# Create the queue for scheduling build jobs and run jobs.
queue = rq.Queue('build_n_run_queue')
images_to_build = docker_images.get_images_to_build(config['fuzzers'],
config['benchmarks'])
jobs_list = []
... | """Main experiment logic."""
print('Initializing the job queue.')
# Create the queue for scheduling build jobs and run jobs.
queue = rq.Queue('build_n_run_queue')
images_to_build = docker_images.get_images_to_build(config['fuzzers'],
config['b... | 114 | 380 | 526 | 906 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,814 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzbench/worker.py | 21,22 | 1,35 | main | 23,33 | 22,33 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | redis_connection = redis.Redis(host='queue-server')
with rq.Connection(redis_connection):
queue = rq.Queue('build_n_run_queue')
worker = rq.Worker([queue])
while queue.count + queue.deferred_job_registry.count > 0:
worker.work(burst=True)
time.sleep(5)
| """Sets up Redis connection and starts the worker."""
redis_connection = redis.Redis(host='queue-server')
with rq.Connection(redis_connection):
queue = rq.Queue('build_n_run_queue')
worker = rq.Worker([queue])
while queue.count + queue.deferred_job_registry.count > 0:
wo... | 19 | 218 | 114 | 332 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,815 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/afl/fuzzer.py | 66,67 | 1,142 | prepare_fuzz_environment | 68,87 | 67,87 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Tell AFL to not use its terminal UI so we get usable logs.
os.environ['AFL_NO_UI'] = '1'
# Skip AFL's CPU frequency check (fails on Docker).
os.environ['AFL_SKIP_CPUFREQ'] = '1'
# No need to bind affinity to one core, Docker enforces 1 core usage.
os.environ['AFL_NO_AFFINITY'] = '1'
# AFL ... | """Prepare to fuzz with AFL or another AFL-based fuzzer."""
# Tell AFL to not use its terminal UI so we get usable logs.
os.environ['AFL_NO_UI'] = '1'
# Skip AFL's CPU frequency check (fails on Docker).
os.environ['AFL_SKIP_CPUFREQ'] = '1'
# No need to bind affinity to one core, Docker enforces ... | 108 | 1,368 | 329 | 1,697 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,816 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/afl_2_52_b/fuzzer.py | 85,86 | 1,140 | check_skip_det_compatible | 87,94 | 86,94 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # AFL refuses to take in '-d' with '-M' or '-S' options for parallel mode.
# (cf. https://github.com/google/AFL/blob/8da80951/afl-fuzz.c#L7477)
if '-M' in additional_flags or '-S' in additional_flags:
return False
return True
| """ Checks if additional flags are compatible with '-d' option"""
# AFL refuses to take in '-d' with '-M' or '-S' options for parallel mode.
# (cf. https://github.com/google/AFL/blob/8da80951/afl-fuzz.c#L7477)
if '-M' in additional_flags or '-S' in additional_flags:
return False
return True
... | 30 | 1,549 | 103 | 1,652 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,817 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/afl_qemu/fuzzer.py | 25,26 | 1,33 | fuzz | 27,33 | 26,33 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Necessary fuzzer options.
flags = ['-Q']
aflplusplus_fuzzer.fuzz(input_corpus,
output_corpus,
target_binary,
flags=flags)
| """Run fuzzer."""
# Necessary fuzzer options.
flags = ['-Q']
aflplusplus_fuzzer.fuzz(input_corpus,
output_corpus,
target_binary,
flags=flags)
| 11 | 282 | 65 | 347 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,818 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/afl_random_favored/fuzzer.py | 47,48 | 1,139 | get_stats | 49,63 | 48,63 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Get a dictionary containing the stats AFL reports.
stats_file = os.path.join(output_corpus, 'fuzzer_stats')
with open(stats_file, encoding='utf-8') as file_handle:
stats_file_lines = file_handle.read().splitlines()
stats_file_dict = {}
for stats_line in stats_file_lines:
key, value... | """Gets fuzzer stats for AFL."""
# Get a dictionary containing the stats AFL reports.
stats_file = os.path.join(output_corpus, 'fuzzer_stats')
with open(stats_file, encoding='utf-8') as file_handle:
stats_file_lines = file_handle.read().splitlines()
stats_file_dict = {}
for stats_line in... | 50 | 1,458 | 200 | 1,658 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,819 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/afl_virginmap/fuzzer.py | 93,98 | 1,139 | run_afl_fuzz | 99,134 | 98,134 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Spawn the afl fuzzing process.
print('[run_afl_fuzz] Running target with afl-fuzz')
command = [
'./afl-fuzz',
'-i',
input_corpus,
'-o',
output_corpus,
# Use no memory limit as ASAN doesn't play nicely with one.
'-m',
'none',
'-t',
... | """Run afl-fuzz."""
# Spawn the afl fuzzing process.
print('[run_afl_fuzz] Running target with afl-fuzz')
command = [
'./afl-fuzz',
'-i',
input_corpus,
'-o',
output_corpus,
# Use no memory limit as ASAN doesn't play nicely with one.
'-m',
'... | 121 | 1,265 | 414 | 1,679 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,821 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/aflfast/fuzzer.py | 24,25 | 1,35 | fuzz | 26,35 | 25,35 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | afl_fuzzer.prepare_fuzz_environment(input_corpus)
# Write AFL's output to /dev/null to avoid filling up disk by writing too
# much to log file. This is a problem in general with AFLFast but
# particularly with the lcms benchmark.
afl_fuzzer.run_afl_fuzz(input_corpus,
out... | """Run fuzzer."""
afl_fuzzer.prepare_fuzz_environment(input_corpus)
# Write AFL's output to /dev/null to avoid filling up disk by writing too
# much to log file. This is a problem in general with AFLFast but
# particularly with the lcms benchmark.
afl_fuzzer.run_afl_fuzz(input_corpus,
... | 39 | 249 | 129 | 378 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,823 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/aflplusplus_frida/fuzzer.py | 30,31 | 1,67 | fuzz | 32,67 | 31,67 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Get LLVMFuzzerTestOneInput address.
nm_proc = subprocess.run([
'sh', '-c',
'get_frida_entry.sh \'' + target_binary + '\' LLVMFuzzerTestOneInput'
],
stdout=subprocess.PIPE,
check=True)
target_func = nm_proc.stdout.split()[0].deco... | """Run fuzzer."""
# Get LLVMFuzzerTestOneInput address.
nm_proc = subprocess.run([
'sh', '-c',
'get_frida_entry.sh \'' + target_binary + '\' LLVMFuzzerTestOneInput'
],
stdout=subprocess.PIPE,
check=True)
target_func = nm_proc.... | 95 | 307 | 511 | 818 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,824 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/aflplusplus_qemu/fuzzer.py | 27,28 | 1,50 | fuzz | 29,50 | 28,50 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Get LLVMFuzzerTestOneInput address.
nm_proc = subprocess.run([
'sh', '-c',
'nm \'' + target_binary + '\' | grep -i \'T afl_qemu_driver_stdin\''
],
stdout=subprocess.PIPE,
check=True)
target_func = '0x' + nm_proc.stdout.split()[0... | """Run fuzzer."""
# Get LLVMFuzzerTestOneInput address.
nm_proc = subprocess.run([
'sh', '-c',
'nm \'' + target_binary + '\' | grep -i \'T afl_qemu_driver_stdin\''
],
stdout=subprocess.PIPE,
check=True)
target_func = '0x' + nm... | 58 | 268 | 337 | 605 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,836 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/aflrustrust/fuzzer.py | 37,38 | 1,68 | fuzz | 39,68 | 38,68 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Calculate CmpLog binary path from the instrumented target binary.
target_binary_directory = os.path.dirname(target_binary)
cmplog_target_binary_directory = \
aflplusplus_fuzzer.get_cmplog_build_directory(target_binary_directory)
target_binary_name = os.path.basename(target_binary)
cmplog_t... | """Run fuzzer."""
# Calculate CmpLog binary path from the instrumented target binary.
target_binary_directory = os.path.dirname(target_binary)
cmplog_target_binary_directory = \
aflplusplus_fuzzer.get_cmplog_build_directory(target_binary_directory)
target_binary_name = os.path.basename(targe... | 82 | 411 | 428 | 839 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,837 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/aflsmart/fuzzer.py | 23,24 | 1,80 | build | 25,37 | 24,37 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | afl_fuzzer.build()
# Copy Peach binaries to OUT
shutil.copytree('/afl/peach-3.0.202-source/output/linux_x86_64_debug/bin',
os.environ['OUT'] + '/peach-3.0.202')
# Copy supported input models
for file in glob.glob('/afl/input_models/*.xml'):
print(file)
shutil.co... | """Build benchmark."""
afl_fuzzer.build()
# Copy Peach binaries to OUT
shutil.copytree('/afl/peach-3.0.202-source/output/linux_x86_64_debug/bin',
os.environ['OUT'] + '/peach-3.0.202')
# Copy supported input models
for file in glob.glob('/afl/input_models/*.xml'):
pr... | 23 | 722 | 147 | 869 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,838 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/aflsmart_plusplus/fuzzer.py | 37,38 | 1,63 | fuzz | 39,63 | 38,63 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | afl_fuzzer.prepare_fuzz_environment(input_corpus)
os.environ['PATH'] += os.pathsep + '/out/peach-3.0.202/'
input_model = 'all_composite.xml'
additional_flags = [
# Enable stacked mutations
'-h',
# Enable structure-aware fuzzing
'-w',
'peach',
# Select in... | """Run afl-fuzz on target."""
afl_fuzzer.prepare_fuzz_environment(input_corpus)
os.environ['PATH'] += os.pathsep + '/out/peach-3.0.202/'
input_model = 'all_composite.xml'
additional_flags = [
# Enable stacked mutations
'-h',
# Enable structure-aware fuzzing
'-w',
... | 53 | 387 | 241 | 628 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,839 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/centipede/fuzzer.py | 22,23 | 1,91 | build | 24,50 | 23,50 | # Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | san_cflags = ['-fsanitize-coverage=trace-loads']
link_cflags = [
'-Wno-unused-command-line-argument',
'-Wl,-ldl,-lrt,-lpthread,/lib/weak.o'
]
# TODO(Dongge): Build targets with sanitizers.
with open('/src/centipede/clang-flags.txt', 'r',
encoding='utf-8') as clang_fla... | """Build benchmark."""
san_cflags = ['-fsanitize-coverage=trace-loads']
link_cflags = [
'-Wno-unused-command-line-argument',
'-Wl,-ldl,-lrt,-lpthread,/lib/weak.o'
]
# TODO(Dongge): Build targets with sanitizers.
with open('/src/centipede/clang-flags.txt', 'r',
enc... | 54 | 774 | 356 | 1,130 | # Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,840 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/centipede_function_filter/fuzzer.py | 27,28 | 1,40 | fuzz | 29,40 | 28,40 | # Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | with open('/focus_map.yaml', 'r', encoding='utf-8') as focus_file:
focus_map = yaml.safe_load(focus_file)
benchmark = os.getenv('BENCHMARK', None)
if benchmark not in focus_map:
return
focus_list = focus_map[benchmark]
focus_filter = ','.join(focus_list)
fuzzer.run_fuzzer(input_c... | """Run fuzzer. Wrapper that uses the defaults when calling run_fuzzer."""
with open('/focus_map.yaml', 'r', encoding='utf-8') as focus_file:
focus_map = yaml.safe_load(focus_file)
benchmark = os.getenv('BENCHMARK', None)
if benchmark not in focus_map:
return
focus_list = focus_map[be... | 29 | 263 | 165 | 428 | # Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,841 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/coverage/fuzzer.py | 21,22 | 1,34 | build | 23,34 | 22,34 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | cflags = [
'-fprofile-instr-generate', '-fcoverage-mapping', '-gline-tables-only'
]
utils.append_flags('CFLAGS', cflags)
utils.append_flags('CXXFLAGS', cflags)
os.environ['CC'] = 'clang'
os.environ['CXX'] = 'clang++'
os.environ['FUZZER_LIB'] = '/usr/lib/libFuzzer.a'
utils.build... | """Build benchmark."""
cflags = [
'-fprofile-instr-generate', '-fcoverage-mapping', '-gline-tables-only'
]
utils.append_flags('CFLAGS', cflags)
utils.append_flags('CXXFLAGS', cflags)
os.environ['CC'] = 'clang'
os.environ['CXX'] = 'clang++'
os.environ['FUZZER_LIB'] = '/usr/lib/li... | 21 | 201 | 148 | 349 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,842 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/darwin/fuzzer.py | 47,48 | 1,145 | get_stats | 49,66 | 48,66 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Get a dictionary containing the stats AFL reports.
stats_file = os.path.join(output_corpus, 'fuzzer_stats')
if not os.path.exists(stats_file):
print('Can\'t find fuzzer_stats')
return '{}'
with open(stats_file, encoding='utf-8') as file_handle:
stats_file_lines = file_handle.re... | """Gets fuzzer stats for AFL."""
# Get a dictionary containing the stats AFL reports.
stats_file = os.path.join(output_corpus, 'fuzzer_stats')
if not os.path.exists(stats_file):
print('Can\'t find fuzzer_stats')
return '{}'
with open(stats_file, encoding='utf-8') as file_handle:
... | 58 | 1,486 | 237 | 1,723 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,843 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/eclipser/fuzzer.py | 31,32 | 1,133 | build | 33,70 | 32,70 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... |
# Backup the environment.
new_env = os.environ.copy()
# First, build an instrumented binary for AFL.
afl_fuzzer.prepare_build_environment()
src = os.getenv('SRC')
work = os.getenv('WORK')
with utils.restore_directory(src), utils.restore_directory(work):
# Restore SRC to its initial... | """Build benchmark."""
# Backup the environment.
new_env = os.environ.copy()
# First, build an instrumented binary for AFL.
afl_fuzzer.prepare_build_environment()
src = os.getenv('SRC')
work = os.getenv('WORK')
with utils.restore_directory(src), utils.restore_directory(work):
#... | 157 | 1,138 | 647 | 1,785 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,844 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/eclipser_aflplusplus/fuzzer.py | 58,59 | 1,125 | eclipser | 60,89 | 59,89 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # We will use output_corpus as a directory where AFL and Eclipser sync their
# test cases with each other. For Eclipser, we should explicitly specify an
# output directory under this sync directory.
eclipser_out = os.path.join(output_corpus, 'eclipser_output')
command = [
'dotnet',
'... | """Run Eclipser."""
# We will use output_corpus as a directory where AFL and Eclipser sync their
# test cases with each other. For Eclipser, we should explicitly specify an
# output directory under this sync directory.
eclipser_out = os.path.join(output_corpus, 'eclipser_output')
command = [
... | 104 | 1,174 | 335 | 1,509 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,845 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/eclipser_new/fuzzer.py | 108,109 | 1,133 | fuzz | 110,133 | 109,133 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... |
# Calculate uninstrumented binary path from the instrumented target binary.
target_binary_directory = os.path.dirname(target_binary)
uninstrumented_target_binary_directory = (
get_uninstrumented_outdir(target_binary_directory))
target_binary_name = os.path.basename(target_binary)
uninstrume... | """Run fuzzer."""
# Calculate uninstrumented binary path from the instrumented target binary.
target_binary_directory = os.path.dirname(target_binary)
uninstrumented_target_binary_directory = (
get_uninstrumented_outdir(target_binary_directory))
target_binary_name = os.path.basename(target_... | 82 | 1,379 | 392 | 1,771 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,846 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/ecofuzz/fuzzer.py | 24,25 | 1,35 | fuzz | 26,35 | 25,35 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | afl_fuzzer.prepare_fuzz_environment(input_corpus)
# Write AFL's output to /dev/null to avoid filling up disk by writing too
# much to log file. This is a problem in general with AFLFast but
# particularly with the lcms benchmark.
afl_fuzzer.run_afl_fuzz(input_corpus,
out... | """Run fuzzer."""
afl_fuzzer.prepare_fuzz_environment(input_corpus)
# Write AFL's output to /dev/null to avoid filling up disk by writing too
# much to log file. This is a problem in general with AFLFast but
# particularly with the lcms benchmark.
afl_fuzzer.run_afl_fuzz(input_corpus,
... | 39 | 250 | 129 | 379 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,847 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/fafuzz/fuzzer.py | 63,64 | 1,141 | prepare_fuzz_environment | 65,84 | 64,84 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Tell AFL to not use its terminal UI so we get usable logs.
os.environ['AFL_NO_UI'] = '1'
# Skip AFL's CPU frequency check (fails on Docker).
os.environ['AFL_SKIP_CPUFREQ'] = '1'
# No need to bind affinity to one core, Docker enforces 1 core usage.
os.environ['AFL_NO_AFFINITY'] = '1'
# AFL ... | """Prepare to fuzz with AFL or another AFL-based fuzzer."""
# Tell AFL to not use its terminal UI so we get usable logs.
os.environ['AFL_NO_UI'] = '1'
# Skip AFL's CPU frequency check (fails on Docker).
os.environ['AFL_SKIP_CPUFREQ'] = '1'
# No need to bind affinity to one core, Docker enforces ... | 108 | 1,348 | 329 | 1,677 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,848 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/fairfuzz/fuzzer.py | 24,25 | 1,27 | fuzz | 26,27 | 25,27 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | afl_fuzzer.fuzz(input_corpus, output_corpus, target_binary)
| """Run fuzzer."""
afl_fuzzer.fuzz(input_corpus, output_corpus, target_binary)
| 3 | 249 | 29 | 278 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,849 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/fuzzolic_aflplusplus_fuzzy/fuzzer.py | 32,33 | 1,142 | build | 34,75 | 33,75 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... |
# Backup the environment.
new_env = os.environ.copy()
# First, build an instrumented binary for AFL.
os.environ['CC'] = '/out/AFLplusplus/afl-clang-fast'
os.environ['CXX'] = '/out/AFLplusplus/afl-clang-fast++'
os.environ['FUZZER_LIB'] = '/libAFLDriver.a'
os.environ['AFL_PATH'] = '/out/AFLp... | """Build benchmark."""
# Backup the environment.
new_env = os.environ.copy()
# First, build an instrumented binary for AFL.
os.environ['CC'] = '/out/AFLplusplus/afl-clang-fast'
os.environ['CXX'] = '/out/AFLplusplus/afl-clang-fast++'
os.environ['FUZZER_LIB'] = '/libAFLDriver.a'
os.envir... | 169 | 1,198 | 755 | 1,953 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,850 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/fuzzolic_aflplusplus_z3/fuzzer.py | 75,76 | 1,141 | fuzzolic | 77,105 | 76,105 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # We will use output_corpus as a directory where AFL and Fuzzolic sync their
# test cases with each other. For Fuzzolic, we should explicitly specify an
# output directory under this sync directory.
if input_corpus:
fuzzolic_out = os.path.join(output_corpus, 'fuzzolic_output')
afl_out = os.p... | """Run Fuzzolic."""
# We will use output_corpus as a directory where AFL and Fuzzolic sync their
# test cases with each other. For Fuzzolic, we should explicitly specify an
# output directory under this sync directory.
if input_corpus:
fuzzolic_out = os.path.join(output_corpus, 'fuzzolic_out... | 90 | 1,602 | 324 | 1,926 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,851 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/glibfuzzer/fuzzer.py | 47,48 | 1,90 | run_fuzzer | 49,90 | 48,90 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | if extra_flags is None:
extra_flags = []
# Seperate out corpus and crash directories as sub-directories of
# |output_corpus| to avoid conflicts when corpus directory is reloaded.
crashes_dir = os.path.join(output_corpus, 'crashes')
output_corpus = os.path.join(output_corpus, 'corpus')
o... | """Run fuzzer."""
if extra_flags is None:
extra_flags = []
# Seperate out corpus and crash directories as sub-directories of
# |output_corpus| to avoid conflicts when corpus directory is reloaded.
crashes_dir = os.path.join(output_corpus, 'crashes')
output_corpus = os.path.join(output_c... | 150 | 550 | 552 | 1,102 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,852 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/gramatron/fuzzer.py | 42,43 | 1,81 | build | 44,71 | 43,71 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | benchmark_name = os.environ['BENCHMARK'].lower()
if 'php' in benchmark_name:
copy_file = '/libafl_fuzzbench/grammars/php_automata.json.gz'
elif 'ruby' in benchmark_name:
copy_file = '/libafl_fuzzbench/grammars/ruby_automata.json.gz'
elif 'js' in benchmark_name or 'javascript' in benchmar... | """Build benchmark."""
benchmark_name = os.environ['BENCHMARK'].lower()
if 'php' in benchmark_name:
copy_file = '/libafl_fuzzbench/grammars/php_automata.json.gz'
elif 'ruby' in benchmark_name:
copy_file = '/libafl_fuzzbench/grammars/ruby_automata.json.gz'
elif 'js' in benchmark_name ... | 66 | 711 | 445 | 1,156 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,853 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/grimoire/fuzzer.py | 42,43 | 1,83 | build | 44,70 | 43,70 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | benchmark_name = os.environ['BENCHMARK'].lower()
if 'php' in benchmark_name:
copy_file = '/libafl_fuzzbench/grammars/php_nautilus.json'
elif 'ruby' in benchmark_name:
copy_file = '/libafl_fuzzbench/grammars/ruby_nautilus.json'
elif 'js' in benchmark_name or 'javascript' in benchmark_name... | """Build benchmark."""
benchmark_name = os.environ['BENCHMARK'].lower()
if 'php' in benchmark_name:
copy_file = '/libafl_fuzzbench/grammars/php_nautilus.json'
elif 'ruby' in benchmark_name:
copy_file = '/libafl_fuzzbench/grammars/ruby_nautilus.json'
elif 'js' in benchmark_name or 'ja... | 63 | 751 | 419 | 1,170 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,855 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/honggfuzz/fuzzer.py | 38,39 | 1,70 | fuzz | 40,70 | 39,70 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Seperate out corpus and crash directories as sub-directories of
# |output_corpus| to avoid conflicts when corpus directory is reloaded.
crashes_dir = os.path.join(output_corpus, 'crashes')
output_corpus = os.path.join(output_corpus, 'corpus')
os.makedirs(crashes_dir)
os.makedirs(output_corpus)... | """Run fuzzer."""
# Seperate out corpus and crash directories as sub-directories of
# |output_corpus| to avoid conflicts when corpus directory is reloaded.
crashes_dir = os.path.join(output_corpus, 'crashes')
output_corpus = os.path.join(output_corpus, 'corpus')
os.makedirs(crashes_dir)
os.m... | 77 | 438 | 359 | 797 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,856 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/honggfuzz_qemu/fuzzer.py | 41,42 | 1,73 | fuzz | 43,73 | 42,73 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Seperate out corpus and crash directories as sub-directories of
# |output_corpus| to avoid conflicts when corpus directory is reloaded.
crashes_dir = os.path.join(output_corpus, 'crashes')
output_corpus = os.path.join(output_corpus, 'corpus')
os.makedirs(crashes_dir)
os.makedirs(output_corpus)... | """Run fuzzer."""
# Seperate out corpus and crash directories as sub-directories of
# |output_corpus| to avoid conflicts when corpus directory is reloaded.
crashes_dir = os.path.join(output_corpus, 'crashes')
output_corpus = os.path.join(output_corpus, 'corpus')
os.makedirs(crashes_dir)
os.m... | 78 | 464 | 369 | 833 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,863 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/lafintel/fuzzer.py | 24,25 | 1,78 | prepare_build_environment | 26,64 | 25,64 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... |
# LLVm 3.8 doesn't support -fsanitize=builtin
def remove_builtin(flag):
split = flag.split('=')
if split[0].startswith('-fsanitize') or split[0].startswith(
'-fno-sanitize'):
options = split[1].split(',')
options = filter(lambda x: x != 'builtin', options... | """Set environment variables used to build benchmark."""
# LLVm 3.8 doesn't support -fsanitize=builtin
def remove_builtin(flag):
split = flag.split('=')
if split[0].startswith('-fsanitize') or split[0].startswith(
'-fno-sanitize'):
options = split[1].split(',')
... | 135 | 382 | 681 | 1,063 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,864 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/learnperffuzz/fuzzer.py | 64,65 | 1,144 | prepare_fuzz_environment | 66,85 | 65,85 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Tell AFL to not use its terminal UI so we get usable logs.
os.environ['AFL_NO_UI'] = '1'
# Skip AFL's CPU frequency check (fails on Docker).
os.environ['AFL_SKIP_CPUFREQ'] = '1'
# No need to bind affinity to one core, Docker enforces 1 core usage.
os.environ['AFL_NO_AFFINITY'] = '1'
# AFL ... | """Prepare to fuzz with AFL or another AFL-based fuzzer."""
# Tell AFL to not use its terminal UI so we get usable logs.
os.environ['AFL_NO_UI'] = '1'
# Skip AFL's CPU frequency check (fails on Docker).
os.environ['AFL_SKIP_CPUFREQ'] = '1'
# No need to bind affinity to one core, Docker enforces ... | 108 | 1,381 | 329 | 1,710 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,865 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/libafl/fuzzer.py | 23,24 | 1,73 | prepare_fuzz_environment | 25,41 | 24,41 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | os.environ['ASAN_OPTIONS'] = 'abort_on_error=1:detect_leaks=0:'\
'malloc_context_size=0:symbolize=0:'\
'allocator_may_return_null=1:'\
'detect_odr_violation=0:handle_segv=0:'\
'handle_... | """Prepare to fuzz with a LibAFL-based fuzzer."""
os.environ['ASAN_OPTIONS'] = 'abort_on_error=1:detect_leaks=0:'\
'malloc_context_size=0:symbolize=0:'\
'allocator_may_return_null=1:'\
'detect_odr_violation=0:hand... | 26 | 735 | 300 | 1,035 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,866 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/libafl_libfuzzer/fuzzer.py | 39,40 | 1,118 | build | 41,65 | 40,65 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # With LibFuzzer we use -fsanitize=fuzzer-no-link for build CFLAGS and then
# /usr/lib/libFuzzer.a as the FUZZER_LIB for the main fuzzing binary. This
# allows us to link against a version of LibFuzzer that we specify.
cflags = ['-fsanitize=fuzzer-no-link']
utils.append_flags('CFLAGS', cflags)
u... | """Build benchmark."""
# With LibFuzzer we use -fsanitize=fuzzer-no-link for build CFLAGS and then
# /usr/lib/libFuzzer.a as the FUZZER_LIB for the main fuzzing binary. This
# allows us to link against a version of LibFuzzer that we specify.
cflags = ['-fsanitize=fuzzer-no-link']
utils.append_fl... | 84 | 1,169 | 387 | 1,556 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,867 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/libafl_text/fuzzer.py | 41,42 | 1,69 | build | 43,59 | 42,59 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | os.environ['CC'] = '/libafl/fuzzers/fuzzbench_text/target/release/libafl_cc'
os.environ[
'CXX'] = '/libafl/fuzzers/fuzzbench_text/target/release/libafl_cxx'
os.environ['ASAN_OPTIONS'] = 'abort_on_error=0:allocator_may_return_null=1'
os.environ['UBSAN_OPTIONS'] = 'abort_on_error=0'
cflags =... | """Build benchmark."""
os.environ['CC'] = '/libafl/fuzzers/fuzzbench_text/target/release/libafl_cc'
os.environ[
'CXX'] = '/libafl/fuzzers/fuzzbench_text/target/release/libafl_cxx'
os.environ['ASAN_OPTIONS'] = 'abort_on_error=0:allocator_may_return_null=1'
os.environ['UBSAN_OPTIONS'] = 'abor... | 26 | 694 | 248 | 942 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,868 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/libfuzzer/fuzzer.py | 44,45 | 1,103 | run_fuzzer | 46,103 | 45,103 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | if extra_flags is None:
extra_flags = []
# Seperate out corpus and crash directories as sub-directories of
# |output_corpus| to avoid conflicts when corpus directory is reloaded.
crashes_dir = os.path.join(output_corpus, 'crashes')
output_corpus = os.path.join(output_corpus, 'corpus')
o... | """Run fuzzer."""
if extra_flags is None:
extra_flags = []
# Seperate out corpus and crash directories as sub-directories of
# |output_corpus| to avoid conflicts when corpus directory is reloaded.
crashes_dir = os.path.join(output_corpus, 'crashes')
output_corpus = os.path.join(output_c... | 199 | 519 | 783 | 1,302 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,869 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/manul/fuzzer.py | 30,31 | 1,48 | fuzz | 40,48 | 31,48 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | afl_fuzzer.prepare_fuzz_environment(input_corpus)
# Run fuzzer on the benchmark.
manul_directory = os.path.join(os.environ['OUT'], 'manul')
command = ([
'python3', 'manul.py', '-i', input_corpus, '-o', output_corpus, '-c',
os.path.join(manul_directory, 'manul_lin.config'), target_binary ... | """Run fuzzer.
Arguments:
input_corpus: Directory containing the initial seed corpus for
the benchmark.
output_corpus: Output directory to place the newly generated corpus
from fuzzer run.
target_binary: Absolute path to the fuzz target binary.
"""... | 30 | 382 | 155 | 537 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,870 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/mopt/fuzzer.py | 24,25 | 1,38 | fuzz | 26,38 | 25,38 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | afl_fuzzer.prepare_fuzz_environment(input_corpus)
afl_fuzzer.run_afl_fuzz(
input_corpus,
output_corpus,
target_binary,
additional_flags=[
# Enable Mopt mutator with pacemaker fuzzing mode at first. This
# is also recommended in a short-time scale evaluati... | """Run fuzzer."""
afl_fuzzer.prepare_fuzz_environment(input_corpus)
afl_fuzzer.run_afl_fuzz(
input_corpus,
output_corpus,
target_binary,
additional_flags=[
# Enable Mopt mutator with pacemaker fuzzing mode at first. This
# is also recommended in a sho... | 29 | 248 | 129 | 377 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,871 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/nautilus/fuzzer.py | 42,43 | 1,80 | build | 44,70 | 43,70 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | benchmark_name = os.environ['BENCHMARK'].lower()
if 'php' in benchmark_name:
copy_file = '/libafl_fuzzbench/grammars/php_nautilus.json'
elif 'ruby' in benchmark_name:
copy_file = '/libafl_fuzzbench/grammars/ruby_nautilus.json'
elif 'js' in benchmark_name or 'javascript' in benchmark_name... | """Build benchmark."""
benchmark_name = os.environ['BENCHMARK'].lower()
if 'php' in benchmark_name:
copy_file = '/libafl_fuzzbench/grammars/php_nautilus.json'
elif 'ruby' in benchmark_name:
copy_file = '/libafl_fuzzbench/grammars/ruby_nautilus.json'
elif 'js' in benchmark_name or 'ja... | 63 | 711 | 417 | 1,128 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,872 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/neuzz/fuzzer.py | 37,38 | 1,113 | build | 39,54 | 38,54 | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | prepare_build_environment()
utils.build_benchmark()
output_directory = os.environ['OUT']
# Copy out the afl-fuzz binary as a build artifact.
print('[post_build] Copying afl-fuzz to $OUT directory')
shutil.copy('/afl/afl-fuzz', output_directory)
# Neuzz also requires afl-showmap.
print('[... | """Build benchmark."""
prepare_build_environment()
utils.build_benchmark()
output_directory = os.environ['OUT']
# Copy out the afl-fuzz binary as a build artifact.
print('[post_build] Copying afl-fuzz to $OUT directory')
shutil.copy('/afl/afl-fuzz', output_directory)
# Neuzz also require... | 50 | 1,162 | 224 | 1,386 | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,874 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/pythia_bb/fuzzer.py | 63,64 | 1,139 | prepare_fuzz_environment | 65,84 | 64,84 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Tell AFL to not use its terminal UI so we get usable logs.
os.environ['AFL_NO_UI'] = '1'
# Skip AFL's CPU frequency check (fails on Docker).
os.environ['AFL_SKIP_CPUFREQ'] = '1'
# No need to bind affinity to one core, Docker enforces 1 core usage.
os.environ['AFL_NO_AFFINITY'] = '1'
# AFL ... | """Prepare to fuzz with AFL or another AFL-based fuzzer."""
# Tell AFL to not use its terminal UI so we get usable logs.
os.environ['AFL_NO_UI'] = '1'
# Skip AFL's CPU frequency check (fails on Docker).
os.environ['AFL_SKIP_CPUFREQ'] = '1'
# No need to bind affinity to one core, Docker enforces ... | 108 | 1,334 | 329 | 1,663 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,875 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/pythia_effect_bb/fuzzer.py | 93,98 | 1,139 | run_afl_fuzz | 99,134 | 98,134 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Spawn the afl fuzzing process.
print('[run_afl_fuzz] Running target with afl-fuzz')
command = [
'./afl-fuzz',
'-i',
input_corpus,
'-o',
output_corpus,
# Use no memory limit as ASAN doesn't play nicely with one.
'-m',
'none',
'-t',
... | """Run afl-fuzz."""
# Spawn the afl fuzzing process.
print('[run_afl_fuzz] Running target with afl-fuzz')
command = [
'./afl-fuzz',
'-i',
input_corpus,
'-o',
output_corpus,
# Use no memory limit as ASAN doesn't play nicely with one.
'-m',
'... | 121 | 1,265 | 414 | 1,679 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,876 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/symcc_afl/fuzzer.py | 97,98 | 1,135 | fuzz | 102,135 | 98,135 | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | target_binary_dir = os.path.dirname(target_binary)
symcc_workdir = get_symcc_build_dir(target_binary_dir)
target_binary_name = os.path.basename(target_binary)
symcc_target_binary = os.path.join(symcc_workdir, target_binary_name)
# Start a master and secondary instance of AFL.
# We need both bec... | """
Launches a master and a secondary instance of AFL, as well as
the symcc helper.
"""
target_binary_dir = os.path.dirname(target_binary)
symcc_workdir = get_symcc_build_dir(target_binary_dir)
target_binary_name = os.path.basename(target_binary)
symcc_target_binary = os.path.join(symcc_... | 106 | 1,267 | 482 | 1,749 | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,877 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/symcc_afl_single/fuzzer.py | 25,26 | 1,28 | fuzz | 27,28 | 26,28 | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | symcc_afl_fuzzer.fuzz(input_corpus, output_corpus, target_binary, True)
| """ Launch a SymCC with a single AFL instance. """
symcc_afl_fuzzer.fuzz(input_corpus, output_corpus, target_binary, True)
| 4 | 295 | 34 | 329 | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,878 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/symcc_aflplusplus/fuzzer.py | 32,33 | 1,135 | build | 34,91 | 33,91 | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | print('Step 1: Building with AFL')
build_directory = os.environ['OUT']
# Save the environment for use in SymCC
new_env = os.environ.copy()
# First build with AFL.
src = os.getenv('SRC')
work = os.getenv('WORK')
with utils.restore_directory(src), utils.restore_directory(work):
#... | """Build an AFL version and SymCC version of the benchmark"""
print('Step 1: Building with AFL')
build_directory = os.environ['OUT']
# Save the environment for use in SymCC
new_env = os.environ.copy()
# First build with AFL.
src = os.getenv('SRC')
work = os.getenv('WORK')
with util... | 210 | 923 | 887 | 1,810 | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,879 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/symcc_aflplusplus_single/fuzzer.py | 73,74 | 1,105 | fuzz | 78,105 | 74,105 | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | target_binary_dir = os.path.dirname(target_binary)
symcc_workdir = get_symcc_build_dir(target_binary_dir)
target_binary_name = os.path.basename(target_binary)
symcc_target_binary = os.path.join(symcc_workdir, target_binary_name)
os.environ['AFL_DISABLE_TRIM'] = '1'
# Start a master and seconda... | """
Launches a master and a secondary instance of AFL, as well as
the symcc helper.
"""
target_binary_dir = os.path.dirname(target_binary)
symcc_workdir = get_symcc_build_dir(target_binary_dir)
target_binary_name = os.path.basename(target_binary)
symcc_target_binary = os.path.join(symcc_... | 95 | 941 | 421 | 1,362 | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,880 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/symqemu_aflplusplus/fuzzer.py | 31,32 | 1,121 | build | 33,72 | 32,72 | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... |
# Backup the environment.
orig_env = os.environ.copy()
#src = os.getenv('SRC')
#work = os.getenv('WORK')
build_directory = os.getenv('OUT')
fuzz_target = os.getenv('FUZZ_TARGET')
# First, build an uninstrumented binary for Eclipser.
aflplusplus_fuzzer.build('qemu', 'eclipser')
ecli... | """Build an AFL version and SymCC version of the benchmark"""
# Backup the environment.
orig_env = os.environ.copy()
#src = os.getenv('SRC')
#work = os.getenv('WORK')
build_directory = os.getenv('OUT')
fuzz_target = os.getenv('FUZZ_TARGET')
# First, build an uninstrumented binary for E... | 97 | 979 | 598 | 1,577 | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,882 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/test_fuzzers.py | 63,64 | 1,88 | test_fuzz_function_errors | 68,79 | 64,79 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | for fuzzer_module in _get_all_fuzzer_modules():
with pytest.raises(Exception) as error, Patcher():
fuzzer_module.fuzz('/input-corpus', '/output-corpus',
'/target-binary')
# Type error probably means module is doing something else wrong,
# so fail i... | """This test calls fuzzer_module.fuzz() under circumstances in
which it should throw an exception. If the call exceptions, the
test passes, otherwise the test fails. This ensures that we can
properly detect failures during fuzzing."""
for fuzzer_module in _get_all_fuzzer_modules():
with pyte... | 47 | 915 | 136 | 1,051 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,884 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/token_level/fuzzer.py | 42,43 | 1,80 | build | 44,70 | 43,70 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | benchmark_name = os.environ['BENCHMARK'].lower()
if 'php' in benchmark_name:
copy_file = '/libafl_fuzzbench/grammars/php_nautilus.json'
elif 'ruby' in benchmark_name:
copy_file = '/libafl_fuzzbench/grammars/ruby_nautilus.json'
elif 'js' in benchmark_name or 'javascript' in benchmark_name... | """Build benchmark."""
benchmark_name = os.environ['BENCHMARK'].lower()
if 'php' in benchmark_name:
copy_file = '/libafl_fuzzbench/grammars/php_nautilus.json'
elif 'ruby' in benchmark_name:
copy_file = '/libafl_fuzzbench/grammars/ruby_nautilus.json'
elif 'js' in benchmark_name or 'ja... | 63 | 711 | 419 | 1,130 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,885 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/tortoisefuzz/fuzzer.py | 23,24 | 1,42 | build | 25,36 | 24,36 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | afl_fuzzer.prepare_build_environment()
os.environ['CC'] = '/workdir/TortoiseFuzz/bb_metric/afl-clang-fast'
os.environ['CXX'] = '/workdir/TortoiseFuzz/bb_metric/afl-clang-fast++'
os.environ['FUZZER_LIB'] = '/libAFLDriver.a'
utils.build_benchmark()
print('[post_build] Copying tortoise-fuzz to $OU... | """Build benchmark."""
afl_fuzzer.prepare_build_environment()
os.environ['CC'] = '/workdir/TortoiseFuzz/bb_metric/afl-clang-fast'
os.environ['CXX'] = '/workdir/TortoiseFuzz/bb_metric/afl-clang-fast++'
os.environ['FUZZER_LIB'] = '/libAFLDriver.a'
utils.build_benchmark()
print('[post_build] C... | 29 | 318 | 203 | 521 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,887 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/weizz_qemu/fuzzer.py | 23,24 | 1,83 | build | 25,43 | 24,43 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | os.environ['CC'] = 'clang'
os.environ['CXX'] = 'clang++'
os.environ['FUZZER_LIB'] = '/libQEMU.a'
# QEMU doesn't like ASan
cflags = filter(lambda flag: not flag.startswith('-fsanitize=address'),
os.environ['CFLAGS'].split())
cxxflags = filter(lambda flag: not flag.startswith('... | """Build benchmark."""
os.environ['CC'] = 'clang'
os.environ['CXX'] = 'clang++'
os.environ['FUZZER_LIB'] = '/libQEMU.a'
# QEMU doesn't like ASan
cflags = filter(lambda flag: not flag.startswith('-fsanitize=address'),
os.environ['CFLAGS'].split())
cxxflags = filter(lambda ... | 46 | 749 | 271 | 1,020 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,888 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/fuzzers/wingfuzz/fuzzer.py | 22,23 | 1,53 | build | 24,43 | 23,43 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | cflags = [
'-fsanitize=fuzzer-no-link',
'-fno-sanitize-coverage=trace-cmp',
'-fno-legacy-pass-manager',
'-fpass-plugin=/LoadCmpTracer.so',
# Hack: support non-standard build scripts ignoring LDFLAGS
'-w',
'-Wl,/WeakSym.o'
]
utils.append_flags('CFLAGS',... | """Build benchmark."""
cflags = [
'-fsanitize=fuzzer-no-link',
'-fno-sanitize-coverage=trace-cmp',
'-fno-legacy-pass-manager',
'-fpass-plugin=/LoadCmpTracer.so',
# Hack: support non-standard build scripts ignoring LDFLAGS
'-w',
'-Wl,/WeakSym.o'
]
u... | 32 | 347 | 230 | 577 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
46,890 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/presubmit.py | 108,109 | 101,156 | validate_fuzzer | FuzzerAndBenchmarkValidator | 111,127 | 109,127 | class FuzzerAndBenchmarkValidator:
"""Class that validates the names of fuzzers and benchmarks."""
def __init__(self):
self.invalid_fuzzers = set()
self.invalid_benchmarks = set()
def validate_fuzzer(self, path: Path):
FILL_FUNC_BODY def validate_benchmark(self, path: Path):
"""... | class FuzzerAndBenchmarkValidator:
"""Class that validates the names of fuzzers and benchmarks."""
def __init__(self):
self.invalid_fuzzers = set()
self.invalid_benchmarks = set()
def validate_fuzzer(self, path: Path):
"""Return True if |path| is part of a valid fuzzer. Otherwise r... | fuzzer = get_fuzzer(path)
if fuzzer is None:
return True
if fuzzer in self.invalid_fuzzers:
# We know this is invalid and have already complained about it.
return False
if fuzzer_utils.validate(fuzzer):
return True
self.invalid_... | """Return True if |path| is part of a valid fuzzer. Otherwise return
False and print an error."""
fuzzer = get_fuzzer(path)
if fuzzer is None:
return True
if fuzzer in self.invalid_fuzzers:
# We know this is invalid and have already complained about it.
... | 38 | 378 | 136 | 514 | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
46,892 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/service/gcbrun_experiment.py | 34,35 | 1,97 | get_comments | 37,51 | 35,51 | # Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | github_obj = github.Github()
repo = github_obj.get_repo('google/fuzzbench')
pull = repo.get_pull(pull_request_number)
pull_comments = list(pull.get_comments())
last_pull_comment = pull_comments[-1] if pull_comments else None
issue = repo.get_issue(pull_request_number)
issue_comments = list(i... | """Returns comments on the GitHub Pull request referenced by
|pull_request_number|."""
github_obj = github.Github()
repo = github_obj.get_repo('google/fuzzbench')
pull = repo.get_pull(pull_request_number)
pull_comments = list(pull.get_comments())
last_pull_comment = pull_comments[-1] if pull_c... | 67 | 915 | 204 | 1,119 | # Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,894 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/src_analysis/benchmark_dependencies.py | 28,29 | 1,43 | get_files_dependent_benchmarks | 31,43 | 29,43 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | dependent_benchmarks = []
benchmarks = benchmark_utils.get_all_benchmarks()
for dependency_file in dependency_files:
for benchmark in benchmarks:
if not is_subpath_of_benchmark(dependency_file, benchmark):
# Benchmarks can only depend on files in their directory.
... | """Returns the list of benchmarks that are dependent on any file in
|dependency_files|."""
dependent_benchmarks = []
benchmarks = benchmark_utils.get_all_benchmarks()
for dependency_file in dependency_files:
for benchmark in benchmarks:
if not is_subpath_of_benchmark(dependency_... | 32 | 328 | 115 | 443 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,895 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/src_analysis/change_utils.py | 49,50 | 1,68 | get_changed_fuzzers_for_ci | 54,61 | 50,61 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | changed_files = get_absolute_paths(changed_files)
if any(changed_file in CI_FILES for changed_file in changed_files):
# If any of changed files are in CI_FILES.
return fuzzer_utils.get_fuzzer_names()
return get_changed_fuzzers(changed_files)
| """Returns a list of fuzzers that have changed functionality based
on the files that have changed in |changed_files|.
Unlike get_changed_fuzzers this function considers changes that affect
building or running fuzzers in CI."""
changed_files = get_absolute_paths(changed_files)
if any(changed_file... | 24 | 745 | 95 | 840 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,896 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/src_analysis/diff_utils.py | 27,28 | 1,59 | execute_git_diff | 30,36 | 28,36 | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | command = ['git', 'diff'] + diff_args
# Change directories using cwd instead of using "git -C" because "HEAD"
# can't be used with "git -C".
return subprocess.check_output(command, cwd=repo).decode().splitlines()
| """Adds |diff_args| to the command 'git diff' and executes the command in
|repo|. Returns a list of each line in the output."""
command = ['git', 'diff'] + diff_args
# Change directories using cwd instead of using "git -C" because "HEAD"
# can't be used with "git -C".
return subprocess.check_out... | 28 | 641 | 78 | 719 | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | |
46,897 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/src_analysis/experiment_changes.py | 24,25 | 1,52 | get_fuzzers_changed_since_last | 27,52 | 25,52 | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | # TODO(metzman): Figure out a way of skipping experiments that were stopped
# early.
# Loop over experiments since some may have hashes that are not in the
# current branch.
with db_utils.session_scope() as session:
experiments = list(
session.query(models.Experiment).order_by(
... | """Returns a list of fuzzers that have changed since the last experiment
stored in the database that has a commit that is in the current branch."""
# TODO(metzman): Figure out a way of skipping experiments that were stopped
# early.
# Loop over experiments since some may have hashes that are not in... | 88 | 286 | 279 | 565 | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | |
46,898 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/src_analysis/fuzzer_dependencies.py | 98,100 | 1,161 | _get_python_dependencies | 107,150 | 100,150 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | if depth > PY_DEPENDENCIES_MAX_DEPTH:
# Enforce a depth to catch cyclic imports.
format_string = ('Depth: {depth} greater than max: {max_depth}. '
'Probably a cyclic import in {module}.')
raise Exception(
format_string.format(depth=depth,
... | """Returns the python files that |module| is dependent on if module is a
submodule of fuzzers/. Does not return dependencies that are not submodules
of fuzzers/, such as std library modules. Has a limit of
PY_DEPENDENCIES_MAX_DEPTH so that cyclic imports can easily be detected.
Note that this may no... | 177 | 1,409 | 532 | 1,941 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,899 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/src_analysis/test_benchmark_dependencies.py | 37,38 | 1,56 | test_get_files_dependent_benchmarks | 40,56 | 38,56 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | fake_build_sh_path = os.path.join(benchmark_utils.BENCHMARKS_DIR, 'fake',
'build.sh')
changed_files = [
STANDARD_BUILD_SH_PATH, BENCHMARK_YAML_PATH, fake_build_sh_path
]
dependent_benchmarks = (
benchmark_dependencies.get_files_dependent_benchmarks(c... | """Tests that get_files_dependent_benchmarks returns the benchmarks that are
dependent on the files passed to it."""
fake_build_sh_path = os.path.join(benchmark_utils.BENCHMARKS_DIR, 'fake',
'build.sh')
changed_files = [
STANDARD_BUILD_SH_PATH, BENCHMARK_YAM... | 30 | 528 | 210 | 738 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,900 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/src_analysis/test_change_utils.py | 22,23 | 1,35 | test_get_changed_fuzzers_for_ci | 25,30 | 23,30 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | changed_fuzzers = change_utils.get_changed_fuzzers_for_ci(
[os.path.join(utils.ROOT_DIR, 'docker', 'image_types.yaml')])
assert changed_fuzzers == fuzzer_utils.get_fuzzer_names()
| """Tests that get_changed_fuzzers_for_ci returns all fuzzers when a file
that affects all fuzzer build was changed."""
changed_fuzzers = change_utils.get_changed_fuzzers_for_ci(
[os.path.join(utils.ROOT_DIR, 'docker', 'image_types.yaml')])
assert changed_fuzzers == fuzzer_utils.get_fuzzer_names(... | 10 | 313 | 82 | 395 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,901 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/src_analysis/test_experiment_changes.py | 59,63 | 1,91 | test_get_fuzzers_changed_since_last_non_master_experiment | 65,91 | 63,91 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Set up a newer, out-of-branch experiment.
out_of_branch_experiment = models.Experiment()
out_of_branch_experiment.name = 'out-of-branch-experiment'
out_of_branch_hash = 'out-of-branch-experiment-hash'
out_of_branch_experiment.git_hash = out_of_branch_hash
db_utils.add_all([out_of_branch_experi... | """Tests that get_fuzzers_changed_since_last returns the
correct result when the first experiment's git hash is not in branch"""
# Set up a newer, out-of-branch experiment.
out_of_branch_experiment = models.Experiment()
out_of_branch_experiment.name = 'out-of-branch-experiment'
out_of_branch_has... | 63 | 740 | 402 | 1,142 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,902 | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench | /home/hieuvd/dung_repo/raw/stars_03/google_fuzzbench/fuzzbench/src_analysis/test_fuzzer_dependencies.py | 111,112 | 1,122 | test_get_files_dependent_fuzzers_afl_runner_dockerfile | 114,122 | 112,122 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | afl_runner_dockerfile = os.path.join(utils.ROOT_DIR, 'fuzzers', 'afl',
'runner.Dockerfile')
dependent_fuzzers = fuzzer_dependencies.get_files_dependent_fuzzers(
[afl_runner_dockerfile])
assert 'fairfuzz' not in dependent_fuzzers
# Ensure that the fuzzer ... | """Tests that the right modules are returned by get_files_dependent_fuzzers
when passed fuzzers/afl/runner.Dockerfile."""
afl_runner_dockerfile = os.path.join(utils.ROOT_DIR, 'fuzzers', 'afl',
'runner.Dockerfile')
dependent_fuzzers = fuzzer_dependencies.get_file... | 31 | 1,590 | 136 | 1,726 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,904 | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/setup.py | 38,39 | 1,132 | _strip_comments_from_line | 40,44 | 39,44 | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | requirement, *_ = s.split('#')
return requirement.strip()
| """Parses a line of a requirements.txt file."""
requirement, *_ = s.split('#')
return requirement.strip()
| 6 | 1,364 | 25 | 1,389 | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,905 | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/setup.py | 60,61 | 57,72 | run | BuildCmd | 61,72 | 61,72 | class BuildCmd(build):
"""Custom installation script to build the protos."""
def run(self):
FILL_FUNC_BODY | class BuildCmd(build):
"""Custom installation script to build the protos."""
def run(self):
FILL_FUNC_BODY | current_path = os.path.dirname(os.path.realpath(__file__))
sys.stdout.write('current_path: {}'.format(current_path))
with os.scandir('.') as it:
for entry in it:
if entry.name.startswith('build_protos.sh'):
sys.stdout.write('{}'.format(entry))
if os.system('bash build_protos.sh')... | current_path = os.path.dirname(os.path.realpath(__file__))
sys.stdout.write('current_path: {}'.format(current_path))
with os.scandir('.') as it:
for entry in it:
if entry.name.startswith('build_protos.sh'):
sys.stdout.write('{}'.format(entry))
if os.system('bash build_protos.sh')... | 25 | 37 | 152 | 189 | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,906 | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/designers/bocs_test.py | 28,31 | 26,47 | test_make_suggestions | BocsTest | 31,47 | 31,47 | class BocsTest(parameterized.TestCase):
@parameterized.parameters((bocs.SemiDefiniteProgramming,),
(bocs.SimulatedAnnealing,))
def test_make_suggestions(self, acquisition_optimizer_factory):
FILL_FUNC_BODY | class BocsTest(parameterized.TestCase):
@parameterized.parameters((bocs.SemiDefiniteProgramming,),
(bocs.SimulatedAnnealing,))
def test_make_suggestions(self, acquisition_optimizer_factory):
FILL_FUNC_BODY | experimenter = combo_experimenter.IsingExperimenter(lamda=0.01)
designer = bocs.BOCSDesigner(
experimenter.problem_statement(),
acquisition_optimizer_factory=acquisition_optimizer_factory,
num_initial_randoms=1)
trials = test_runners.run_with_random_metrics(
designer,
... | experimenter = combo_experimenter.IsingExperimenter(lamda=0.01)
designer = bocs.BOCSDesigner(
experimenter.problem_statement(),
acquisition_optimizer_factory=acquisition_optimizer_factory,
num_initial_randoms=1)
trials = test_runners.run_with_random_metrics(
designer,
... | 20 | 74 | 168 | 242 | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,907 | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/designers/cmaes_test.py | 31,32 | 25,53 | test_e2e_and_serialization | CmaesTest | 32,53 | 32,53 | class CmaesTest(absltest.TestCase):
def setUp(self):
self.experimenter = experimenters.BBOBExperimenterFactory('Sphere', 2)()
super().setUp()
def test_e2e_and_serialization(self):
FILL_FUNC_BODY | class CmaesTest(absltest.TestCase):
def setUp(self):
self.experimenter = experimenters.BBOBExperimenterFactory('Sphere', 2)()
super().setUp()
def test_e2e_and_serialization(self):
FILL_FUNC_BODY | designer = cmaes.CMAESDesigner(self.experimenter.problem_statement())
trials = test_runners.run_with_random_metrics(
designer,
self.experimenter.problem_statement(),
iters=10,
batch_size=3,
verbose=1,
validate_parameters=True,
)
self.assertLen(trials, 30)... | designer = cmaes.CMAESDesigner(self.experimenter.problem_statement())
trials = test_runners.run_with_random_metrics(
designer,
self.experimenter.problem_statement(),
iters=10,
batch_size=3,
verbose=1,
validate_parameters=True,
)
self.assertLen(trials, 30)... | 27 | 82 | 216 | 298 | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,908 | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/designers/eagle_strategy/eagle_designer_convergence_test.py | 37,43 | 31,74 | test_convergence | EagleStrategyConvergenceTest | 43,74 | 43,74 | class EagleStrategyConvergenceTest(parameterized.TestCase):
"""Convergence test for Eagle Strategy designer.
Note that all optimization problems are MINIMIZATION.
"""
@parameterized.parameters(
testing.create_continuous_exptr(bbob.Gallagher101Me),
testing.create_continuous_log_scale_exptr(bbob.Ras... | class EagleStrategyConvergenceTest(parameterized.TestCase):
"""Convergence test for Eagle Strategy designer.
Note that all optimization problems are MINIMIZATION.
"""
@parameterized.parameters(
testing.create_continuous_exptr(bbob.Gallagher101Me),
testing.create_continuous_log_scale_exptr(bbob.Ras... |
def _random_designer_factory(problem, seed):
return random.RandomDesigner(problem.search_space, seed=seed)
def _eagle_designer_factory(problem, seed):
return eagle_strategy.EagleStrategyDesigner(problem, seed=seed)
random_benchmark_state_factory = benchmarks.DesignerBenchmarkStateFactory(
... |
def _random_designer_factory(problem, seed):
return random.RandomDesigner(problem.search_space, seed=seed)
def _eagle_designer_factory(problem, seed):
return eagle_strategy.EagleStrategyDesigner(problem, seed=seed)
random_benchmark_state_factory = benchmarks.DesignerBenchmarkStateFactory(
... | 54 | 141 | 405 | 546 | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,909 | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/designers/eagle_strategy/eagle_simplekd_test.py | 28,34 | 26,48 | test_simple4d | SimpleKDEagleDesignerTest | 34,48 | 34,48 | class SimpleKDEagleDesignerTest(parameterized.TestCase):
@parameterized.parameters(
dict(best_category='corner'),
dict(best_category='center'),
dict(best_category='mixed'),
)
def test_simple4d(self, best_category: simplekd.SimpleKDCategory) -> None:
FILL_FUNC_BODY | class SimpleKDEagleDesignerTest(parameterized.TestCase):
@parameterized.parameters(
dict(best_category='corner'),
dict(best_category='center'),
dict(best_category='mixed'),
)
def test_simple4d(self, best_category: simplekd.SimpleKDCategory) -> None:
FILL_FUNC_BODY | def _eagle_designer_factory(problem, seed):
return eagle_strategy.EagleStrategyDesigner(problem, seed=seed)
simplekd_runner.SimpleKDConvergenceTester(
best_category=best_category,
designer_factory=_eagle_designer_factory,
num_trials=5000,
max_relative_error=0.05,
n... | def _eagle_designer_factory(problem, seed):
return eagle_strategy.EagleStrategyDesigner(problem, seed=seed)
simplekd_runner.SimpleKDConvergenceTester(
best_category=best_category,
designer_factory=_eagle_designer_factory,
num_trials=5000,
max_relative_error=0.05,
n... | 15 | 100 | 164 | 264 | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,913 | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/designers/eagle_strategy/eagle_strategy_utils.py | 458,459 | 412,563 | get_next_moving_fly_copy | FireflyPool | 473,485 | 459,485 | @attr.define
class FireflyPool:
"""The class maintains the Firefly pool and relevent operations.
Attributes:
utils: Eagle Strategy utils class.
capacity: The maximum number of non-feasible fireflies in the pool.
size: The current number of non-feasible fireflies in the pool.
_pool: A dictionary of ... | @attr.define
class FireflyPool:
"""The class maintains the Firefly pool and relevent operations.
Attributes:
utils: Eagle Strategy utils class.
capacity: The maximum number of non-feasible fireflies in the pool.
size: The current number of non-feasible fireflies in the pool.
_pool: A dictionary of ... | curr_id = self._last_id + 1
while curr_id != self._last_id:
if curr_id > self._max_fly_id:
# Passed the maximum id. Start from the first one as ids are monotonic.
curr_id = next(iter(self._pool))
if curr_id in self._pool and not self._pool[curr_id].trial.infeasible:
self._las... | """Finds the next fly, returns a copy of it and updates '_last_id'.
To find the next moving fly, we start from index of '_last_id'+1 and
incremently check whether the index exists in the pool. When the loop
reaches 'max_fly_id' it goes back to index 0. We return a copy of the
first fly we find an i... | 47 | 1,696 | 180 | 1,876 | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,917 | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/designers/eagle_strategy/serialization.py | 137,138 | 1,142 | restore_rng | 139,142 | 138,142 | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | rng = np.random.default_rng()
rng.bit_generator.state = json.loads(obj)
return rng
| """Restore Numpy Random Genertor."""
rng = np.random.default_rng()
rng.bit_generator.state = json.loads(obj)
return rng
| 8 | 1,484 | 40 | 1,524 | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,918 | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/designers/eagle_strategy/serialization.py | 82,83 | 70,122 | decode | FireflyPoolDecoder | 84,122 | 83,122 | @attr.define
class FireflyPoolDecoder:
"""Eagle strategy pool decoder.
Fully restores the state of the FireflyPool.
Attributes:
utils: EagleStrategyUtils initialized with the appropriate random generator.
"""
_utils: EagleStrategyUtils
def decode(self, obj: Any) -> FireflyPool:
FILL_FUNC_BODY | @attr.define
class FireflyPoolDecoder:
"""Eagle strategy pool decoder.
Fully restores the state of the FireflyPool.
Attributes:
utils: EagleStrategyUtils initialized with the appropriate random generator.
"""
_utils: EagleStrategyUtils
def decode(self, obj: Any) -> FireflyPool:
"""Decodes a stri... | obj_dict = json.loads(obj)
restored_pool = {}
# Check that all keys appear in restored dictionary.
missing_keys = set(['_pool', 'capacity', '_last_id', '_max_fly_id']) - set(
obj_dict.keys())
if missing_keys:
raise serializable.HarmlessDecodeError(
"Couldn't load FireflyPool... | """Decodes a string object to partial FireflyPool."""
obj_dict = json.loads(obj)
restored_pool = {}
# Check that all keys appear in restored dictionary.
missing_keys = set(['_pool', 'capacity', '_last_id', '_max_fly_id']) - set(
obj_dict.keys())
if missing_keys:
raise serializable... | 95 | 118 | 476 | 594 | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,919 | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/designers/eagle_strategy/serialization.py | 43,44 | 33,70 | default | PartialFireflyPoolEncoder | 44,70 | 44,70 | class PartialFireflyPoolEncoder(json.JSONEncoder):
"""Eagle strategy pool partial encoder.
The encoder encodes the '_pool' dictionary, 'capacity', '_last_id' and
'_max_fly_id' into a string format.
The encoder does not store the EagleStrategyUtils as its state only depends
on the random generator which is h... | class PartialFireflyPoolEncoder(json.JSONEncoder):
"""Eagle strategy pool partial encoder.
The encoder encodes the '_pool' dictionary, 'capacity', '_last_id' and
'_max_fly_id' into a string format.
The encoder does not store the EagleStrategyUtils as its state only depends
on the random generator which is h... | if isinstance(o, FireflyPool):
return {
'capacity': o._capacity, # pylint: disable=protected-access
'_last_id': o._last_id, # pylint: disable=protected-access
'_max_fly_id': o._max_fly_id, # pylint: disable=protected-access
'_pool': o._pool, # pylint: disable=protec... | if isinstance(o, FireflyPool):
return {
'capacity': o._capacity, # pylint: disable=protected-access
'_last_id': o._last_id, # pylint: disable=protected-access
'_max_fly_id': o._max_fly_id, # pylint: disable=protected-access
'_pool': o._pool, # pylint: disable=protec... | 58 | 121 | 315 | 436 | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,920 | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/designers/eagle_strategy/serialization_test.py | 29,34 | 27,77 | test_restore_pool | SerializationTest | 34,69 | 34,69 | class SerializationTest(parameterized.TestCase):
@parameterized.parameters(
{'x_values': [1, 2, 5, -2], 'obj_values': [2, 10, -2, 5]},
{'x_values': [1, 2, 5, -2], 'obj_values': [None, 10, -2, None]},
)
def test_restore_pool(self, x_values, obj_values):
FILL_FUNC_BODY def test_restore_rng(self):
... | class SerializationTest(parameterized.TestCase):
@parameterized.parameters(
{'x_values': [1, 2, 5, -2], 'obj_values': [2, 10, -2, 5]},
{'x_values': [1, 2, 5, -2], 'obj_values': [None, 10, -2, None]},
)
def test_restore_pool(self, x_values, obj_values):
FILL_FUNC_BODY def test_restore_rng(self):
... | firefly_pool = testing.create_fake_populated_firefly_pool(
capacity=20, x_values=x_values, obj_values=obj_values
)
encoded = serialization.partially_serialize_firefly_pool(firefly_pool)
# Restore the firefly pool.
utils = firefly_pool._utils
restored_firefly_pool = serialization.restore_... | firefly_pool = testing.create_fake_populated_firefly_pool(
capacity=20, x_values=x_values, obj_values=obj_values
)
encoded = serialization.partially_serialize_firefly_pool(firefly_pool)
# Restore the firefly pool.
utils = firefly_pool._utils
restored_firefly_pool = serialization.restore_... | 72 | 228 | 592 | 820 | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,922 | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/designers/emukit_test.py | 30,32 | 28,62 | test_on_flat_space | EmukitTest | 32,62 | 32,62 | class EmukitTest(parameterized.TestCase):
@parameterized.parameters(((v,) for v in emukit.Version))
def test_on_flat_space(self, version):
FILL_FUNC_BODY | class EmukitTest(parameterized.TestCase):
@parameterized.parameters(((v,) for v in emukit.Version))
def test_on_flat_space(self, version):
FILL_FUNC_BODY | config = vz.ProblemStatement(
search_space=test_studies.flat_space_with_all_types(),
metric_information=[
vz.MetricInformation(
name='x1', goal=vz.ObjectiveMetricGoal.MAXIMIZE)
])
designer = emukit.EmukitDesigner(
config, num_random_samples=10, metadat... | config = vz.ProblemStatement(
search_space=test_studies.flat_space_with_all_types(),
metric_information=[
vz.MetricInformation(
name='x1', goal=vz.ObjectiveMetricGoal.MAXIMIZE)
])
designer = emukit.EmukitDesigner(
config, num_random_samples=10, metadat... | 55 | 58 | 336 | 394 | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,923 | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/designers/grid.py | 160,164 | 35,215 | _grid_points_from_parameter_config | GridSearchDesigner | 165,198 | 164,198 | @attrs.define(auto_attribs=False, init=False)
class GridSearchDesigner(algorithms.PartiallySerializableDesigner):
"""Grid Search designer.
This designer searches over a grid of hyper-parameter values.
NOTE: The grid search index (i.e. which grid point to output) is based the
number of suggestions created so f... | @attrs.define(auto_attribs=False, init=False)
class GridSearchDesigner(algorithms.PartiallySerializableDesigner):
"""Grid Search designer.
This designer searches over a grid of hyper-parameter values.
NOTE: The grid search index (i.e. which grid point to output) is based the
number of suggestions created so f... | if parameter_config.type == pyvizier.ParameterType.DOUBLE:
min_value, max_value = parameter_config.bounds
if min_value == max_value:
return [pyvizier.ParameterValue(value=min_value)]
converter = converters.DefaultModelInputConverter(
parameter_config, scale=True
)
gr... | """Produces grid points from a parameter_config."""
if parameter_config.type == pyvizier.ParameterType.DOUBLE:
min_value, max_value = parameter_config.bounds
if min_value == max_value:
return [pyvizier.ParameterValue(value=min_value)]
converter = converters.DefaultModelInputConverter(... | 80 | 1,630 | 383 | 2,013 | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,924 | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/designers/harmonica_test.py | 27,28 | 25,43 | test_make_suggestions | HarmonicaTest | 28,43 | 28,43 | class HarmonicaTest(absltest.TestCase):
def test_make_suggestions(self):
FILL_FUNC_BODY | class HarmonicaTest(absltest.TestCase):
def test_make_suggestions(self):
FILL_FUNC_BODY | experimenter = combo_experimenter.IsingExperimenter(lamda=0.01)
designer = harmonica.HarmonicaDesigner(
experimenter.problem_statement(), num_init_samples=1)
num_trials = 10
trials = test_runners.run_with_random_metrics(
designer,
experimenter.problem_statement(),
iters=... | experimenter = combo_experimenter.IsingExperimenter(lamda=0.01)
designer = harmonica.HarmonicaDesigner(
experimenter.problem_statement(), num_init_samples=1)
num_trials = 10
trials = test_runners.run_with_random_metrics(
designer,
experimenter.problem_statement(),
iters=... | 22 | 37 | 163 | 200 | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,925 | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/designers/meta_learning/eagle_meta_learning.py | 23,24 | 1,109 | meta_eagle_search_space | 25,109 | 24,109 | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | search_space = vz.SearchSpace()
# Perturbation
search_space.root.add_float_param(
name='perturbation',
min_value=1e-4,
max_value=1e2,
default_value=1e-1,
scale_type=vz.ScaleType.LOG,
)
search_space.root.add_float_param(
name='perturbation_lower_bound',
min_value=1e-5,... | """Returns the meta eagle search space."""
search_space = vz.SearchSpace()
# Perturbation
search_space.root.add_float_param(
name='perturbation',
min_value=1e-4,
max_value=1e2,
default_value=1e-1,
scale_type=vz.ScaleType.LOG,
)
search_space.root.add_float_param(
name='per... | 111 | 232 | 984 | 1,216 | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
46,927 | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/designers/meta_learning/meta_learning_utils.py | 102,108 | 23,129 | _is_trial_better | MetaLearningUtils | 109,129 | 108,129 | @attrs.define(kw_only=True)
class MetaLearningUtils:
"""Meta learning utils class."""
# The objective goal of 'meta' and 'tuned' algorithms.
_goal: vz.ObjectiveMetricGoal
# The metric name associated with the 'tuned' designer trials.
_tuned_metric_name: str
# The metric name associated with the 'meta' desi... | @attrs.define(kw_only=True)
class MetaLearningUtils:
"""Meta learning utils class."""
# The objective goal of 'meta' and 'tuned' algorithms.
_goal: vz.ObjectiveMetricGoal
# The metric name associated with the 'tuned' designer trials.
_tuned_metric_name: str
# The metric name associated with the 'meta' desi... | if metric_name not in trial1.final_measurement_or_die.metrics:
raise ValueError(
f"Metric name ({metric_name}) not found in trial1. {trial1}"
)
if metric_name not in trial2.final_measurement_or_die.metrics:
raise ValueError(
f"Metric name ({metric_name}) not found in trial2... | """Returns whether trial1 is better than trial2 in terms of `metric_name`."""
if metric_name not in trial1.final_measurement_or_die.metrics:
raise ValueError(
f"Metric name ({metric_name}) not found in trial1. {trial1}"
)
if metric_name not in trial2.final_measurement_or_die.metrics:
... | 69 | 1,097 | 286 | 1,383 | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46,928 | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier | /home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/designers/meta_learning/meta_learning_utils_test.py | 52,53 | 26,77 | test_best_trial | MetaLearningUtilsTest | 53,60 | 53,60 | class MetaLearningUtilsTest(parameterized.TestCase):
def setUp(self):
super().setUp()
space = vz.SearchSpace()
space.root.add_int_param('tuned_param', 0, 100, default_value=55)
self.utils = meta_learning_utils.MetaLearningUtils(
goal=vz.ObjectiveMetricGoal.MAXIMIZE,
tuned_metric_name=... | class MetaLearningUtilsTest(parameterized.TestCase):
def setUp(self):
super().setUp()
space = vz.SearchSpace()
space.root.add_int_param('tuned_param', 0, 100, default_value=55)
self.utils = meta_learning_utils.MetaLearningUtils(
goal=vz.ObjectiveMetricGoal.MAXIMIZE,
tuned_metric_name=... | # meta trial
best_meta_trial = self.utils.get_best_meta_trial(self.meta_trials)
self.assertEqual(best_meta_trial.parameters['meta_param'].value, 9)
# tuned trial
best_tuned_trial = self.utils.get_best_tuned_trial(self.tuned_trials)
self.assertEqual(best_tuned_trial.parameters['tuned_param'].valu... | # meta trial
best_meta_trial = self.utils.get_best_meta_trial(self.meta_trials)
self.assertEqual(best_meta_trial.parameters['meta_param'].value, 9)
# tuned trial
best_tuned_trial = self.utils.get_best_tuned_trial(self.tuned_trials)
self.assertEqual(best_tuned_trial.parameters['tuned_param'].valu... | 16 | 594 | 135 | 729 | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.