aboutsummaryrefslogtreecommitdiff
path: root/infra/presubmit.py
diff options
context:
space:
mode:
authorLeo Neat <leosneat@gmail.com>2020-03-05 08:44:18 -0800
committerGitHub <noreply@github.com>2020-03-05 08:44:18 -0800
commitffa49091d6a82a2b8bd4e932cc32e5cd6b6e6ad2 (patch)
treedeb1f007a9932c44ff40eb078aa02d5ea195e024 /infra/presubmit.py
parentc692c2262067422d2b1b538b80de755e8bdd4ddb (diff)
downloadoss-fuzz-ffa49091d6a82a2b8bd4e932cc32e5cd6b6e6ad2.tar.gz
[infra] Presubmit fix - test (#3443)
Fixes issue that presubmit test was not returning failure even when a test failed.
Diffstat (limited to 'infra/presubmit.py')
-rwxr-xr-xinfra/presubmit.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/infra/presubmit.py b/infra/presubmit.py
index c51f66b9a..feb63d40a 100755
--- a/infra/presubmit.py
+++ b/infra/presubmit.py
@@ -326,12 +326,14 @@ def run_tests():
changed_dirs = set()
for file in get_changed_files():
changed_dirs.add(os.path.dirname(file))
+
suite_list = []
for change_dir in changed_dirs:
suite_list.append(unittest.TestLoader().discover(change_dir,
pattern='*_test.py'))
full_suite = unittest.TestSuite(suite_list)
- unittest.TextTestRunner().run(full_suite)
+ result = unittest.TextTestRunner().run(full_suite)
+ return not result.failures
def main():
@@ -339,7 +341,7 @@ def main():
# Get program arguments.
parser = argparse.ArgumentParser(description='Presubmit script for oss-fuzz.')
parser.add_argument('command',
- choices=['format', 'lint', 'license', 'test'],
+ choices=['format', 'lint', 'license', 'infra-tests'],
nargs='?')
args = parser.parse_args()
@@ -360,8 +362,8 @@ def main():
success = check_license(changed_files)
return bool_to_returncode(success)
- if args.command == 'test':
- return run_tests()
+ if args.command == 'infra-tests':
+ return bool_to_returncode(run_tests())
# Do all the checks (but no tests).
success = do_checks(changed_files)