[compiler-rt] dd0b8b9 - [sanitizer] Add timeouts for adb calls

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 14 18:43:58 PST 2020


Author: Vitaly Buka
Date: 2020-11-14T18:43:45-08:00
New Revision: dd0b8b94d0796bd895cc998dd163b4fbebceb0b8

URL: https://github.com/llvm/llvm-project/commit/dd0b8b94d0796bd895cc998dd163b4fbebceb0b8
DIFF: https://github.com/llvm/llvm-project/commit/dd0b8b94d0796bd895cc998dd163b4fbebceb0b8.diff

LOG: [sanitizer] Add timeouts for adb calls

Added: 
    

Modified: 
    compiler-rt/test/sanitizer_common/android_commands/android_common.py

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/sanitizer_common/android_commands/android_common.py b/compiler-rt/test/sanitizer_common/android_commands/android_common.py
index fc26ee25835c..8a1d8ca31a46 100644
--- a/compiler-rt/test/sanitizer_common/android_commands/android_common.py
+++ b/compiler-rt/test/sanitizer_common/android_commands/android_common.py
@@ -13,7 +13,7 @@ def host_to_device_path(path):
     dev = os.path.join(ANDROID_TMPDIR, rel)
     return dev
 
-def adb(args, attempts = 1):
+def adb(args, attempts = 1, timeout_sec = 600):
     if verbose:
         print args
     tmpname = tempfile.mktemp()
@@ -21,7 +21,7 @@ def adb(args, attempts = 1):
     ret = 255
     while attempts > 0 and ret != 0:
       attempts -= 1
-      ret = subprocess.call([ADB] + args, stdout=out, stderr=subprocess.STDOUT)
+      ret = subprocess.call(['timeout', str(timeout_sec), ADB] + args, stdout=out, stderr=subprocess.STDOUT)
       if attempts != 0:
         ret = 5
     if ret != 0:
@@ -36,11 +36,11 @@ def adb(args, attempts = 1):
 
 def pull_from_device(path):
     tmp = tempfile.mktemp()
-    adb(['pull', path, tmp], 5)
+    adb(['pull', path, tmp], 5, 60)
     text = open(tmp, 'r').read()
     os.unlink(tmp)
     return text
 
 def push_to_device(path):
     dst_path = host_to_device_path(path)
-    adb(['push', path, dst_path], 5)
+    adb(['push', path, dst_path], 5, 60)


        


More information about the llvm-commits mailing list