Make all test262 tests pass on Windows (#3157)

Changes:
- Implemented jerry_port_get_local_time_zone_adjustment on Windows
- Implemented jerry_port_get_current_time on Windows
- Run test262 tests on Windows in PST/PDT timezone

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
This commit is contained in:
Csaba Osztrogonác
2019-09-26 14:31:22 +02:00
committed by Robert Fancsik
parent 9ab4872244
commit 2b3faf683d
2 changed files with 67 additions and 2 deletions
+23 -2
View File
@@ -15,10 +15,12 @@
# limitations under the License.
from __future__ import print_function
import sys
import os
import subprocess
import shutil
import signal
import subprocess
import sys
def get_platform_cmd_prefix():
if sys.platform == 'win32':
@@ -26,6 +28,16 @@ def get_platform_cmd_prefix():
return ['python2'] # The official test262.py isn't python3 compatible, but has python shebang.
def set_timezone(timezone):
assert sys.platform == 'win32', "set_timezone is Windows only function"
subprocess.call(get_platform_cmd_prefix() + ['tzutil', '/s', timezone])
def set_timezone_and_exit(timezone):
set_timezone(timezone)
sys.exit(1)
def run_test262_tests(runtime, engine, path_to_test262):
if not os.path.isdir(os.path.join(path_to_test262, '.git')):
return_code = subprocess.call(['git', 'clone', 'https://github.com/tc39/test262.git',
@@ -42,6 +54,11 @@ def run_test262_tests(runtime, engine, path_to_test262):
if os.path.isdir(path_to_remove):
shutil.rmtree(path_to_remove)
if sys.platform == 'win32':
original_timezone = subprocess.check_output(get_platform_cmd_prefix() + ['tzutil', '/g'])
set_timezone('Pacific Standard Time')
signal.signal(signal.SIGINT, lambda signal, frame: set_timezone_and_exit(original_timezone))
proc = subprocess.Popen(get_platform_cmd_prefix() +
[os.path.join(path_to_test262, 'tools/packaging/test262.py'),
'--command', (runtime + ' ' + engine).strip(),
@@ -73,6 +90,10 @@ def run_test262_tests(runtime, engine, path_to_test262):
return_code = 1
proc.wait()
if sys.platform == 'win32':
set_timezone(original_timezone)
return return_code