test-framework: add bash_path to fix LocalRun on windows

Signed-off-by: Kamil Gierszewski <kamil.gierszewski@huawei.com>
This commit is contained in:
Kamil Gierszewski 2024-05-15 23:42:31 +02:00
parent e0b7c56b16
commit 0a82b7a3c5
No known key found for this signature in database

View File

@ -8,15 +8,18 @@ import subprocess
from datetime import timedelta from datetime import timedelta
from connection.base_executor import BaseExecutor from connection.base_executor import BaseExecutor
from core.test_run import TestRun
from test_utils.output import Output from test_utils.output import Output
class LocalExecutor(BaseExecutor): class LocalExecutor(BaseExecutor):
def _execute(self, command, timeout): def _execute(self, command, timeout):
bash_path = TestRun.config.get("bash_path", "/bin/bash")
completed_process = subprocess.run( completed_process = subprocess.run(
command, command,
shell=True, shell=True,
executable="/bin/bash", executable=bash_path,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, stderr=subprocess.PIPE,
timeout=timeout.total_seconds(), timeout=timeout.total_seconds(),
@ -38,6 +41,7 @@ class LocalExecutor(BaseExecutor):
dut_to_controller=False, dut_to_controller=False,
): ):
options = [] options = []
bash_path = TestRun.config.get("bash_path", "/bin/bash")
if delete: if delete:
options.append("--delete") options.append("--delete")
@ -52,7 +56,7 @@ class LocalExecutor(BaseExecutor):
completed_process = subprocess.run( completed_process = subprocess.run(
f'rsync -r {src} {dst} {" ".join(options)}', f'rsync -r {src} {dst} {" ".join(options)}',
shell=True, shell=True,
executable="/bin/bash", executable=bash_path,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, stderr=subprocess.PIPE,
timeout=timeout.total_seconds(), timeout=timeout.total_seconds(),