Make attestation_test_host.py python3-compliant am: a4cdf26230 am: f99cc020dd am: 96c8762939 am: b6239e3c5d
Original change: https://android-review.googlesource.com/c/platform/tools/security/+/1814111
Change-Id: I67c5f6fe17baf6a02a5b0ba17c33722eb3aba56c
diff --git a/remote_provisioning/attestation_testing/attestation_test_host.py b/remote_provisioning/attestation_testing/attestation_test_host.py
index 417842a..4632cd9 100644
--- a/remote_provisioning/attestation_testing/attestation_test_host.py
+++ b/remote_provisioning/attestation_testing/attestation_test_host.py
@@ -22,17 +22,17 @@
while not finished and read_retry < 5:
time.sleep(1)
logcat = subprocess.check_output(['adb', 'logcat', '-d'], stderr=subprocess.STDOUT)
- for line in logcat.split('\n'):
+ for line in logcat.decode('utf-8').split('\n'):
if INFO_TAG in line:
- print INFO_PREFIX + line[line.index('AttestationFailInfo') + len('AttestationFailInfo:'):]
+ print(INFO_PREFIX + line[line.index('AttestationFailInfo') + len('AttestationFailInfo:'):])
elif FAILURE_TAG in line:
failures += 1
- print FAILURE_PREFIX + line[line.index('AttestationFail') + len('AttestationFail:'):]
+ print(FAILURE_PREFIX + line[line.index('AttestationFail') + len('AttestationFail:'):])
elif FINISHED_TAG in line and not finished:
- print 'Finished. Failures: ' + str(failures)
+ print('Finished. Failures: ' + str(failures))
finished = True
break
read_retry += 1
- if read_retry is 5:
- print 'Attestation test did not complete, check logcat to determine the source of the error'
+ if read_retry == 5:
+ print('Attestation test did not complete, check logcat to determine the source of the error')
subprocess.call('adb uninstall com.google.attestationexample', shell=True, stdout=devnull)