Fix the test262 timeout on Windows (#4378)
Use the platform independent python threading.Timer instead of the unix only timeout tool. The timeout error are like the following things: ``` C:\Users\lygstate>timeout -version Error: The specified timeout (/T) value is invalid. The valid range is from -1 to 99999 seconds. C:\Users\lygstate>timeout 0 python Error: invalid syntax. The default option does not allow more than '1' times. Type "TIMEOUT /?" to learn how to use it. ``` JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
This commit is contained in:
@@ -173,12 +173,6 @@ def main(args):
|
|||||||
util.set_timezone('Pacific Standard Time')
|
util.set_timezone('Pacific Standard Time')
|
||||||
|
|
||||||
command = (args.runtime + ' ' + args.engine).strip()
|
command = (args.runtime + ' ' + args.engine).strip()
|
||||||
if args.es2015 or args.esnext:
|
|
||||||
try:
|
|
||||||
subprocess.check_output(["timeout", "--version"])
|
|
||||||
command = "timeout 5 " + command
|
|
||||||
except subprocess.CalledProcessError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
kwargs = {}
|
kwargs = {}
|
||||||
if sys.version_info.major >= 3:
|
if sys.version_info.major >= 3:
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ import xml.dom.minidom
|
|||||||
from collections import Counter
|
from collections import Counter
|
||||||
|
|
||||||
import signal
|
import signal
|
||||||
|
import threading
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
@@ -65,6 +66,10 @@ M_YAML_LIST_PATTERN = re.compile(r"^\[(.*)\]$")
|
|||||||
M_YAML_MULTILINE_LIST = re.compile(r"^ *- (.*)$")
|
M_YAML_MULTILINE_LIST = re.compile(r"^ *- (.*)$")
|
||||||
|
|
||||||
|
|
||||||
|
# The timeout of each test case
|
||||||
|
TEST262_CASE_TIMEOUT = 5
|
||||||
|
|
||||||
|
|
||||||
def yaml_load(string):
|
def yaml_load(string):
|
||||||
return my_read_dict(string.splitlines())[1]
|
return my_read_dict(string.splitlines())[1]
|
||||||
|
|
||||||
@@ -595,11 +600,14 @@ class TestCase(object):
|
|||||||
logging.info("exec: %s", str(args))
|
logging.info("exec: %s", str(args))
|
||||||
process = subprocess.Popen(
|
process = subprocess.Popen(
|
||||||
args,
|
args,
|
||||||
shell=is_windows(),
|
shell=False,
|
||||||
stdout=stdout.file_desc,
|
stdout=stdout.file_desc,
|
||||||
stderr=stderr.file_desc
|
stderr=stderr.file_desc
|
||||||
)
|
)
|
||||||
|
timer = threading.Timer(TEST262_CASE_TIMEOUT, process.kill)
|
||||||
|
timer.start()
|
||||||
code = process.wait()
|
code = process.wait()
|
||||||
|
timer.cancel()
|
||||||
out = stdout.read()
|
out = stdout.read()
|
||||||
err = stderr.read()
|
err = stderr.read()
|
||||||
finally:
|
finally:
|
||||||
|
|||||||
Reference in New Issue
Block a user