summaryrefslogtreecommitdiffstats
path: root/tools/isolate
diff options
context:
space:
mode:
authormaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-05 19:12:40 +0000
committermaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-05 19:12:40 +0000
commit9d40e2971d283eaa2881bf1b7b9fd804e4b0601a (patch)
tree0820d30cb69b5664ccf125ce4949b8ec55e8c032 /tools/isolate
parent1c83c0cd55f0290eec98c26b7a297b1962acc2dc (diff)
downloadchromium_src-9d40e2971d283eaa2881bf1b7b9fd804e4b0601a.zip
chromium_src-9d40e2971d283eaa2881bf1b7b9fd804e4b0601a.tar.gz
chromium_src-9d40e2971d283eaa2881bf1b7b9fd804e4b0601a.tar.bz2
Fix hardlinking issue happening on linux.
Uses a temporary directory on the same filesystem than cache_dir if /tmp is mapped on another file system, like tmpfs. NOTRY=true R=cmp@chromium.org BUG= TEST= Review URL: https://chromiumcodereview.appspot.com/10538010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140575 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/isolate')
-rwxr-xr-xtools/isolate/run_test_from_archive.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/tools/isolate/run_test_from_archive.py b/tools/isolate/run_test_from_archive.py
index 847e5cf..220e24f 100755
--- a/tools/isolate/run_test_from_archive.py
+++ b/tools/isolate/run_test_from_archive.py
@@ -107,6 +107,14 @@ def rmtree(root):
shutil.rmtree(root)
+def is_same_filesystem(path1, path2):
+ """Returns True if both paths are on the same filesystem.
+
+ This is required to enable the use of hardlinks.
+ """
+ return os.stat(path1).st_dev == os.stat(path2).st_dev
+
+
def open_remote(file_or_url):
"""Reads a file or url."""
if re.match(r'^https?://.+$', file_or_url):
@@ -266,7 +274,15 @@ def run_tha_test(manifest, cache_dir, remote, max_cache_size, min_free_space):
directory and runs the executable.
"""
cache = Cache(cache_dir, remote, max_cache_size, min_free_space)
- outdir = tempfile.mkdtemp(prefix='run_tha_test')
+
+ base_temp_dir = None
+ if not is_same_filesystem(cache_dir, tempfile.gettempdir()):
+ # Do not use tempdir since it's a separate filesystem than cache_dir. It
+ # could be tmpfs for example. This would mean copying up to 100mb of data
+ # there, when a simple tree of hardlinks would do.
+ base_temp_dir = os.path.dirname(cache_dir)
+ outdir = tempfile.mkdtemp(prefix='run_tha_test', dir=base_temp_dir)
+
try:
for filepath, properties in manifest['files'].iteritems():
infile = properties['sha-1']