kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject [3/3] kudu git commit: dist_test: add a cache for ldd results
Date Mon, 05 Mar 2018 06:38:12 GMT
dist_test: add a cache for ldd results

With ctest-based sharding we ended up running 'ldd' many times on the
same executable, which isn't necessary. This adds a simple cache for the
results of ldd.

Change-Id: I350ce78d61d9f4428424350ea6b41d4e61e3a4ae
Reviewed-on: http://gerrit.cloudera.org:8080/9483
Reviewed-by: Adar Dembo <adar@cloudera.com>
Tested-by: Kudu Jenkins


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/9b6034b4
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/9b6034b4
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/9b6034b4

Branch: refs/heads/master
Commit: 9b6034b4ecc4d08870edaad366ab24a0f3fd2728
Parents: 2b2b2dd
Author: Todd Lipcon <todd@apache.org>
Authored: Fri Mar 2 17:35:32 2018 -0800
Committer: Todd Lipcon <todd@apache.org>
Committed: Mon Mar 5 06:35:30 2018 +0000

----------------------------------------------------------------------
 build-support/dist_test.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/9b6034b4/build-support/dist_test.py
----------------------------------------------------------------------
diff --git a/build-support/dist_test.py b/build-support/dist_test.py
index 34ebc86..0e9ab66 100755
--- a/build-support/dist_test.py
+++ b/build-support/dist_test.py
@@ -236,7 +236,7 @@ def copy_system_library(lib):
     shutil.copy2(rel_to_abs(lib), dst)
   return dst
 
-
+LDD_CACHE={}
 def ldd_deps(exe):
   """
   Runs 'ldd' on the provided 'exe' path, returning a list of
@@ -253,9 +253,12 @@ def ldd_deps(exe):
       exe.endswith(".txt") or
       os.path.isdir(exe)):
     return []
-  p = subprocess.Popen(["ldd", exe], stdout=subprocess.PIPE)
-  out, err = p.communicate()
-  if p.returncode != 0:
+  if exe not in LDD_CACHE:
+    p = subprocess.Popen(["ldd", exe], stdout=subprocess.PIPE)
+    out, err = p.communicate()
+    LDD_CACHE[exe] = (out, err, p.returncode)
+  out, err, rc = LDD_CACHE[exe]
+  if rc != 0:
     print >>sys.stderr, "failed to run ldd on ", exe
     return []
   ret = []


Mime
View raw message