mirror of https://github.com/google/oss-fuzz.git
* [infra] Make presubmit script handle experimental flag in project.yaml (#3277). * make Travis happy * address review feedback * fix one more comment * fix yaml file and address review feedback
This commit is contained in:
parent
8e2d57684b
commit
9918ef3f67
|
@ -119,11 +119,11 @@ class ProjectYamlChecker:
|
||||||
"""Is this project disabled."""
|
"""Is this project disabled."""
|
||||||
return self.data.get('disabled', False)
|
return self.data.get('disabled', False)
|
||||||
|
|
||||||
def print_error(self, message, *args):
|
def error(self, message):
|
||||||
"""Print an error message and set self.success to False."""
|
"""Print an error message and set self.success to False."""
|
||||||
self.success = False
|
self.success = False
|
||||||
message = message % args
|
print('Error in {filename}: {message}'.format(filename=self.filename,
|
||||||
print('Error in %s: %s' % (self.filename, message))
|
message=message))
|
||||||
|
|
||||||
def check_project_yaml_constants(self):
|
def check_project_yaml_constants(self):
|
||||||
"""Check that certain sections only have certain constant values."""
|
"""Check that certain sections only have certain constant values."""
|
||||||
|
@ -132,22 +132,36 @@ class ProjectYamlChecker:
|
||||||
continue
|
continue
|
||||||
actual_constants = self.data[section]
|
actual_constants = self.data[section]
|
||||||
for constant in actual_constants:
|
for constant in actual_constants:
|
||||||
if constant not in allowed_constants:
|
if isinstance(constant, str):
|
||||||
self.print_error('%s (in %s section) is not one of %s', constant,
|
if constant not in allowed_constants:
|
||||||
section, allowed_constants)
|
self.error(('{constant} (in {section} section) is not a valid '
|
||||||
|
'constant ({allowed_constants}).').format(
|
||||||
|
constant=constant,
|
||||||
|
section=section,
|
||||||
|
allowed_constants=', '.join(allowed_constants)))
|
||||||
|
elif isinstance(constant, dict):
|
||||||
|
# The only alternative value allowed is the experimental flag, i.e.
|
||||||
|
# `constant == {'memory': {'experimental': True}}`. Do not check the
|
||||||
|
# experimental flag, but assert that the sanitizer is a valid one.
|
||||||
|
if (len(constant.keys()) > 1 or
|
||||||
|
list(constant.keys())[0] not in allowed_constants):
|
||||||
|
self.error('Not allowed value in the project.yaml: ' +
|
||||||
|
str(constant))
|
||||||
|
else:
|
||||||
|
self.error('Not allowed value in the project.yaml: ' + str(constant))
|
||||||
|
|
||||||
def check_valid_section_names(self):
|
def check_valid_section_names(self):
|
||||||
"""Check that only valid sections are included."""
|
"""Check that only valid sections are included."""
|
||||||
for name in self.data:
|
for name in self.data:
|
||||||
if name not in self.VALID_SECTION_NAMES:
|
if name not in self.VALID_SECTION_NAMES:
|
||||||
self.print_error('%s not a valid section name (%s)', name,
|
self.error('{name} is not a valid section name ({valid_names})'.format(
|
||||||
self.VALID_SECTION_NAMES)
|
name=name, valid_names=self.VALID_SECTION_NAMES))
|
||||||
|
|
||||||
def check_required_sections(self):
|
def check_required_sections(self):
|
||||||
"""Check that all required sections are present."""
|
"""Check that all required sections are present."""
|
||||||
for section in self.REQUIRED_SECTIONS:
|
for section in self.REQUIRED_SECTIONS:
|
||||||
if section not in self.data:
|
if section not in self.data:
|
||||||
self.print_error('No %s section.', section)
|
self.error(section + ' section is missing.')
|
||||||
|
|
||||||
def check_valid_emails(self):
|
def check_valid_emails(self):
|
||||||
"""Check that emails are valid looking."""
|
"""Check that emails are valid looking."""
|
||||||
|
@ -163,7 +177,7 @@ class ProjectYamlChecker:
|
||||||
# Sanity check them.
|
# Sanity check them.
|
||||||
for email_address in email_addresses:
|
for email_address in email_addresses:
|
||||||
if '@' not in email_address or '.' not in email_address:
|
if '@' not in email_address or '.' not in email_address:
|
||||||
self.print_error('%s is an invalid email address.', email_address)
|
self.error(email_address + ' is an invalid email address.')
|
||||||
|
|
||||||
|
|
||||||
def _check_one_project_yaml(project_yaml_filename):
|
def _check_one_project_yaml(project_yaml_filename):
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
homepage: "https://www.wolfssl.com/"
|
homepage: "https://www.wolfssl.com/"
|
||||||
primary_contact: "jacob@wolfssl.com"
|
primary_contact: "jacob@wolfssl.com"
|
||||||
auto_ccs:
|
auto_ccs:
|
||||||
- "david@wolfssl.com"
|
- "david@wolfssl.com"
|
||||||
- "kaleb@wolfssl.com"
|
- "kaleb@wolfssl.com"
|
||||||
- "levi@wolfssl.com"
|
- "levi@wolfssl.com"
|
||||||
- "testing@wolfssl.com"
|
- "testing@wolfssl.com"
|
||||||
fuzzing_engines:
|
fuzzing_engines:
|
||||||
- libfuzzer
|
- libfuzzer
|
||||||
- afl
|
- afl
|
||||||
- honggfuzz
|
- honggfuzz
|
||||||
- dataflow
|
- dataflow
|
||||||
sanitizers:
|
sanitizers:
|
||||||
- address
|
- address
|
||||||
- memory:
|
- memory:
|
||||||
experimental: True
|
experimental: True
|
||||||
- undefined
|
- undefined
|
||||||
- dataflow
|
- dataflow
|
||||||
|
|
Loading…
Reference in New Issue