Index: tools/valgrind/valgrind_test.py |
=================================================================== |
--- tools/valgrind/valgrind_test.py (revision 109287) |
+++ tools/valgrind/valgrind_test.py (working copy) |
@@ -14,6 +14,7 @@ |
import logging |
import optparse |
import os |
+import platform |
import re |
import shutil |
import stat |
@@ -706,6 +707,24 @@ |
return ret |
+def _Cygpath(path): |
Timur Iskhodzhanov
2011/11/10 11:52:49
maybe this should me moved to tools\valgrind\commo
Alexander Potapenko
2011/11/10 12:12:13
Am I right you're this function is called on every
Reid Kleckner (google)
2011/11/10 14:00:30
It's actually fairly specific to DrMemory, I think
Timur Iskhodzhanov
2011/11/10 14:03:19
The only reason for doing your CL is to support ru
Reid Kleckner (google)
2011/11/10 14:19:09
No. Because I'm using Cygwin, depot_tools uses th
|
+ """If we're using Cygwin Python, turn the path into a Windows path. |
+ |
+ Don't turn forward slashes into backslashes for easier copy-pasting and |
+ escaping. |
+ """ |
+ if path[0] == "/" and "cygwin" in platform.system().lower(): |
+ p = subprocess.Popen(["cygpath", "-m", path], |
+ stdout=subprocess.PIPE, |
+ stderr=subprocess.PIPE) |
+ (out, err) = p.communicate() |
+ if err: |
+ logging.warning("WARNING: cygpath error: %s", err) |
+ return out.strip() |
+ else: |
+ return path |
+ |
+ |
class DrMemory(BaseTool): |
"""Dr.Memory |
Dynamic memory error detector for Windows. |
@@ -798,7 +817,7 @@ |
for suppression_file in self._options.suppressions: |
if os.path.exists(suppression_file): |
suppression_count += 1 |
- proc += ["-suppress", suppression_file] |
+ proc += ["-suppress", _Cygpath(suppression_file)] |
if not suppression_count: |
logging.warning("WARNING: NOT USING SUPPRESSIONS!") |
@@ -812,7 +831,7 @@ |
if self._options.use_debug: |
proc += ["-debug"] |
- proc += ["-logdir", self.log_dir] |
+ proc += ["-logdir", _Cygpath(self.log_dir)] |
proc += ["-batch", "-quiet", "-no_results_to_stderr"] |
proc += ["-callstack_max_frames", "40"] |
@@ -840,6 +859,7 @@ |
proc = [] |
# Note that self._args begins with the name of the exe to be run. |
+ self._args[0] = _Cygpath(self._args[0]) |
proc += self._args |
return proc |