diff options
author | Leo Neat <leosneat@gmail.com> | 2020-01-29 14:10:04 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-29 14:10:04 -0800 |
commit | 4d5e5016c0aa6fc383922dcd61113122b72b7625 (patch) | |
tree | 9d63b860b599b4d1a50a74919a3e296786e7c04a | |
parent | 606824ae7ca405223e5c243765198058564952b6 (diff) | |
download | oss-fuzz-4d5e5016c0aa6fc383922dcd61113122b72b7625.tar.gz |
[Infra] Update print statements (#3305)
-rw-r--r-- | infra/base-images/base-builder/detect_repo.py | 5 | ||||
-rw-r--r-- | infra/bisector.py | 10 | ||||
-rw-r--r-- | infra/build_specified_commit.py | 11 |
3 files changed, 15 insertions, 11 deletions
diff --git a/infra/base-images/base-builder/detect_repo.py b/infra/base-images/base-builder/detect_repo.py index e4570ed76..272a915d3 100644 --- a/infra/base-images/base-builder/detect_repo.py +++ b/infra/base-images/base-builder/detect_repo.py @@ -26,6 +26,7 @@ seperated by a space. """ import argparse +import logging import os import subprocess @@ -64,8 +65,8 @@ def main(): if args.repo_name and check_for_repo_name(full_path, args.repo_name): print('Detected repo:', get_repo(full_path), full_path) return - print('No git repos with specific commit: %s found in %s' % - (args.example_commit, src_dir)) + logging.error('No git repos with specific commit: %s found in %s', + args.example_commit, src_dir) def get_repo(repo_path): diff --git a/infra/bisector.py b/infra/bisector.py index 11ffd0189..9ea2221ea 100644 --- a/infra/bisector.py +++ b/infra/bisector.py @@ -31,6 +31,7 @@ This is done with the following steps: """ import argparse +import logging import tempfile import build_specified_commit @@ -77,12 +78,13 @@ def main(): error_sha = bisect(args.commit_old, args.commit_new, args.testcase, args.fuzz_target, build_data) if not error_sha: - print('No error was found in commit range %s:%s' % - (args.commit_old, args.commit_new)) + logging.error('No error was found in commit range %s:%s', args.commit_old, + args.commit_new) return 1 if error_sha == args.commit_old: - print('Bisection Error: Both the first and the last commits in the given ' + - 'range have the same behavior, bisection is not possible. ') + logging.error( + 'Bisection Error: Both the first and the last commits in' + 'the given range have the same behavior, bisection is not possible. ') return 1 print('Error was introduced at commit %s' % error_sha) return 0 diff --git a/infra/build_specified_commit.py b/infra/build_specified_commit.py index a4f95eb67..85f844ad2 100644 --- a/infra/build_specified_commit.py +++ b/infra/build_specified_commit.py @@ -19,9 +19,9 @@ like continuious integration fuzzing and bisection to find errors """ import os import collections +import logging import re import subprocess -import sys import helper import utils @@ -68,16 +68,17 @@ def detect_main_repo(project_name, repo_name=None, commit=None): """ if not repo_name and not commit: - print('Error: can not detect main repo without a repo_name or a commit.') + logging.error( + 'Error: can not detect main repo without a repo_name or a commit.') return None, None if repo_name and commit: - print('Both repo name and commit specific. Using repo name for detection.') + logging.info( + 'Both repo name and commit specific. Using repo name for detection.') # Change to oss-fuzz main directory so helper.py runs correctly. utils.chdir_to_root() if not helper.build_image_impl(project_name): - print('Error: building {} image failed.'.format(project_name), - file=sys.stderr) + logging.error('Error: building %s image failed.', project_name) return None, None docker_image_name = 'gcr.io/oss-fuzz/' + project_name command_to_run = [ |