Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(882)

Side by Side Diff: tools/purify/common.py

Issue 27079: Support for running unit-tests under valgrind on Mac (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/valgrind/chrome_tests.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/env python 1 #!/bin/env python
2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 # common.py 6 # common.py
7 7
8 """ Common code used by purify_test.py and quantify_test.py in order to automate 8 """ Common code used by purify_test.py and quantify_test.py in order to automate
9 running of Rational Purify and Quantify in a consistent manner. 9 running of Rational Purify and Quantify in a consistent manner.
10 """ 10 """
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 subprocess.call(["taskkill", "/T", "/F", "/PID", str(p.pid)]) 121 subprocess.call(["taskkill", "/T", "/F", "/PID", str(p.pid)])
122 logging.error("KILLED %d" % p.pid) 122 logging.error("KILLED %d" % p.pid)
123 # Give the process a chance to actually die before continuing 123 # Give the process a chance to actually die before continuing
124 # so that cleanup can happen safely. 124 # so that cleanup can happen safely.
125 time.sleep(1.0) 125 time.sleep(1.0)
126 logging.error("TIMEOUT waiting for %s" % proc[0]) 126 logging.error("TIMEOUT waiting for %s" % proc[0])
127 raise TimeoutError(proc[0]) 127 raise TimeoutError(proc[0])
128 elif not detach: 128 elif not detach:
129 for line in p.stdout.readlines(): 129 for line in p.stdout.readlines():
130 _print_line(line, False) 130 _print_line(line, False)
131 logging.info("flushing stdout") 131 if sys.platform != 'darwin': # stdout flush fails on Mac
132 p.stdout.flush() 132 logging.info("flushing stdout")
133 p.stdout.flush()
133 134
134 logging.info("collecting result code") 135 logging.info("collecting result code")
135 result = p.poll() 136 result = p.poll()
136 if result: 137 if result:
137 logging.error("%s exited with non-zero result code %d" % (proc[0], result)) 138 logging.error("%s exited with non-zero result code %d" % (proc[0], result))
138 return result 139 return result
139 140
140 141
141 def FixPath(path): 142 def FixPath(path):
142 """We pass computed paths to Rational as arguments, so these paths must be 143 """We pass computed paths to Rational as arguments, so these paths must be
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 logging.info("clearing instrumentation cache %s" % self._cache_dir) 325 logging.info("clearing instrumentation cache %s" % self._cache_dir)
325 if os.path.isdir(self._cache_dir): 326 if os.path.isdir(self._cache_dir):
326 for cfile in os.listdir(self._cache_dir): 327 for cfile in os.listdir(self._cache_dir):
327 file = os.path.join(self._cache_dir, cfile); 328 file = os.path.join(self._cache_dir, cfile);
328 if os.path.isfile(file): 329 if os.path.isfile(file):
329 try: 330 try:
330 os.remove(file) 331 os.remove(file)
331 except: 332 except:
332 logging.warning("unable to delete file %s: %s" % (file, 333 logging.warning("unable to delete file %s: %s" % (file,
333 sys.exc_info()[0])) 334 sys.exc_info()[0]))
334
335
336
OLDNEW
« no previous file with comments | « no previous file | tools/valgrind/chrome_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698