Make run-tests --jerry-tests --jerry-test-suite work on Windows too (#3260)
Changes: * Bash based runners/run-test-suite.sh runner replaced with a python runner * Common util functions moved to util.py * Fixed EOL issues in tests directory JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
This commit is contained in:
committed by
Dániel Bátyai
parent
525c35f148
commit
44b1b9855d
@@ -17,10 +17,10 @@
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import shutil
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
import util
|
||||
|
||||
def get_platform_cmd_prefix():
|
||||
if sys.platform == 'win32':
|
||||
@@ -28,16 +28,6 @@ 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',
|
||||
@@ -55,9 +45,9 @@ def run_test262_tests(runtime, engine, path_to_test262):
|
||||
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))
|
||||
original_timezone = util.get_timezone()
|
||||
util.set_sighdl_to_reset_timezone(original_timezone)
|
||||
util.set_timezone('Pacific Standard Time')
|
||||
|
||||
proc = subprocess.Popen(get_platform_cmd_prefix() +
|
||||
[os.path.join(path_to_test262, 'tools/packaging/test262.py'),
|
||||
@@ -92,7 +82,7 @@ def run_test262_tests(runtime, engine, path_to_test262):
|
||||
proc.wait()
|
||||
|
||||
if sys.platform == 'win32':
|
||||
set_timezone(original_timezone)
|
||||
util.set_timezone(original_timezone)
|
||||
|
||||
return return_code
|
||||
|
||||
|
||||
Reference in New Issue
Block a user