Skip to content

Commit 72229b0

Browse files
committed
Move LinuxNamespacedExecutor to linux.py
1 parent 7071444 commit 72229b0

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

scripts/tests/chiptest/linux.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
import sdbus
3131

32-
from .runner import SubprocessInfo
32+
from .runner import Executor, SubprocessInfo
3333

3434
test_environ = os.environ.copy()
3535

@@ -202,6 +202,14 @@ def terminate(self):
202202
def wrap_in_namespace(self, subproc: SubprocessInfo):
203203
return subproc.wrap_with(("ip", "netns", "exec", "{}-{}".format(subproc.kind, self.index)))
204204

205+
class LinuxNamespacedExecutor(Executor):
206+
def __init__(self, ns):
207+
self.ns = ns
208+
209+
def run(self, subproc: SubprocessInfo, stdin, stdout, stderr):
210+
wrapped = self.ns.wrap_in_namespace(subproc)
211+
s = subprocess.Popen(wrapped.to_cmd(), stdin=stdin, stdout=stdout, stderr=stderr)
212+
return s
205213

206214
class DBusTestSystemBus(subprocess.Popen):
207215
"""Run a dbus-daemon in a subprocess as a test system bus."""

scripts/tests/chiptest/runner.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -149,16 +149,6 @@ def run(self, subproc: SubprocessInfo, stdin, stdout, stderr):
149149
return s
150150

151151

152-
class LinuxNamespacedExecutor(Executor):
153-
def __init__(self, ns):
154-
self.ns = ns
155-
156-
def run(self, subproc: SubprocessInfo, stdin, stdout, stderr):
157-
wrapped = self.ns.wrap_in_namespace(subproc)
158-
s = subprocess.Popen(wrapped.to_cmd(), stdin=stdin, stdout=stdout, stderr=stderr)
159-
return s
160-
161-
162152
class Runner:
163153
def __init__(self, executor=None, capture_delegate=None):
164154
self.executor = Executor() if executor is None else executor

scripts/tests/run_test_suite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ def build_app(arg_value, kind: str, key: str):
409409
ble_controller_app = 0 # Bind app to the first BLE controller
410410
ble_controller_tool = 1 # Bind tool to the second BLE controller
411411

412-
executor = chiptest.runner.LinuxNamespacedExecutor(ns)
412+
executor = chiptest.linux.LinuxNamespacedExecutor(ns)
413413
runner = runner = chiptest.runner.Runner(executor=executor)
414414
else:
415415
runner = chiptest.runner.Runner()

0 commit comments

Comments
 (0)