summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Shubham Ajmera <shubhamajmera@google.com> 2017-05-10 20:58:04 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2017-05-10 20:58:05 +0000
commitb75e66e7636b3100432c7459130f55e12c12e0ab (patch)
tree70520486d9746dbae04345b600bf95858a7c0ff7
parent0ac500f2d5d8e9948e5041e601c9dec805c7b74b (diff)
parent8fd2694aa1103911baf32eb05813cc11ab00ef4b (diff)
Merge "Testrunner: Fix concurrecy for --target"
-rwxr-xr-xtest/testrunner/testrunner.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/testrunner/testrunner.py b/test/testrunner/testrunner.py
index 9a437cc822..c99159f1ae 100755
--- a/test/testrunner/testrunner.py
+++ b/test/testrunner/testrunner.py
@@ -828,7 +828,15 @@ def get_default_threads(target):
adb_command = 'adb shell cat /sys/devices/system/cpu/present'
cpu_info_proc = subprocess.Popen(adb_command.split(), stdout=subprocess.PIPE)
cpu_info = cpu_info_proc.stdout.read()
- return int(cpu_info.split('-')[1])
+ if type(cpu_info) is bytes:
+ cpu_info = cpu_info.decode('utf-8')
+ cpu_info_regex = '\d*-(\d*)'
+ match = re.match(cpu_info_regex, cpu_info)
+ if match:
+ return int(match.group(1))
+ else:
+ raise ValueError('Unable to predict the concurrency for the target. '
+ 'Is device connected?')
else:
return multiprocessing.cpu_count()