Lines Matching full:fail
82 def fail(cond, msg): function
85 print("FAIL: " + msg)
88 log("FAIL: " + msg, tb, level=1)
96 def cmd(cmd, shell=True, include_stderr=False, background=False, fail=True): argument
109 return cmd_result(proc, include_stderr=include_stderr, fail=fail)
111 def cmd_result(proc, include_stderr=False, fail=False): argument
128 if proc.returncode != 0 and fail:
143 def tool(name, args, flags, JSON=True, ns="", fail=True, include_stderr=False): argument
153 fail=fail, include_stderr=True)
156 fail=fail, include_stderr=False)
168 def bpftool(args, JSON=True, ns="", fail=True, include_stderr=False): argument
170 fail=fail, include_stderr=include_stderr)
173 _, progs = bpftool("prog show", JSON=True, ns=ns, fail=True)
180 fail(True, "%d BPF programs loaded, expected %d" %
185 _, maps = bpftool("map show", JSON=True, ns=ns, fail=True)
190 fail(True, "%d BPF maps loaded, expected %d" %
211 fail=True, include_stderr=False): argument
220 res = bpftool(args, fail=fail, include_stderr=include_stderr)
225 def ip(args, force=False, JSON=True, ns="", fail=True, include_stderr=False): argument
229 fail=fail, include_stderr=include_stderr)
231 def tc(args, JSON=True, ns="", fail=True, include_stderr=False): argument
233 fail=fail, include_stderr=include_stderr)
235 def ethtool(dev, opt, args, fail=True): argument
236 return cmd("ethtool %s %s %s" % (opt, dev["ifname"], args), fail=fail)
250 ret, _ = ip("netns add %s" % (name), fail=False)
367 ret, out = cmd("udevadm settle", fail=False)
411 fail(True, "%d BPF programs bound, expected %d" %
473 def set_mtu(self, mtu, fail=True): argument
475 fail=fail)
478 fail=True, include_stderr=False): argument
483 fail=fail, include_stderr=include_stderr)
486 fail=True, include_stderr=False): argument
489 fail=fail, include_stderr=include_stderr)
497 fail(xdp != "xdp" in link,
539 fail(len(filters) != expected,
546 fail=True, include_stderr=False): argument
558 fail=fail, include_stderr=include_stderr)
563 fail=True, include_stderr=False): argument
578 fail=fail, include_stderr=include_stderr)
580 def set_ethtool_tc_offloads(self, enable, fail=True): argument
582 return ethtool(self, "-K", args, fail=fail)
615 ret, err = bpftool("prog show pin %s" % (prog_file), fail=False)
616 fail(ret == 0, "Showing prog with removed device did not fail")
617 fail(err["error"].find("No such device") == -1,
622 ret, err = bpftool("map show pin %s" % (map_file), fail=False)
623 fail(ret == 0, "Showing map with removed device did not fail")
624 fail(err["error"].find("No such device") == -1,
632 fail("dev" not in prog.keys(), "Device parameters not reported")
634 fail("ifindex" not in dev.keys(), "Device parameters not reported")
635 fail("ns_dev" not in dev.keys(), "Device parameters not reported")
636 fail("ns_inode" not in dev.keys(), "Device parameters not reported")
639 fail("ifname" not in dev.keys(), "Ifname not reported")
640 fail(dev["ifname"] != sim["ifname"],
643 fail("ifname" in dev.keys(), "Ifname is reported for other ns")
647 fail("dev" not in m.keys(), "Device parameters not reported")
648 fail(dev != m["dev"], "Map's device different than program's")
655 fail(not comp, "Missing or incorrect netlink extack message")
661 fail((res[1] + res[2]).count(needle) or (res[1] + res[2]).count("Warning:"),
669 fail(True, "Missing or incorrect message from netdevsim in verifier log")
672 fail(two_xdps["mode"] != 4, "Bad mode reported with multiple programs")
673 fail("prog" in two_xdps, "Base program reported in multi program mode")
674 fail(len(two_xdps["attached"]) != 2,
676 fail(two_xdps["attached"][0]["prog"]["id"] ==
697 fail("prog" not in xdp, "Base program not reported in single program mode")
698 fail(len(xdp["attached"]) != 1,
704 fail(xdp["attached"][0] not in two_xdps["attached"],
709 fail(offloaded != offloaded2,
713 ret, _, err = sim.set_xdp(obj, "offload", fail=False, include_stderr=True)
714 fail(ret == 0, "Replaced one of programs without -force")
719 fail=False, include_stderr=True)
720 fail(ret == 0, "Removed program without a mode flag")
727 fail(xdp["mode"] != modeid, "Bad mode reported after multiple programs")
728 fail("prog" not in xdp,
730 fail(xdp["attached"][0] not in two_xdps["attached"],
732 fail(len(xdp["attached"]) != 1,
734 fail(offloaded != "0", "Offload ID reported with only other program left")
740 fail(xdp["attached"][0] not in two_xdps["attached"],
767 ret, progs = bpftool("prog", fail=False)
776 ret, out = cmd("modprobe netdevsim", fail=False)
787 ret, out = cmd("ls %s/%s" % (bpf_test_dir, s), fail=False)
793 fail=False, include_stderr=True)
821 ret, _ = sim.cls_bpf_add_filter(obj, skip_hw=True, fail=False)
822 fail(ret != 0, "Software TC filter did not load")
825 ret, _ = sim.cls_bpf_add_filter(obj, fail=False)
826 fail(ret != 0, "Software TC filter did not load")
833 fail=False, include_stderr=True)
834 fail(ret == 0, "TC filter loaded without enabling TC offloads")
842 ret, _ = sim.cls_bpf_add_filter(obj, fail=False)
843 fail(ret != 0, "Software TC filter did not load")
847 fail(not fltr["in_hw"], "Filter not offloaded by default")
852 ret, _ = sim.cls_bpf_add_filter(bytecode, fail=False)
853 fail(ret != 0, "Software TC filter did not load")
857 fail(not fltr["in_hw"], "Bytecode not offloaded by default")
864 fail=False, include_stderr=True)
865 fail(ret == 0, "TC bytecode loaded for offload")
873 fail=False, include_stderr=True)
874 fail(ret == 0, "Offloaded a filter to chain other than 0")
896 fail=False)
897 fail(bool(ret) != bool(j),
918 fail=False, include_stderr=True)
919 fail(ret == 0, "TC filter did not reject with TC offloads enabled")
925 fail=False, include_stderr=True)
926 fail(ret != 0, "TC filter did not load with TC offloads enabled")
936 fail(fltr["skip_hw"], "TC does reports 'skip_hw' on offloaded filter")
937 fail(not fltr["in_hw"], "TC does not report 'in_hw' for offloaded filter")
938 fail(not fltr["skip_sw"], "TC does not report 'skip_sw' back")
941 fail(str(prog["id"]) != fltr["id"], "Program IDs don't match")
942 fail(prog["tag"] != fltr["tag"], "Program tags don't match")
943 fail(fltr["id"] != dprog["id"], "Program IDs don't match")
944 fail(dprog["state"] != "xlated", "Offloaded program state not translated")
945 fail(dprog["loaded"] != "Y", "Offloaded program is not loaded")
948 ret, _ = sim.set_ethtool_tc_offloads(False, fail=False)
949 fail(ret == 0, "Driver should refuse to disable TC offloads with filters installed...")
957 ret, _ = sim.set_ethtool_tc_offloads(False, fail=False)
958 fail(ret != 0,
985 fail(ipl["xdp"]["prog"]["id"] != progs[0]["id"],
989 ret, _ = sim.set_xdp(obj, "drv", fail=False)
990 fail(ret == 0, "Replaced XDP program without -force")
994 ret, _ = sim.set_xdp(obj, "drv", force=True, fail=False)
995 fail(ret != 0, "Could not replace XDP program with -force")
999 fail(ipl["xdp"]["prog"]["id"] != progs[0]["id"],
1001 fail("dev" in progs[0].keys(),
1006 fail=False, include_stderr=True)
1007 fail(ret == 0, "Replaced XDP program with a program in different mode")
1013 ret, _ = sim.set_mtu(9000, fail=False)
1014 fail(ret == 0,
1019 ret, _, err = sim.set_xdp(obj, "drv", fail=False, include_stderr=True)
1020 fail(ret == 0, "Driver should refuse to load program with MTU of 9000...")
1029 fail=False, include_stderr=True)
1030 fail(ret == 0, "attached non-offloaded XDP program to HW")
1038 ret, _, err = sim.set_xdp(offload, "drv", fail=False, include_stderr=True)
1039 fail(ret == 0, "attached offloaded XDP program to drv")
1047 dev=sim['ifname'], fail=False, include_stderr=True)
1048 fail(ret == 0, "verifier should fail on load")
1059 fail(link_xdp["id"] != prog["id"], "Loaded program has wrong ID")
1065 fail(prog["id"] != link_xdp["id"], "Program IDs don't match")
1066 fail(prog["tag"] != link_xdp["tag"], "Program tags don't match")
1067 fail(str(link_xdp["id"]) != dprog["id"], "Program IDs don't match")
1068 fail(dprog["state"] != "xlated", "Offloaded program state not translated")
1069 fail(dprog["loaded"] != "Y", "Offloaded program is not loaded")
1087 fail=False, include_stderr=True)
1088 fail(ret == 0, "Pinned program loaded for a different device accepted")
1092 fail=False, include_stderr=True)
1093 fail(ret == 0, "Pinned program loaded for a removed device accepted")
1106 fail=False, include_stderr=True)
1107 fail(ret == 0, "Loading TC when XDP active should fail")
1113 ret, _, err = sim.set_xdp(obj, "offload", fail=False, include_stderr=True)
1114 fail(ret == 0, "Loading XDP when TC active should fail")
1133 ret, _ = sim.cls_bpf_add_filter(pinned, da=True, skip_sw=True, fail=False)
1134 fail(ret == 0, "Managed to attach XDP program to TC")
1139 fail=False, include_stderr=True)
1140 fail(ret == 0, "Managed to offload two TC filters at the same time")
1151 tc_proc = cmd(cmd_line, background=True, fail=False)
1157 ret, _ = cmd_result(tc_proc, fail=False)
1161 fail(ret == 0, "Managed to load TC filter on a unregistering device")
1163 fail(time_diff < delay_sec, "Removal process took %s, expected %s" %
1218 fail=False)
1219 fail(ret == 0, "added too many entries")
1230 fail=False)
1231 fail(ret == 0, "updated non-existing key")
1232 fail(err["error"].find("No such file or directory") == -1,
1240 fail=False)
1241 fail(ret == 0, "updated existing key")
1242 fail(err["error"].find("File exists") == -1,
1250 fail(key != i, "expected key %d, got %d" % (key, i))
1252 fail(val != i * 3, "expected value %d, got %d" % (val, i * 3))
1258 fail(key != 0, "next key %d, expected %d" % (key, 0))
1262 fail(key != 1, "next key %d, expected %d" % (key, 1))
1264 (m["id"], int2str("I", 1)), fail=False)
1265 fail(ret == 0, "got next key past the end of map")
1266 fail(err["error"].find("No such file or directory") == -1,
1276 (htab["id"], int2str("I", i)), fail=False)
1277 fail(ret == 0, "removed entry from an array")
1278 fail(err["error"].find("No such file or directory") == -1,
1292 start_test("Test map creation fail path...")
1296 ret, _ = sim.set_xdp(map_obj, "offload", JSON=False, fail=False)
1297 fail(ret == 0,
1322 ret, _ = simA.set_xdp(progB, "offload", force=True, JSON=False, fail=False)
1323 fail(ret == 0, "cross-ASIC program allowed")
1325 ret, _ = d.set_xdp(progA, "offload", force=True, JSON=False, fail=False)
1326 fail(ret == 0, "cross-ASIC program allowed")
1333 fail=False, include_stderr=True)
1334 fail(ret == 0, "cross-ASIC program allowed")
1338 fail=False, include_stderr=True)
1339 fail(ret == 0, "cross-ASIC program allowed")
1350 fail=False)
1351 fail(ret != 0, "couldn't reuse a map on the same ASIC")
1357 fail=False, include_stderr=True)
1358 fail(ret == 0, "could reuse a map on a different ASIC")
1359 fail(err.count("offload device mismatch between prog and map") == 0,
1365 fail=False, include_stderr=True)
1366 fail(ret == 0, "could reuse a map on a different ASIC")
1367 fail(err.count("offload device mismatch between prog and map") == 0,
1377 fail(ifnameB != simB1['ifname'], "program not bound to original device")
1383 fail(ifnameB not in (simB2['ifname'], simB3['ifname']),
1388 fail(ifnameB != simB3['ifname'], "program not bound to remaining device")
1395 ret, out = bpftool("prog show %s" % (progB), fail=False)
1396 fail(ret == 0, "got information about orphaned program")
1397 fail("error" not in out, "no error reported for get info on orphaned")
1398 fail(out["error"] != "can't get prog info: No such device",