Skip to content

Commit 8b40993

Browse files
committed
Make wait factor controllable via environment variable
1 parent b2b6b52 commit 8b40993

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

testsuite/drivers/pylsp.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ def run(self) -> None:
100100
env = {
101101
"ALS": self.env.als,
102102
"ALS_HOME": self.env.als_home,
103+
"ALS_WAIT_FACTOR": str(self.env.wait_factor),
103104
"PYTHONPATH": os.path.dirname(os.path.dirname(__file__)),
104105
}
105106

@@ -657,8 +658,13 @@ async def async_wrapper(
657658

658659
LOG.info("Running test function: %s", func.__name__)
659660

661+
actual_timeout = timeout
662+
if "ALS_WAIT_FACTOR" in os.environ:
663+
factor = int(os.environ["ALS_WAIT_FACTOR"])
664+
actual_timeout *= factor
665+
660666
# Run the test with a timeout
661-
async with asyncio.timeout(timeout):
667+
async with asyncio.timeout(actual_timeout):
662668
await func(client)
663669

664670
if assert_no_lsp_errors:

testsuite/testsuite.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import datetime
44
import logging
55
import os
6+
from shutil import which
67
import sys
7-
from distutils.spawn import find_executable
88

99
from drivers.basic import JsonTestDriver
1010
from drivers.gnatcov import GNATcov
@@ -80,23 +80,22 @@ def lookup_program(self, *args):
8080
return path + ".exe"
8181

8282
# Otherwise, look for the requested program name in the PATH.
83-
#
84-
# TODO (S710-005): for some reason, on Windows we need to strip the
85-
# ".exe" suffix for the tester-run program to be able to spawn ALS.
86-
result = find_executable(os.path.basename(path))
83+
result = which(os.path.basename(path))
8784
if result is None:
8885
raise RuntimeError(
8986
"Could not find executable for {}".format(os.path.basename(path))
9087
)
91-
return result[: -len(".exe")] if result.endswith(".exe") else result
88+
# TODO (S710-005): for some reason, on Windows we need to strip the
89+
# ".exe" suffix for the tester-run program to be able to spawn ALS.
90+
return result[: -len(".exe")] if result.lower().endswith(".exe") else result
9291

9392
def set_up(self):
9493
# Root directory for the "ada_language_server" repository
9594
self.env.repo_base = os.path.abspath(
9695
os.path.join(os.path.dirname(__file__), "..")
9796
)
9897

99-
self.env.wait_factor = 1
98+
self.env.wait_factor = int(os.environ.get("ALS_WAIT_FACTOR", "1"))
10099

101100
# Absolute paths to programs that test drivers can use
102101
if self.env.options.valgrind_memcheck:

0 commit comments

Comments
 (0)