From 47445bd7fc7aa69a9433314893d5ef4c452f77fd Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Sat, 16 Jan 2021 04:07:17 +0000 Subject: [PATCH] Handling encoding errors for python3 properly ``` Build command: cmd \ /S \ /C \ C:\work\study\languages\typescript\jerryscript\tools\build.py \ --lto=off \ --profile=es.next \ --debug \ --stack-limit=96 \ --gc-mark-limit=16 \ --mem-stress-test=on \ --builddir=C:\work\study\languages\typescript\jerryscript\build\tests\jerry_tests-es.next-debug \ --install=C:\work\study\languages\typescript\jerryscript\build\tests\jerry_tests-es.next-debug\local Test command: TZ='UTC' \ cmd \ /S \ /C \ C:\work\study\languages\typescript\jerryscript\tools\runners/run-test-suite.py \ --engine \ C:\work\study\languages\typescript\jerryscript\build\tests\jerry_tests-es.next-debug\local\bin\jerry.exe \ --test-dir \ C:\work\study\languages\typescript\jerryscript\tests/jerry \ -q \ --skip-list=es5.1\ [ 237/1145] FAIL (3): tests\jerry\es.next\module-resource-name.js ================================================ Script Error: assertion failed ================================================ [summary] build\tests\jerry_tests-es.next-debug\local\bin\jerry.exe tests\jerry TOTAL: 1145 PASS: 1144 FAIL: 1 Success: 99% Build command: cmd \ /S \ /C \ C:\work\study\languages\typescript\jerryscript\tools\build.py \ --lto=off \ --profile=es5.1 \ --stack-limit=96 \ --gc-mark-limit=16 \ --builddir=C:\work\study\languages\typescript\jerryscript\build\tests\jerry_tests-es5.1 \ --install=C:\work\study\languages\typescript\jerryscript\build\tests\jerry_tests-es5.1\local Test command: TZ='UTC' \ cmd \ /S \ /C \ C:\work\study\languages\typescript\jerryscript\tools\runners/run-test-suite.py \ --engine \ C:\work\study\languages\typescript\jerryscript\build\tests\jerry_tests-es5.1\local\bin\jerry.exe \ --test-dir \ C:\work\study\languages\typescript\jerryscript\tests/jerry \ -q \ --skip-list=es.next\ [summary] build\tests\jerry_tests-es5.1\local\bin\jerry.exe tests\jerry TOTAL: 543 PASS: 543 FAIL: 0 Success: 100% Build command: cmd \ /S \ /C \ C:\work\study\languages\typescript\jerryscript\tools\build.py \ --lto=off \ --profile=es5.1 \ --snapshot-save=on \ --snapshot-exec=on \ --jerry-cmdline-snapshot=on \ --stack-limit=96 \ --gc-mark-limit=16 \ --builddir=C:\work\study\languages\typescript\jerryscript\build\tests\jerry_tests-es5.1-snapshot \ --install=C:\work\study\languages\typescript\jerryscript\build\tests\jerry_tests-es5.1-snapshot\local Test command: TZ='UTC' \ cmd \ /S \ /C \ C:\work\study\languages\typescript\jerryscript\tools\runners/run-test-suite.py \ --engine \ C:\work\study\languages\typescript\jerryscript\build\tests\jerry_tests-es5.1-snapshot\local\bin\jerry.exe \ --test-dir \ C:\work\study\languages\typescript\jerryscript\tests/jerry \ -q \ --skip-list=es.next\ \ --snapshot Traceback (most recent call last): File "C:\work\study\languages\typescript\jerryscript\tools\runners\run-test-suite.py", line 214, in sys.exit(main(get_arguments())) File "C:\work\study\languages\typescript\jerryscript\tools\runners\run-test-suite.py", line 105, in main passed = run_snapshot_tests(args, tests) File "C:\work\study\languages\typescript\jerryscript\tools\runners\run-test-suite.py", line 178, in run_snapshot_tests (returncode, stdout) = execute_test_command(generate_snapshot_cmd + [test]) File "C:\work\study\languages\typescript\jerryscript\tools\runners\run-test-suite.py", line 88, in execute_test_command stdout = process.communicate()[0] File "C:\Python38\lib\subprocess.py", line 1011, in communicate stdout = self.stdout.read() File "C:\Python38\lib\encodings\unicode_escape.py", line 26, in decode return codecs.unicode_escape_decode(input, self.errors)[0] UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 70-71: truncated \uXXXX escape Build command: cmd \ /S \ /C \ C:\work\study\languages\typescript\jerryscript\tools\build.py \ --lto=off \ --profile=es5.1 \ --debug \ --stack-limit=96 \ --gc-mark-limit=16 \ --mem-stress-test=on \ --builddir=C:\work\study\languages\typescript\jerryscript\build\tests\jerry_tests-es5.1-debug \ --install=C:\work\study\languages\typescript\jerryscript\build\tests\jerry_tests-es5.1-debug\local Test command: TZ='UTC' \ cmd \ /S \ /C \ C:\work\study\languages\typescript\jerryscript\tools\runners/run-test-suite.py \ --engine \ C:\work\study\languages\typescript\jerryscript\build\tests\jerry_tests-es5.1-debug\local\bin\jerry.exe \ --test-dir \ C:\work\study\languages\typescript\jerryscript\tests/jerry \ -q \ --skip-list=es.next\ [summary] build\tests\jerry_tests-es5.1-debug\local\bin\jerry.exe tests\jerry TOTAL: 543 PASS: 543 FAIL: 0 Success: 100% Build command: cmd \ /S \ /C \ C:\work\study\languages\typescript\jerryscript\tools\build.py \ --lto=off \ --profile=es5.1 \ --snapshot-save=on \ --snapshot-exec=on \ --jerry-cmdline-snapshot=on \ --debug \ --stack-limit=96 \ --gc-mark-limit=16 \ --builddir=C:\work\study\languages\typescript\jerryscript\build\tests\jerry_tests-es5.1-debug-snapshot \ --install=C:\work\study\languages\typescript\jerryscript\build\tests\jerry_tests-es5.1-debug-snapshot\local Test command: TZ='UTC' \ cmd \ /S \ /C \ C:\work\study\languages\typescript\jerryscript\tools\runners/run-test-suite.py \ --engine \ C:\work\study\languages\typescript\jerryscript\build\tests\jerry_tests-es5.1-debug-snapshot\local\bin\jerry.exe \ --test-dir \ C:\work\study\languages\typescript\jerryscript\tests/jerry \ -q \ --skip-list=es.next\ \ --snapshot Traceback (most recent call last): File "C:\work\study\languages\typescript\jerryscript\tools\runners\run-test-suite.py", line 214, in sys.exit(main(get_arguments())) File "C:\work\study\languages\typescript\jerryscript\tools\runners\run-test-suite.py", line 105, in main passed = run_snapshot_tests(args, tests) File "C:\work\study\languages\typescript\jerryscript\tools\runners\run-test-suite.py", line 178, in run_snapshot_tests (returncode, stdout) = execute_test_command(generate_snapshot_cmd + [test]) File "C:\work\study\languages\typescript\jerryscript\tools\runners\run-test-suite.py", line 88, in execute_test_command stdout = process.communicate()[0] File "C:\Python38\lib\subprocess.py", line 1011, in communicate stdout = self.stdout.read() File "C:\Python38\lib\encodings\unicode_escape.py", line 26, in decode return codecs.unicode_escape_decode(input, self.errors)[0] UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 70-71: truncated \uXXXX escape Build command: cmd \ /S \ /C \ C:\work\study\languages\typescript\jerryscript\tools\build.py \ --lto=off \ --profile=es5.1 \ --debug \ --stack-limit=96 \ --gc-mark-limit=16 \ --cpointer-32bit=on \ --mem-heap=1024 \ --builddir=C:\work\study\languages\typescript\jerryscript\build\tests\jerry_tests-es5.1-debug-cpointer_32bit \ --install=C:\work\study\languages\typescript\jerryscript\build\tests\jerry_tests-es5.1-debug-cpointer_32bit\local Test command: TZ='UTC' \ cmd \ /S \ /C \ C:\work\study\languages\typescript\jerryscript\tools\runners/run-test-suite.py \ --engine \ C:\work\study\languages\typescript\jerryscript\build\tests\jerry_tests-es5.1-debug-cpointer_32bit\local\bin\jerry.exe \ --test-dir \ C:\work\study\languages\typescript\jerryscript\tests/jerry \ -q \ --skip-list=es.next\ [summary] build\tests\jerry_tests-es5.1-debug-cpointer_32bit\local\bin\jerry.exe tests\jerry TOTAL: 543 PASS: 543 FAIL: 0 Success: 100% Build command: cmd \ /S \ /C \ C:\work\study\languages\typescript\jerryscript\tools\build.py \ --lto=off \ --profile=es5.1 \ --debug \ --stack-limit=96 \ --gc-mark-limit=16 \ --external-context=on \ --builddir=C:\work\study\languages\typescript\jerryscript\build\tests\jerry_tests-es5.1-debug-external_context \ --install=C:\work\study\languages\typescript\jerryscript\build\tests\jerry_tests-es5.1-debug-external_context\local Test command: TZ='UTC' \ cmd \ /S \ /C \ C:\work\study\languages\typescript\jerryscript\tools\runners/run-test-suite.py \ --engine \ C:\work\study\languages\typescript\jerryscript\build\tests\jerry_tests-es5.1-debug-external_context\local\bin\jerry.exe \ --test-dir \ C:\work\study\languages\typescript\jerryscript\tests/jerry \ -q \ --skip-list=es.next\ [summary] build\tests\jerry_tests-es5.1-debug-external_context\local\bin\jerry.exe tests\jerry TOTAL: 543 PASS: 543 FAIL: 0 ``` JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com --- tools/run-tests.py | 2 +- tools/runners/run-test-suite.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/run-tests.py b/tools/run-tests.py index 1d664906df..2ccd53feee 100755 --- a/tools/run-tests.py +++ b/tools/run-tests.py @@ -292,7 +292,7 @@ def create_binary(job, options): subprocess.check_output(build_cmd) ret = 0 except subprocess.CalledProcessError as err: - print(err.output) + print(err.output.decode(errors="ignore")) ret = err.returncode BINARY_CACHE[binary_key] = (ret, build_dir_path) diff --git a/tools/runners/run-test-suite.py b/tools/runners/run-test-suite.py index 3c3967c4c4..1dd8495184 100755 --- a/tools/runners/run-test-suite.py +++ b/tools/runners/run-test-suite.py @@ -83,6 +83,7 @@ def execute_test_command(test_cmd): kwargs = {} if sys.version_info.major >= 3: kwargs['encoding'] = 'unicode_escape' + kwargs['errors'] = 'ignore' process = subprocess.Popen(test_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True, **kwargs) stdout = process.communicate()[0]