if retcode != 0:
raise Exception("Failed to execute '%s', got %d" % (str(args), retcode))
-def execArgsInDirectory (args, cwd):
- # Make sure previous stdout prints have been written out.
- sys.stdout.flush()
- process = subprocess.Popen(args, cwd=cwd)
+def execArgsInDirectory (args, cwd, linePrefix=""):
+
+ def readApplyPrefixAndPrint (source, prefix, sink):
+ while True:
+ line = source.readline()
+ if len(line) == 0: # EOF
+ break;
+ sink.write(prefix + line)
+
+ process = subprocess.Popen(args, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdoutJob = threading.Thread(target=readApplyPrefixAndPrint, args=(process.stdout, linePrefix, sys.stdout))
+ stderrJob = threading.Thread(target=readApplyPrefixAndPrint, args=(process.stdout, linePrefix, sys.stderr))
+ stdoutJob.start()
+ stderrJob.start()
retcode = process.wait()
if retcode != 0:
raise Exception("Failed to execute '%s', got %d" % (str(args), retcode))
common.execArgsInDirectory([common.ADB_BIN] + extraArgs + [
'uninstall',
'com.drawelements.deqp'
- ], common.ANDROID_DIR)
+ ], common.ANDROID_DIR, printPrefix)
print printPrefix + "Remove complete\n",
print printPrefix + "Installing dEQP Package...\n",
'install',
'-r',
'package/bin/dEQP-debug.apk'
- ], common.ANDROID_DIR)
+ ], common.ANDROID_DIR, printPrefix)
print printPrefix + "Install complete\n",
def installToDevice (device, printPrefix=""):
- print printPrefix + "Installing to %s (%s)...\n" % (device.serial, device.model),
+ if len(printPrefix) == 0:
+ print "Installing to %s (%s)...\n" % (device.serial, device.model),
+ else:
+ print printPrefix + "Installing to %s\n" % device.serial,
+
install(['-s', device.serial], printPrefix)
def installToAllDevices (doParallel):