cifuzz: Rename run-fuzzers-mode to mode. (#6600)

Also change the default value of "ci" to the more consistent and
descriptive "code-change".
This commit is contained in:
Oliver Chang 2021-10-20 15:02:17 +11:00 committed by GitHub
parent e801a34379
commit 9aa85855b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 18 deletions

View File

@ -19,14 +19,15 @@ inputs:
sanitizer:
description: 'The sanitizer to run the fuzzers with.'
default: 'address'
run-fuzzers-mode:
mode:
description: |
The mode to run the fuzzers with ("ci" or "batch").
"ci" is for fuzzing a pull request or commit.
The mode to run the fuzzers with ("code-change", "batch", "coverage", or "prune").
"code-change" is for fuzzing a pull request or commit.
"batch" is for non-interactive fuzzing of an entire project.
"batch" is in alpha and should not be used in production.
"coverage" is for coverage generation.
"prune" is for corpus pruning.
required: false
default: 'ci'
default: 'code-change'
github-token:
description: |
Token for GitHub API. WARNING: THIS SHOULD NOT BE USED IN PRODUCTION YET
@ -48,7 +49,7 @@ runs:
FUZZ_SECONDS: ${{ inputs.fuzz-seconds }}
DRY_RUN: ${{ inputs.dry-run}}
SANITIZER: ${{ inputs.sanitizer }}
RUN_FUZZERS_MODE: ${{ inputs.run-fuzzers-mode }}
RUN_FUZZERS_MODE: ${{ inputs.mode }}
GITHUB_TOKEN: ${{ inputs.github-token }}
LOW_DISK_SPACE: 'True'
REPORT_UNREPRODUCIBLE_CRASHES: ${{ inputs.report-unreproducible-crashes }}

View File

@ -26,7 +26,7 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import constants
RUN_FUZZERS_MODES = ['batch', 'ci', 'coverage', 'prune']
RUN_FUZZERS_MODES = ['batch', 'code-change', 'coverage', 'prune']
SANITIZERS = ['address', 'memory', 'undefined', 'coverage']
# TODO(metzman): Set these on config objects so there's one source of truth.
@ -307,7 +307,8 @@ class RunFuzzersConfig(BaseConfig):
super().__init__()
# TODO(metzman): Pick a better default for pruning.
self.fuzz_seconds = int(os.environ.get('FUZZ_SECONDS', 600))
self.run_fuzzers_mode = os.environ.get('RUN_FUZZERS_MODE', 'ci').lower()
self.run_fuzzers_mode = os.environ.get('RUN_FUZZERS_MODE',
'code-change').lower()
if self.is_coverage:
self.run_fuzzers_mode = 'coverage'

View File

@ -138,13 +138,13 @@ class RunFuzzersConfigTest(unittest.TestCase):
is_coverage."""
# Test that it is overriden when it is supposed to be.
os.environ['SANITIZER'] = 'coverage'
os.environ['RUN_FUZZERS_MODE'] = 'ci'
os.environ['RUN_FUZZERS_MODE'] = 'code-change'
config = self._create_config()
self.assertEqual(config.run_fuzzers_mode, 'coverage')
# Test that it isn't overriden when it isn't supposed to be.
os.environ['SANITIZER'] = 'address'
run_fuzzers_mode = 'ci'
run_fuzzers_mode = 'code-change'
os.environ['RUN_FUZZERS_MODE'] = run_fuzzers_mode
config = self._create_config()
self.assertEqual(config.run_fuzzers_mode, run_fuzzers_mode)

View File

@ -16,14 +16,15 @@ inputs:
sanitizer:
description: 'The sanitizer to run the fuzzers with.'
default: 'address'
run-fuzzers-mode:
mode:
description: |
The mode to run the fuzzers with ("ci" or "batch").
"ci" is for fuzzing a pull request or commit.
The mode to run the fuzzers with ("code-change", "batch", "coverage", or "prune").
"code-change" is for fuzzing a pull request or commit.
"batch" is for non-interactive fuzzing of an entire project.
"batch" is in alpha and should not be used in production.
"coverage" is for coverage generation.
"prune" is for corpus pruning.
required: false
default: 'ci'
default: 'code-change'
github-token:
description: |
Token for GitHub API. WARNING: THIS SHOULD NOT BE USED IN PRODUCTION YET
@ -60,7 +61,7 @@ runs:
FUZZ_SECONDS: ${{ inputs.fuzz-seconds }}
DRY_RUN: ${{ inputs.dry-run}}
SANITIZER: ${{ inputs.sanitizer }}
RUN_FUZZERS_MODE: ${{ inputs.run-fuzzers-mode }}
RUN_FUZZERS_MODE: ${{ inputs.mode }}
GITHUB_TOKEN: ${{ inputs.github-token }}
LOW_DISK_SPACE: 'True'
GIT_STORE_REPO: ${{ inputs.storage-repo }}

View File

@ -267,7 +267,7 @@ _RUN_FUZZERS_MODE_RUNNER_MAPPING = {
'batch': BatchFuzzTargetRunner,
'coverage': CoverageTargetRunner,
'prune': PruneTargetRunner,
'ci': CiFuzzTargetRunner,
'code-change': CiFuzzTargetRunner,
}

View File

@ -458,7 +458,7 @@ class GetFuzzTargetRunnerTest(unittest.TestCase):
@parameterized.parameterized.expand([
('batch', run_fuzzers.BatchFuzzTargetRunner),
('ci', run_fuzzers.CiFuzzTargetRunner),
('code-change', run_fuzzers.CiFuzzTargetRunner),
('coverage', run_fuzzers.CoverageTargetRunner)
])
def test_get_fuzz_target_runner(self, run_fuzzers_mode,