Skip to content

Commit

Permalink
Return a non-zero exit code if compiler invocations failed.
Browse files Browse the repository at this point in the history
This makes test_tool.py a little more user-friendly as a compile error
in a test source file will actually display now.

BUG=

Review URL: https://codereview.chromium.org/13607002

git-svn-id: http://src.chromium.org/svn/trunk/src/tools/clang@192356 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
  • Loading branch information
dcheng@chromium.org committed Apr 4, 2013
1 parent cb7bbdf commit f9bbb6b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scripts/run_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ def __init__(self, toolname, build_directory, filenames):
def edits(self):
return self.__edits

@property
def failed_count(self):
return self.__failed_count

def Run(self):
"""Does the grunt work."""
pool = multiprocessing.Pool()
Expand Down Expand Up @@ -260,7 +264,7 @@ def main(argv):
print ' <clang tool> is the clang tool that should be run.'
print ' <compile db> is the directory that contains the compile database'
print ' <path 1> <path2> ... can be used to filter what files are edited'
sys.exit(1)
return 1

filenames = frozenset(_GetFilesFromGit(argv[2:]))
# Filter out files that aren't C/C++/Obj-C/Obj-C++.
Expand All @@ -276,6 +280,9 @@ def main(argv):
if k in filenames})
# TODO(dcheng): Consider clang-formatting the result to avoid egregious style
# violations.
if dispatcher.failed_count != 0:
return 2
return 0


if __name__ == '__main__':
Expand Down

0 comments on commit f9bbb6b

Please sign in to comment.