summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authormrossetti@chromium.org <mrossetti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-14 22:29:10 +0000
committermrossetti@chromium.org <mrossetti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-14 22:29:10 +0000
commita3decc81bc111808600ef9c54e85c3481d635d1a (patch)
tree8c06fe8cf54eb3b352f7b49bc299ad9d8276662b /tools
parent0c631f2617b70445dd7d116f0711cd991d2adffe (diff)
downloadchromium_src-a3decc81bc111808600ef9c54e85c3481d635d1a.zip
chromium_src-a3decc81bc111808600ef9c54e85c3481d635d1a.tar.gz
chromium_src-a3decc81bc111808600ef9c54e85c3481d635d1a.tar.bz2
Modify temp directory creation so that multiple instances of the script can be run without stepping on one another's temporary toes.
BUG=None TEST=None Review URL: http://codereview.chromium.org/3775007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62662 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rwxr-xr-xtools/valgrind/valgrind_test.py26
1 files changed, 10 insertions, 16 deletions
diff --git a/tools/valgrind/valgrind_test.py b/tools/valgrind/valgrind_test.py
index 74c89b3..5bee022 100755
--- a/tools/valgrind/valgrind_test.py
+++ b/tools/valgrind/valgrind_test.py
@@ -25,6 +25,7 @@ import common
import drmemory_analyze
import memcheck_analyze
+import tempfile
import tsan_analyze
import logging_utils
@@ -37,15 +38,8 @@ class BaseTool(object):
tool-specific stuff.
"""
- # Temporary directory for tools to write logs, create some useful files etc.
- TMP_DIR = "testing.tmp"
-
def __init__(self):
- # If we have a testing.tmp directory, we didn't cleanup last time.
- if os.path.exists(BaseTool.TMP_DIR):
- shutil.rmtree(BaseTool.TMP_DIR)
- os.mkdir(BaseTool.TMP_DIR)
-
+ self.temp_dir = tempfile.mkdtemp()
self.option_parser_hooks = []
def ToolName(self):
@@ -194,7 +188,7 @@ class BaseTool(object):
if self.Setup(args):
retcode = self.RunTestsAndAnalyze(check_sanity)
if not self._nocleanup_on_exit:
- shutil.rmtree(self.TMP_DIR, ignore_errors=True)
+ shutil.rmtree(self.temp_dir, ignore_errors=True)
self.Cleanup()
else:
logging.error("Setup failed")
@@ -388,7 +382,7 @@ class ValgrindTool(BaseTool):
if not suppression_count:
logging.warning("WARNING: NOT USING SUPPRESSIONS!")
- logfilename = self.TMP_DIR + ("/%s." % tool_name) + "%p"
+ logfilename = self.temp_dir + ("/%s." % tool_name) + "%p"
if self.UseXML():
proc += ["--xml=yes", "--xml-file=" + logfilename]
else:
@@ -418,7 +412,7 @@ class ValgrindTool(BaseTool):
tell the program to prefix the Chrome commandline
with a magic wrapper. Build the magic wrapper here.
"""
- (fd, indirect_fname) = tempfile.mkstemp(dir=self.TMP_DIR,
+ (fd, indirect_fname) = tempfile.mkstemp(dir=self.temp_dir,
prefix="browser_wrapper.",
text=True)
f = os.fdopen(fd, "w")
@@ -439,7 +433,7 @@ class ValgrindTool(BaseTool):
def GetAnalyzeResults(self, check_sanity=False):
# Glob all the files in the "testing.tmp" directory
- filenames = glob.glob(self.TMP_DIR + "/" + self.ToolName() + ".*")
+ filenames = glob.glob(self.temp_dir + "/" + self.ToolName() + ".*")
# If we have browser wrapper, the logfiles are named as
# "toolname.wrapper_PID.valgrind_PID".
@@ -697,7 +691,7 @@ class ThreadSanitizerWindows(ThreadSanitizerBase, PinTool):
if not suppression_count:
logging.warning("WARNING: NOT USING SUPPRESSIONS!")
- logfilename = self.TMP_DIR + "/tsan.%p"
+ logfilename = self.temp_dir + "/tsan.%p"
proc += ["--log-file=" + logfilename]
# TODO(timurrrr): Add flags for Valgrind trace children analog when we
@@ -706,7 +700,7 @@ class ThreadSanitizerWindows(ThreadSanitizerBase, PinTool):
return proc
def Analyze(self, check_sanity=False):
- filenames = glob.glob(self.TMP_DIR + "/tsan.*")
+ filenames = glob.glob(self.temp_dir + "/tsan.*")
analyzer = tsan_analyze.TsanAnalyzer(self._source_dir)
ret = analyzer.Report(filenames, check_sanity)
if ret != 0:
@@ -758,7 +752,7 @@ class DrMemory(BaseTool):
if not suppression_count:
logging.warning("WARNING: NOT USING SUPPRESSIONS!")
- proc += ["-logdir", (os.getcwd() + "\\" + self.TMP_DIR)]
+ proc += ["-logdir", (os.getcwd() + "\\" + self.temp_dir)]
proc += ["-batch", "-quiet"]
proc += ["-no_check_leaks", "-no_count_leaks"]
@@ -772,7 +766,7 @@ class DrMemory(BaseTool):
def Analyze(self, check_sanity=False):
# Glob all the results files in the "testing.tmp" directory
- filenames = glob.glob(self.TMP_DIR + "/*/results.txt")
+ filenames = glob.glob(self.temp_dir + "/*/results.txt")
analyzer = drmemory_analyze.DrMemoryAnalyze(self._source_dir, filenames)
ret = analyzer.Report(check_sanity)