Fixed #9830 (Addons should return 0 when success)
This commit is contained in:
parent
acd1e848dd
commit
c6d2e0fae1
|
@ -439,3 +439,5 @@ if __name__ == '__main__':
|
|||
if actual not in VERIFY_EXPECTED:
|
||||
print('Not expected: ' + actual)
|
||||
sys.exit(1)
|
||||
|
||||
sys.exit(cppcheckdata.EXIT_CODE)
|
||||
|
|
|
@ -13,6 +13,8 @@ import sys
|
|||
from xml.etree import ElementTree
|
||||
from fnmatch import fnmatch
|
||||
|
||||
EXIT_CODE = 0
|
||||
|
||||
class Directive:
|
||||
"""
|
||||
Directive class. Contains information about each preprocessor directive in the source code.
|
||||
|
@ -1102,3 +1104,5 @@ def reportError(location, severity, message, addon, errorId, extra=''):
|
|||
if len(extra) > 0:
|
||||
message += ' (' + extra + ')'
|
||||
sys.stderr.write('%s (%s) %s [%s-%s]\n' % (loc, severity, message, addon, errorId))
|
||||
global EXIT_CODE
|
||||
EXIT_CODE = 1
|
||||
|
|
|
@ -38,3 +38,5 @@ for arg in sys.argv[1:]:
|
|||
continue
|
||||
|
||||
cppcheckdata.reportError(token, 'information', 'found a cast', 'findcasts', 'cast')
|
||||
|
||||
sys.exit(cppcheckdata.EXIT_CODE)
|
||||
|
|
|
@ -163,3 +163,5 @@ for arg in sys.argv[1:]:
|
|||
if actual not in VERIFY_EXPECTED:
|
||||
print('Not expected: ' + actual)
|
||||
sys.exit(1)
|
||||
|
||||
sys.exit(cppcheckdata.EXIT_CODE)
|
||||
|
|
|
@ -3126,7 +3126,6 @@ def main():
|
|||
if args.severity:
|
||||
checker.setSeverity(args.severity)
|
||||
|
||||
exitCode = 0
|
||||
for item in args.dumpfile:
|
||||
checker.parseDump(item)
|
||||
|
||||
|
@ -3134,6 +3133,7 @@ def main():
|
|||
verify_expected = checker.get_verify_expected()
|
||||
verify_actual = checker.get_verify_actual()
|
||||
|
||||
exitCode = 0
|
||||
for expected in verify_expected:
|
||||
if expected not in verify_actual:
|
||||
print('Expected but not seen: ' + expected)
|
||||
|
@ -3150,13 +3150,11 @@ def main():
|
|||
if exitCode != 0:
|
||||
sys.exit(exitCode)
|
||||
|
||||
# Under normal operation exit with a non-zero exit code
|
||||
# if there were any violations.
|
||||
if not settings.verify:
|
||||
if settings.verify:
|
||||
sys.exit(exitCode)
|
||||
|
||||
number_of_violations = len(checker.get_violations())
|
||||
if number_of_violations > 0:
|
||||
exitCode = 1
|
||||
|
||||
if settings.show_summary:
|
||||
print("\nMISRA rules violations found:\n\t%s\n" % (
|
||||
"\n\t".join(["%s: %d" % (viol, len(checker.get_violations(viol))) for viol in
|
||||
|
@ -3183,8 +3181,7 @@ def main():
|
|||
if args.show_suppressed_rules:
|
||||
checker.showSuppressedRules()
|
||||
|
||||
sys.exit(exitCode)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
sys.exit(cppcheckdata.EXIT_CODE)
|
||||
|
|
|
@ -87,3 +87,5 @@ for arg in sys.argv[1:]:
|
|||
if not res:
|
||||
reportError(
|
||||
scope.bodyStart, 'style', 'Function ' + scope.className + ' violates naming convention', 'functionName')
|
||||
|
||||
sys.exit(cppcheckdata.EXIT_CODE)
|
||||
|
|
|
@ -249,4 +249,5 @@ if __name__ == "__main__":
|
|||
if len(errors):
|
||||
print('Found errors: {}'.format(len(errors)))
|
||||
sys.exit(1)
|
||||
|
||||
sys.exit(0)
|
||||
|
|
|
@ -34,3 +34,5 @@ for arg in sys.argv[1:]:
|
|||
for cfg in data.iterconfigurations():
|
||||
print('Checking %s, config %s...' % (arg, cfg.name))
|
||||
checkstatic(cfg)
|
||||
|
||||
sys.exit(cppcheckdata.EXIT_CODE)
|
||||
|
|
|
@ -243,17 +243,9 @@ if __name__ == '__main__':
|
|||
sys.exit(0)
|
||||
|
||||
for dumpfile in args.dumpfile:
|
||||
if not os.path.isfile(dumpfile):
|
||||
print("Error: File not found: %s" % dumpfile)
|
||||
sys.exit(127)
|
||||
if not os.access(dumpfile, os.R_OK):
|
||||
print("Error: Permission denied: %s" % dumpfile)
|
||||
sys.exit(13)
|
||||
if not args.quiet:
|
||||
print('Checking ' + dumpfile + '...')
|
||||
|
||||
y2038safe = check_y2038_safe(dumpfile, quiet)
|
||||
if not y2038safe and exit_code == 0:
|
||||
exit_code = 1
|
||||
check_y2038_safe(dumpfile, quiet)
|
||||
|
||||
sys.exit(exit_code)
|
||||
sys.exit(cppcheckdata.EXIT_CODE)
|
||||
|
|
Loading…
Reference in New Issue