Permalink
Browse files

Make the error messages clearer in sh_spec.py.

Print a FATAL error when the number of allowed failures is not what we
got.
  • Loading branch information...
Andy Chu
Andy Chu committed Dec 10, 2017
1 parent 523ed53 commit 20daec3b42db6fac550f1e54da550123e931f0c6
Showing with 17 additions and 11 deletions.
  1. +17 −11 test/sh_spec.py
View
@@ -895,21 +895,27 @@ def main(argv):
f.write('\n') # bash 'read' requires a newline
if stats['num_failed'] == 0:
#if stats['osh_num_passed'] == 0:
# print('*** Exit with status 2 because osh not tested', file=sys.stderr)
# return 2 # Change success to exit code 2 if we didn't run osh
return 0
allowed = opts.osh_failures_allowed
all_count = stats['num_failed']
osh_count = stats['osh_num_failed']
if allowed == 0:
log('')
log('FATAL: %d tests failed (%d osh failures)', all_count, osh_count)
log('')
else:
allowed = opts.osh_failures_allowed
all_count = stats['num_failed']
osh_count = stats['osh_num_failed']
# If we got the allowed number of failures, exit 0.
if allowed != 0 and allowed == all_count and all_count == osh_count:
print('*** Got %d allowed osh failures, exit with status 0' % allowed,
file=sys.stderr)
# If we got EXACTLY the allowed number of failures, exit 0.
if allowed == all_count and all_count == osh_count:
log('note: Got %d allowed osh failures (exit with code 0)', allowed)
return 0
else:
log('')
log('FATAL: Got %d failures (%d osh failures), but %d are allowed',
all_count, osh_count, allowed)
log('')
return 1
return 1
if __name__ == '__main__':

0 comments on commit 20daec3

Please sign in to comment.