From: Jarkko Pöyry Date: Thu, 12 Mar 2015 22:20:47 +0000 (-0700) Subject: Make install.py print device name for each message in -a -p mode. X-Git-Tag: upstream/0.1.0~1869^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d1ae94f048b946fab81c468b0833976bf30bbca8;p=platform%2Fupstream%2FVK-GL-CTS.git Make install.py print device name for each message in -a -p mode. - Add device prefix for each adb subprocess message. This makes it possible to know which device failed the install. Change-Id: I4a116e17df1073913abfb6dd9fee1c9ef1e62ed9 --- diff --git a/android/scripts/common.py b/android/scripts/common.py index cc66dce..241cecf 100644 --- a/android/scripts/common.py +++ b/android/scripts/common.py @@ -110,10 +110,20 @@ def execArgs (args): 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)) diff --git a/android/scripts/install.py b/android/scripts/install.py index 89e60f5..1bf63fd 100644 --- a/android/scripts/install.py +++ b/android/scripts/install.py @@ -32,7 +32,7 @@ def install (extraArgs = [], printPrefix=""): 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", @@ -40,11 +40,15 @@ def install (extraArgs = [], printPrefix=""): '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):