Skip to content

Commit

Permalink
Be more explicit about presubmit errors (AFLplusplus#284)
Browse files Browse the repository at this point in the history
Explicitly say that there are errors so that errors are easier to spot when
viewing CI output.
Also update google-auth library to get rid of error when installing requirements.txt
  • Loading branch information
jonathanmetzman committed Apr 29, 2020
1 parent 8fba13d commit 890fb3a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 25 deletions.
7 changes: 1 addition & 6 deletions experiment/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,13 @@ def test_run_fuzzer_log_file(mocked_communicate, fs):
EXPERIMENT = 'experiment-name'
TRIAL_NUM = 1
FUZZER = 'fuzzer-name-a'
FULL_FUZZER_NAME = FUZZER


@pytest.yield_fixture
def trial_runner(fs, environ):
"""Fixture that creates a TrialRunner object."""
os.environ.update({
'BENCHMARK': BENCHMARK,
'FUZZER_VARIANT_NAME': FULL_FUZZER_NAME,
'EXPERIMENT': EXPERIMENT,
'TRIAL_ID': str(TRIAL_NUM),
'FUZZER': FUZZER,
Expand Down Expand Up @@ -240,16 +238,14 @@ def test_integration_runner(self, mocked_error, tmp_path, environ):
os.environ['OUTPUT_CORPUS_DIR'] = str(output_corpus_dir)

fuzzer = 'libfuzzer'
fuzzer_variant = fuzzer + '_variant'
fuzzer_parent_path = root_dir / 'fuzzers' / fuzzer

benchmark = 'MultipleConstraintsOnSmallInputTest'
test_experiment_bucket = os.environ['TEST_CLOUD_EXPERIMENT_BUCKET']
experiment = 'integration-test-experiment'
gcs_directory = posixpath.join(test_experiment_bucket, experiment,
'experiment-folders',
'%s-%s' % (benchmark, fuzzer_variant),
'trial-1')
'%s-%s' % (benchmark, fuzzer), 'trial-1')
gsutil.rm(gcs_directory, force=True)
# Add fuzzer directory to make it easy to run fuzzer.py in local
# configuration.
Expand All @@ -258,7 +254,6 @@ def test_integration_runner(self, mocked_error, tmp_path, environ):

# Set env variables that would set by the scheduler.
os.environ['FUZZER'] = fuzzer
os.environ['FUZZER_VARIANT_NAME'] = fuzzer_variant
os.environ['BENCHMARK'] = benchmark
os.environ['CLOUD_EXPERIMENT_BUCKET'] = test_experiment_bucket
os.environ['EXPERIMENT'] = experiment
Expand Down
34 changes: 16 additions & 18 deletions presubmit.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ def do_checks(changed_files: List[Path]) -> bool:

for check in [license_check, yapf, lint, pytype]:
if not check(changed_files):
print('ERROR: %s failed, see errors above.' % check.__name__)
success = False

if not do_tests():
Expand Down Expand Up @@ -338,27 +339,24 @@ def main() -> int:
os.chdir(_SRC_ROOT)
changed_files = get_changed_files()

if args.command == 'format':
success = yapf(changed_files, False)
if not args.command:
success = do_checks(changed_files)
return bool_to_returncode(success)

if args.command == 'lint':
success = lint(changed_files)
return bool_to_returncode(success)
command_check_mapping = {
'format': yapf,
'lint': lint,
'typecheck': pytype,
'test_changed_integrations': test_changed_integrations
}

if args.command == 'typecheck':
success = pytype(changed_files)
return bool_to_returncode(success)

if args.command == 'licensecheck':
success = license_check(changed_files)
return bool_to_returncode(success)

if args.command == 'test_changed_integrations':
success = test_changed_integrations(changed_files)
return bool_to_returncode(success)

success = do_checks(changed_files)
check = command_check_mapping[args.command]
if args.command == 'format':
success = check(changed_files, False)
else:
success = check(changed_files)
if not success:
print('ERROR: %s failed, see errors above.' % check.__name__)
return bool_to_returncode(success)


Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
alembic==1.4.0
google-auth==1.11.0
google-auth==1.14.0
google-cloud-error-reporting==0.33.0
google-cloud-logging==1.14.0
Jinja2==2.11.1
Expand Down

0 comments on commit 890fb3a

Please sign in to comment.