From ec30d353885ecb8f1624a7a361c009fd0f967991 Mon Sep 17 00:00:00 2001 From: gongyuhang Date: Tue, 16 Aug 2022 18:55:30 +0800 Subject: [PATCH] Fix bug for 262-test on windows Running python/run_test262.py on windows fail with some tests in language/module-code section. On linux, the "xxx.py" files choose 'utf-8' for the default. On windows, they choose 'gbk' for the default. Therefore, we make the parameter change from the default to 'utf-8'. After this change, the tests failed on windows pass, and the tests on linux haven't been influenced by this change. Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/I5MIOC Test: windows 262-test Signed-off-by: gongyuhang --- test262/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test262/utils.py b/test262/utils.py index 17501580a8..f14e213fb3 100755 --- a/test262/utils.py +++ b/test262/utils.py @@ -168,7 +168,7 @@ def search_dependency(file, directory): def collect_module_dependencies(file, directory, traversedDependencies): dependencies = [] traversedDependencies.append(file) - with open(file, 'r') as f: + with open(file, 'r', encoding='utf-8') as f: content = f.read() result_arr = re.findall(r'(import|from)(?:\s*)(\'(\.\/.*)\'|"(\.\/.*)")', content) for result in result_arr: @@ -179,4 +179,4 @@ def collect_module_dependencies(file, directory, traversedDependencies): dependencies.extend(collect_module_dependencies(dependency, directory, list(set(traversedDependencies)))) dependencies.append(dependency) - return dependencies \ No newline at end of file + return dependencies -- Gitee