diff options
Diffstat (limited to 'test/testrunner/testrunner.py')
| -rwxr-xr-x | test/testrunner/testrunner.py | 10 |
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() |