File Index
Files and directories
Sign in
FILE

remote_netns.py

File preview with syntax highlighting.

linux-6.19.14/tools/testing/selftests/drivers/net/lib/py/remote_netns.py PYTHON
 1# SPDX-License-Identifier: GPL-2.0
 2
 3import os
 4import subprocess
 5
 6from lib.py import cmd
 7
 8
 9class Remote:
10    def __init__(self, name, dir_path):
11        self.name = name
12        self.dir_path = dir_path
13
14    def cmd(self, comm):
15        return subprocess.Popen(["ip", "netns", "exec", self.name, "bash", "-c", comm],
16                                 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
17
18    def deploy(self, what):
19        if os.path.isabs(what):
20            return what
21        return os.path.abspath(self.dir_path + "/" + what)
~/ Read-only file preview.