From d302bd0f235c9ab7586c323a20e290ebb64035c9 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 13 Nov 2018 19:52:46 -0500 Subject: [PATCH 1/4] Show all android logging. --- etc/run_in_headless_android_emulator.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/etc/run_in_headless_android_emulator.py b/etc/run_in_headless_android_emulator.py index a3b5d573ef95..e7c2f5c8fa36 100755 --- a/etc/run_in_headless_android_emulator.py +++ b/etc/run_in_headless_android_emulator.py @@ -66,8 +66,6 @@ def main(avd_name, apk_path, *args): # in case they say something useful while we wait in subsequent steps. logcat_args = [ "--format=raw", # Print no metadata, only log messages - "simpleservo:D", # Show (debug level) Rust stdio - "*:S", # Hide everything else ] with terminate_on_exit(adb + ["logcat"] + logcat_args) as logcat: From 105558c6da587abd7f935d9f55f30e5955496e76 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 13 Nov 2018 22:11:50 -0500 Subject: [PATCH 2/4] Avoid encoding errors. --- python/servo/testing_commands.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index bd0271765f1f..a2199e9b228f 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -609,7 +609,10 @@ def test_android_startup(self, release, dev): if len(line) == 0: print("EOF without finding the expected line") return 1 - print(line.rstrip()) + try: + sys.stdout.write(line) + except: + sys.stdout.write("\n---suppressing a line that could not be written---\n") if "JavaScript is running!" in line: break finally: From dd2e07c06716331a69e7d0a4fae9b1ace48b6d5a Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 13 Nov 2018 22:33:58 -0500 Subject: [PATCH 3/4] Replace unencodable characters. --- python/servo/testing_commands.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index a2199e9b228f..ef53694d045e 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -605,14 +605,11 @@ def test_android_startup(self, release, dev): process = subprocess.Popen(args, stdout=subprocess.PIPE) try: while 1: - line = process.stdout.readline() + line = process.stdout.readline().encode('ascii', 'replace') if len(line) == 0: print("EOF without finding the expected line") return 1 - try: - sys.stdout.write(line) - except: - sys.stdout.write("\n---suppressing a line that could not be written---\n") + sys.stdout.write(line) if "JavaScript is running!" in line: break finally: From 956b3d9eec63230c59a8fa46bc3884f5a8e3d45f Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 13 Nov 2018 23:02:33 -0500 Subject: [PATCH 4/4] Try decoding instead? --- python/servo/testing_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index ef53694d045e..5fcf915dff6b 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -605,7 +605,7 @@ def test_android_startup(self, release, dev): process = subprocess.Popen(args, stdout=subprocess.PIPE) try: while 1: - line = process.stdout.readline().encode('ascii', 'replace') + line = process.stdout.readline().decode('ascii', 'replace') if len(line) == 0: print("EOF without finding the expected line") return 1