Skip to content

Commit 12342d7

Browse files
committed
ltp: correctly fetch LTPROOT
LTPROOT was previously fetched via --env option, but after the introduction of the new LTPFramework implementation, this feature stopped to work. This patch brings back the correct usage of it. Signed-off-by: Andrea Cervesato <[email protected]>
1 parent c582b2d commit 12342d7

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

libkirk/ltp.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def __init__(
6363
self._logger = logging.getLogger("libkirk.ltp")
6464
self._cmd_matcher = re.compile(r'(?:"[^"]*"|\'[^\']*\'|\S+)')
6565
self._max_runtime = max_runtime
66-
self._root = os.environ.get("LTPROOT", "/opt/ltp")
66+
self._root = env.get("LTPROOT") or os.environ.get("LTPROOT", "/opt/ltp")
6767
self._tc_folder = os.path.join(self._root, "testcases", "bin")
6868

6969
self._env = {
@@ -94,8 +94,7 @@ async def _read_path(self, channel: ComChannel) -> Dict[str, str]:
9494
if not ret or ret["returncode"] != 0:
9595
raise FrameworkError("Can't read PATH variable")
9696

97-
tcases = os.path.join(self._root, "testcases", "bin")
98-
env["PATH"] = ret["stdout"].strip() + f":{tcases}"
97+
env["PATH"] = ret["stdout"].strip() + f":{self._tc_folder}"
9998

10099
self._logger.debug("PATH=%s", env["PATH"])
101100

libkirk/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ def _start_session(args: argparse.Namespace, parser: argparse.ArgumentParser) ->
343343
session = Session(
344344
tmpdir=tmpdir,
345345
sut=sut,
346-
env=args.env,
346+
env=args.env or {},
347347
exec_timeout=args.exec_timeout,
348348
suite_timeout=args.suite_timeout,
349349
workers=args.workers,

0 commit comments

Comments
 (0)