[asan] Dump adb output on failure.
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Thu, 11 Feb 2016 00:16:28 +0000 (00:16 +0000)
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Thu, 11 Feb 2016 00:16:28 +0000 (00:16 +0000)
This is an asan/android test harness change aiming to catch
"adb pull" failures on the buildbot.

llvm-svn: 260473

compiler-rt/test/asan/android_commands/android_common.py

index 43ac7b4..9f8775f 100644 (file)
@@ -11,8 +11,18 @@ if os.environ.get('ANDROID_RUN_VERBOSE') == '1':
 def adb(args):
     if verbose:
         print args
-    devnull = open(os.devnull, 'w')
-    return subprocess.call([ADB] + args, stdout=devnull, stderr=subprocess.STDOUT)
+    tmpname = tempfile.mktemp()
+    out = open(tmpname, 'w')
+    ret = subprocess.call([ADB] + args, stdout=out, stderr=subprocess.STDOUT)
+    if ret != 0:
+        print "adb command failed", args
+        print tmpname
+        out.close()
+        out = open(tmpname, 'r')
+        print out.read()
+    out.close()
+    os.unlink(tmpname)
+    return ret
 
 def pull_from_device(path):
     tmp = tempfile.mktemp()