Skip to content

Commit 2bad20a

Browse files
authored
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 [email protected]
1 parent 1fe7c35 commit 2bad20a

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

tools/runners/run-test-suite-test262.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,6 @@ def main(args):
173173
util.set_timezone('Pacific Standard Time')
174174

175175
command = (args.runtime + ' ' + args.engine).strip()
176-
if args.es2015 or args.esnext:
177-
try:
178-
subprocess.check_output(["timeout", "--version"])
179-
command = "timeout 5 " + command
180-
except subprocess.CalledProcessError:
181-
pass
182176

183177
kwargs = {}
184178
if sys.version_info.major >= 3:

tools/runners/test262-harness.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
from collections import Counter
5656

5757
import signal
58+
import threading
5859
import multiprocessing
5960

6061
#######################################################################
@@ -65,6 +66,10 @@
6566
M_YAML_MULTILINE_LIST = re.compile(r"^ *- (.*)$")
6667

6768

69+
# The timeout of each test case
70+
TEST262_CASE_TIMEOUT = 5
71+
72+
6873
def yaml_load(string):
6974
return my_read_dict(string.splitlines())[1]
7075

@@ -595,11 +600,14 @@ def execute(command):
595600
logging.info("exec: %s", str(args))
596601
process = subprocess.Popen(
597602
args,
598-
shell=is_windows(),
603+
shell=False,
599604
stdout=stdout.file_desc,
600605
stderr=stderr.file_desc
601606
)
607+
timer = threading.Timer(TEST262_CASE_TIMEOUT, process.kill)
608+
timer.start()
602609
code = process.wait()
610+
timer.cancel()
603611
out = stdout.read()
604612
err = stderr.read()
605613
finally:

0 commit comments

Comments
 (0)