From f9a68709719a57fff5272d025850e812ce39da2e Mon Sep 17 00:00:00 2001 From: jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com> Date: Mon, 13 May 2019 09:55:06 -0700 Subject: [PATCH] [travis] Improve build script (#2404) Improve print statements and handling of projects that do not list sanitizers in project.yaml. --- infra/travis/travis_build.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/infra/travis/travis_build.py b/infra/travis/travis_build.py index f6e6a821e..60f4ab409 100644 --- a/infra/travis/travis_build.py +++ b/infra/travis/travis_build.py @@ -25,6 +25,7 @@ import yaml DEFAULT_FUZZING_ENGINES = ['afl', 'libfuzzer'] +DEFAULT_SANITIZERS = ['address', 'undefined'] def get_modified_projects(): @@ -47,6 +48,7 @@ def execute_helper_command(helper_command): root = get_oss_fuzz_root() script_path = os.path.join(root, 'infra', 'helper.py') command = ['python', script_path] + helper_command + print('Running command: %s' % ' '.join(command)) subprocess.check_call(command) @@ -89,22 +91,22 @@ def build_project(project): if 'libfuzzer' not in fuzzing_engines: return - for sanitizer in project_yaml['sanitizers']: + for sanitizer in project_yaml.get('sanitizers', DEFAULT_SANITIZERS): build_fuzzers(project, sanitizer, 'libfuzzer') check_build(project, sanitizer, 'libfuzzer') def main(): projects = get_modified_projects() - failures = [] + failed_projects = [] for project in projects: try: build_project(project) except subprocess.CalledProcessError: - failures.append(project) + failed_projects.append(project) - if failures: - print('Failures:', ' '.join(failures)) + if failed_projects: + print('Failed projects:', ' '.join(failed_projects)) exit(1) if __name__ == '__main__':