diff options
author | Brendan Jackman <brendan.jackman@arm.com> | 2017-10-09 17:08:38 +0100 |
---|---|---|
committer | Brendan Jackman <brendan.jackman@arm.com> | 2017-10-09 17:15:41 +0100 |
commit | 8a0554faab92b6d1ff30a124a24312a8e126b134 (patch) | |
tree | 3fd3e0b54b93f786363840d15c3815eb8ff09377 | |
parent | 7e073c1fce9304cdf7b60f507208f15a66939bc0 (diff) | |
download | devlib-8a0554faab92b6d1ff30a124a24312a8e126b134.tar.gz |
AndroidTarget: prevent concurrent invocations of 'logcat -c'
'adb logcat -c' has been observed to fail when called twice concurrently. Rather
than requiring all devlib users to fix their usage patterns, let's just delay
whenever clear_logcat is called twice.
-rw-r--r-- | devlib/target.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/devlib/target.py b/devlib/target.py index 6d2a12d..2fc64dc 100644 --- a/devlib/target.py +++ b/devlib/target.py @@ -952,6 +952,7 @@ class AndroidTarget(Target): shell_prompt=shell_prompt, conn_cls=conn_cls) self.package_data_directory = package_data_directory + self.clear_logcat_lock = threading.Lock() def reset(self, fastboot=False): # pylint: disable=arguments-differ try: @@ -1184,7 +1185,8 @@ class AndroidTarget(Target): adb_command(self.adb_name, command, timeout=timeout) def clear_logcat(self): - adb_command(self.adb_name, 'logcat -c', timeout=30) + with self.clear_logcat_lock: + adb_command(self.adb_name, 'logcat -c', timeout=30) def get_logcat_monitor(self, regexps=None): return LogcatMonitor(self, regexps) |