Lines Matching +full:stdout +full:- +full:path

7 # June 1991 as shown in the file COPYING in the top-level directory of this
38 bpf_test_dir = os.path.dirname(os.path.realpath(__file__))
53 log_level -= sub
101 Run a command in subprocess and return tuple of (retval, stdout);
104 proc = subprocess.Popen(cmd, shell=shell, stdout=subprocess.PIPE,
115 stdout, stderr = proc.communicate()
116 stdout = stdout.decode("utf-8")
117 stderr = stderr.decode("utf-8")
118 proc.stdout.close()
122 if stderr[-1] == "\n":
123 stderr = stderr[:-1]
127 "RETCODE: %d\n%s STDOUT:\n%s%s STDERR:%s\n%s END: %s" %
128 (proc.returncode, sec, stdout, sec, stderr,
132 if len(stderr) > 0 and stderr[-1] == "\n":
133 stderr = stderr[:-1]
137 return proc.returncode, stdout, stderr
139 return proc.returncode, stdout
142 cmd("rm -f %s" % (f))
157 ret, stdout, stderr = cmd(ns + name + " " + params + args,
160 ret, stdout = cmd(ns + name + " " + params + args,
163 if JSON and len(stdout.strip()) != 0:
164 out = json.loads(stdout)
166 out = stdout
174 return tool("bpftool", args, {"json":"-p"}, JSON=JSON, ns=ns,
219 args = "prog load %s %s" % (os.path.join(bpf_test_dir, sample), file_name)
234 args = "-force " + args
235 return tool("ip", args, {"json":"-j"}, JSON=JSON, ns=ns,
239 return tool("tc", args, {"json":"-p"}, JSON=JSON, ns=ns,
245 def bpf_obj(name, sec="xdp", path=bpf_test_dir,): argument
246 return "obj %s sec %s" % (os.path.join(path, name), sec)
288 def __init__(self, path): argument
289 self.path = path
290 self._dict = self._debugfs_dir_read(path)
304 cmd("echo '%s' > %s/%s" % (value, self.path, key))
307 _, out = cmd('cat %s/%s' % (self.path, key))
310 def _debugfs_dir_read(self, path): argument
313 log("DebugFS state for %s" % (path), "")
316 _, out = cmd('ls ' + path)
321 p = os.path.join(path, f)
325 if os.path.isfile(p):
328 cmd('echo deadbeef > %s/%s' % (path, f))
329 _, out = cmd('cat %s/%s' % (path, f))
331 elif os.path.isdir(p):
354 path = os.path.join(self.dfs_dir, "bpf_bound_progs")
355 _, progs = cmd('ls %s' % (path))
359 progs = DebugfsDir(os.path.join(self.dfs_dir, "bpf_bound_progs"))
393 path = os.path.join(self.dfs_dir, f)
394 _, data = cmd('cat %s' % (path))
456 args = "-s filter show dev %s ingress" % (self['ifname'])
519 args = "hw-tc-offload %s" % ("on" if enable else "off")
520 return ethtool(self, "-K", args, fail=fail)
529 cmd("rm -f %s" % (f))
560 fail(err["error"].find("No such device") == -1,
628 start_test("Test multi-attachment XDP - %s + offload..." %
648 start_test("Test multi-attachment XDP - replace...")
650 fail(ret == 0, "Replaced one of programs without -force")
653 start_test("Test multi-attachment XDP - remove without mode...")
672 start_test("Test multi-attachment XDP - reattach...")
680 start_test("Test multi-attachment XDP - device remove...")
690 parser.add_argument("--log", help="output verbose log to given file")
694 logfile.write("# -*-Org-*-")
713 if not os.path.isdir("/sys/bus/netdevsim/"):
719 if out.find("/sys/kernel/debug type debugfs") == -1:
720 cmd("mount -t debugfs none /sys/kernel/debug")
732 if err.find("Error: Failed to find qdisc with specified handle.") == -1:
758 start_test("Test TC non-offloaded...")
762 start_test("Test TC non-offloaded isn't getting bound...")
808 start_test("Test non-0 chain offload...")
878 start_test("Test TC offload is device-bound...")
928 fail(ret == 0, "Replaced XDP program without -force")
933 fail(ret != 0, "Could not replace XDP program with -force")
940 "Device parameters reported for non-offloaded program")
963 start_test("Test non-offload XDP attaching to HW...")
968 fail(ret == 0, "attached non-offloaded XDP program to HW")
969 check_extack_nsim(err, "xdpoffload of non-bound program.", args)
1096 time_diff = end - start
1169 fail(ret == 0, "updated non-existing key")
1170 fail(err["error"].find("No such file or directory") == -1,
1180 fail(err["error"].find("File exists") == -1,
1204 fail(err["error"].find("No such file or directory") == -1,
1216 fail(err["error"].find("No such file or directory") == -1,
1230 start_test("Test map creation fail path...")
1240 start_test("Test multi-dev ASIC program reuse...")
1259 start_test("Test multi-dev ASIC cross-dev replace...")
1261 fail(ret == 0, "cross-ASIC program allowed")
1264 fail(ret == 0, "cross-ASIC program allowed")
1266 start_test("Test multi-dev ASIC cross-dev install...")
1272 fail(ret == 0, "cross-ASIC program allowed")
1277 fail(ret == 0, "cross-ASIC program allowed")
1280 start_test("Test multi-dev ASIC cross-dev map reuse...")
1298 "error message missing for cross-ASIC map")
1306 "error message missing for cross-ASIC map")
1308 start_test("Test multi-dev ASIC cross-dev destruction...")
1319 start_test("Test multi-dev ASIC cross-dev destruction - move...")
1332 start_test("Test multi-dev ASIC cross-dev destruction - orphaned...")
1336 print("%s: OK" % (os.path.basename(__file__)))