Index: tools/valgrind/drmemory_analyze.py |
diff --git a/tools/valgrind/drmemory_analyze.py b/tools/valgrind/drmemory_analyze.py |
index a7e9d5ec1b482aa55321c2d6719ec6a548fbcbaf..b33ff76090b187c75bdee3899472ae993e3f6240 100755 |
--- a/tools/valgrind/drmemory_analyze.py |
+++ b/tools/valgrind/drmemory_analyze.py |
@@ -1,4 +1,4 @@ |
-#!/usr/bin/python |
+#!/usr/bin/env python |
# Copyright (c) 2011 The Chromium Authors. All rights reserved. |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
@@ -103,9 +103,9 @@ class DrMemoryAnalyze: |
logging.info("PASS: No error reports found") |
return 0 |
-if __name__ == '__main__': |
+ |
+def main(): |
'''For testing only. The DrMemoryAnalyze class should be imported instead.''' |
- retcode = 0 |
parser = optparse.OptionParser("usage: %prog [options] <files to analyze>") |
parser.add_option("", "--source_dir", |
help="path to top of source tree for this build" |
@@ -117,6 +117,8 @@ if __name__ == '__main__': |
filenames = args |
analyzer = DrMemoryAnalyze(options.source_dir, filenames) |
- retcode = analyzer.Report(False) |
+ return analyzer.Report(False) |
- sys.exit(retcode) |
+ |
+if __name__ == '__main__': |
+ sys.exit(main()) |