Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More informative logs to help debugging #2038

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions common/fuzzer_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ def dockerfiles(self):
def get_fuzz_target_binary(search_directory: str,
fuzz_target_name: str) -> Optional[str]:
"""Return target binary path."""
logs.info(f'Searching for fuzz target binary named {fuzz_target_name} under'
f' directory {search_directory}')
logs.info(f'Search diretory {os.path.abspath(search_directory)} exists: '
f'{os.path.exists(os.path.abspath(search_directory))}')
logs.info(f'list Search diretory {search_directory}: '
f'{os.listdir(search_directory)}')
if fuzz_target_name:
fuzz_target_binary = os.path.join(search_directory, fuzz_target_name)
if os.path.exists(fuzz_target_binary):
Expand All @@ -83,7 +89,11 @@ def get_fuzz_target_binary(search_directory: str,
if os.path.exists(default_fuzz_target_binary):
return default_fuzz_target_binary

logs.info('Searching for possible fuzz target in search directory: '
f'{search_directory}')
for root, _, files in os.walk(search_directory):
logs.info(f'Searching for possible fuzz target under subdir {root}: '
f'{files}')
if root == 'uninstrumented':
continue
for filename in files:
Expand Down
3 changes: 2 additions & 1 deletion experiment/build/gcb_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ def _build(
# TODO(metzman): Refactor code so that local_build stores logs as well.
build_utils.store_build_logs(config_name, result)
if result.retcode != 0:
logs.error('%s failed.', command)
logs.error('%s failed. Return code: %d. Output: %s. Timedout: %s',
command, result.retcode, result.output, result.timed_out)
raise subprocess.CalledProcessError(result.retcode, command)
return result

Expand Down
4 changes: 3 additions & 1 deletion experiment/measurer/coverage_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ def merge_profdata_files(self):

result = merge_profdata_files(files_to_merge, self.merged_profdata_file)
if result.retcode != 0:
logger.error('Profdata files merging failed.')
logger.error(
f'Profdata files merging failed for (fuzzer, benchmark): '
f'({self.fuzzer}, {self.benchmark}).')

def generate_coverage_summary_json(self):
"""Generates the coverage summary json from merged profdata file."""
Expand Down
5 changes: 4 additions & 1 deletion experiment/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,13 @@ def run_fuzzer(max_total_time, log_filename):
input_corpus = environment.get('SEED_CORPUS_DIR')
output_corpus = os.environ['OUTPUT_CORPUS_DIR']
fuzz_target_name = environment.get('FUZZ_TARGET')
logs.info('all ENV VAR '
f'{[f"{key}: {value}" for key, value in os.environ.items()]}')
target_binary = fuzzer_utils.get_fuzz_target_binary(FUZZ_TARGET_DIR,
fuzz_target_name)
if not target_binary:
logs.error('Fuzz target binary not found.')
logs.error(f'Fuzz target binary {fuzz_target_name} not found under '
f'{FUZZ_TARGET_DIR}')
return

if max_total_time is None:
Expand Down
1 change: 1 addition & 0 deletions service/gcbrun_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import logging
import os
import sys
# dummy

# pytype: disable=import-error
import github # pylint: disable=import-error
Expand Down
Loading