Lines Matching refs:fail
77 def fail(cond, msg): function
89 def cmd(cmd, shell=True, include_stderr=False, background=False, fail=True): argument
102 return cmd_result(proc, include_stderr=include_stderr, fail=fail)
104 def cmd_result(proc, include_stderr=False, fail=False): argument
121 if proc.returncode != 0 and fail:
136 def tool(name, args, flags, JSON=True, ns="", fail=True, include_stderr=False): argument
146 fail=fail, include_stderr=True)
149 fail=fail, include_stderr=False)
161 def bpftool(args, JSON=True, ns="", fail=True, include_stderr=False): argument
163 fail=fail, include_stderr=include_stderr)
166 _, progs = bpftool("prog show", JSON=True, ns=ns, fail=True)
173 fail(True, "%d BPF programs loaded, expected %d" %
178 _, maps = bpftool("map show", JSON=True, ns=ns, fail=True)
185 fail(True, "%d BPF maps loaded, expected %d" %
206 fail=True, include_stderr=False): argument
215 res = bpftool(args, fail=fail, include_stderr=include_stderr)
220 def ip(args, force=False, JSON=True, ns="", fail=True, include_stderr=False): argument
224 fail=fail, include_stderr=include_stderr)
226 def tc(args, JSON=True, ns="", fail=True, include_stderr=False): argument
228 fail=fail, include_stderr=include_stderr)
230 def ethtool(dev, opt, args, fail=True): argument
231 return cmd("ethtool %s %s %s" % (opt, dev["ifname"], args), fail=fail)
245 ret, _ = ip("netns add %s" % (name), fail=False)
376 fail(True, "%d BPF programs bound, expected %d" %
394 def set_mtu(self, mtu, fail=True): argument
396 fail=fail)
399 fail=True, include_stderr=False): argument
404 fail=fail, include_stderr=include_stderr)
407 fail=True, include_stderr=False): argument
410 fail=fail, include_stderr=include_stderr)
418 fail(xdp != "xdp" in link,
460 fail(len(filters) != expected,
467 fail=True, include_stderr=False): argument
479 fail=fail, include_stderr=include_stderr)
484 fail=True, include_stderr=False): argument
499 fail=fail, include_stderr=include_stderr)
501 def set_ethtool_tc_offloads(self, enable, fail=True): argument
503 return ethtool(self, "-K", args, fail=fail)
536 ret, err = bpftool("prog show pin %s" % (prog_file), fail=False)
537 fail(ret == 0, "Showing prog with removed device did not fail")
538 fail(err["error"].find("No such device") == -1,
543 ret, err = bpftool("map show pin %s" % (map_file), fail=False)
544 fail(ret == 0, "Showing map with removed device did not fail")
545 fail(err["error"].find("No such device") == -1,
553 fail("dev" not in prog.keys(), "Device parameters not reported")
555 fail("ifindex" not in dev.keys(), "Device parameters not reported")
556 fail("ns_dev" not in dev.keys(), "Device parameters not reported")
557 fail("ns_inode" not in dev.keys(), "Device parameters not reported")
560 fail("ifname" not in dev.keys(), "Ifname not reported")
561 fail(dev["ifname"] != sim["ifname"],
564 fail("ifname" in dev.keys(), "Ifname is reported for other ns")
568 fail("dev" not in m.keys(), "Device parameters not reported")
569 fail(dev != m["dev"], "Map's device different than program's")
576 fail(not comp, "Missing or incorrect netlink extack message")
582 fail((res[1] + res[2]).count(needle) or (res[1] + res[2]).count("Warning:"),
590 fail(True, "Missing or incorrect message from netdevsim in verifier log")
619 ret, progs = bpftool("prog", fail=False)
625 ret, out = cmd("modprobe netdevsim", fail=False)
636 ret, out = cmd("ls %s/%s" % (bpf_test_dir, s), fail=False)
642 fail=False, include_stderr=True)
668 ret, _ = sim.cls_bpf_add_filter(obj, skip_hw=True, fail=False)
669 fail(ret != 0, "Software TC filter did not load")
672 ret, _ = sim.cls_bpf_add_filter(obj, fail=False)
673 fail(ret != 0, "Software TC filter did not load")
680 fail=False, include_stderr=True)
681 fail(ret == 0, "TC filter loaded without enabling TC offloads")
689 ret, _ = sim.cls_bpf_add_filter(obj, fail=False)
690 fail(ret != 0, "Software TC filter did not load")
694 fail(not fltr["in_hw"], "Filter not offloaded by default")
699 ret, _ = sim.cls_bpf_add_filter(bytecode, fail=False)
700 fail(ret != 0, "Software TC filter did not load")
704 fail(not fltr["in_hw"], "Bytecode not offloaded by default")
711 fail=False, include_stderr=True)
712 fail(ret == 0, "TC bytecode loaded for offload")
720 fail=False, include_stderr=True)
721 fail(ret == 0, "Offloaded a filter to chain other than 0")
743 fail=False)
744 fail(bool(ret) != bool(j),
764 fail=False, include_stderr=True)
765 fail(ret != 0, "TC filter did not load with TC offloads enabled")
776 fail(fltr["skip_hw"], "TC does reports 'skip_hw' on offloaded filter")
777 fail(not fltr["in_hw"], "TC does not report 'in_hw' for offloaded filter")
778 fail(not fltr["skip_sw"], "TC does not report 'skip_sw' back")
781 fail(str(prog["id"]) != fltr["id"], "Program IDs don't match")
782 fail(prog["tag"] != fltr["tag"], "Program tags don't match")
783 fail(fltr["id"] != dprog["id"], "Program IDs don't match")
784 fail(dprog["state"] != "xlated", "Offloaded program state not translated")
785 fail(dprog["loaded"] != "Y", "Offloaded program is not loaded")
788 ret, _ = sim.set_ethtool_tc_offloads(False, fail=False)
789 fail(ret == 0, "Driver should refuse to disable TC offloads with filters installed...")
796 ret, _ = sim.set_ethtool_tc_offloads(False, fail=False)
797 fail(ret != 0,
822 fail(ipl["xdp"]["prog"]["id"] != progs[0]["id"],
826 ret, _ = sim.set_xdp(obj, "drv", fail=False)
827 fail(ret == 0, "Replaced XDP program without -force")
831 ret, _ = sim.set_xdp(obj, "drv", force=True, fail=False)
832 fail(ret != 0, "Could not replace XDP program with -force")
836 fail(ipl["xdp"]["prog"]["id"] != progs[0]["id"],
838 fail("dev" in progs[0].keys(),
843 fail=False, include_stderr=True)
844 fail(ret == 0, "Replaced XDP program with a program in different mode")
845 fail(err.count("File exists") != 1, "Replaced driver XDP with generic")
847 fail=False, include_stderr=True)
848 fail(ret == 0, "Replaced XDP program with a program in different mode")
853 fail=False, include_stderr=True)
854 fail(ret == 0, "Removed program with a bad mode")
858 ret, _ = sim.set_mtu(9000, fail=False)
859 fail(ret == 0,
864 ret, _, err = sim.set_xdp(obj, "drv", fail=False, include_stderr=True)
865 fail(ret == 0, "Driver should refuse to load program with MTU of 9000...")
874 fail=False, include_stderr=True)
875 fail(ret == 0, "attached non-offloaded XDP program to HW")
883 ret, _, err = sim.set_xdp(offload, "drv", fail=False, include_stderr=True)
884 fail(ret == 0, "attached offloaded XDP program to drv")
895 fail(link_xdp["id"] != prog["id"], "Loaded program has wrong ID")
902 fail(prog["id"] != link_xdp["id"], "Program IDs don't match")
903 fail(prog["tag"] != link_xdp["tag"], "Program tags don't match")
904 fail(str(link_xdp["id"]) != dprog["id"], "Program IDs don't match")
905 fail(dprog["state"] != "xlated", "Offloaded program state not translated")
906 fail(dprog["loaded"] != "Y", "Offloaded program is not loaded")
923 fail=False, include_stderr=True)
924 fail(ret == 0, "Pinned program loaded for a different device accepted")
928 fail=False, include_stderr=True)
929 fail(ret == 0, "Pinned program loaded for a removed device accepted")
938 fail("prog" not in xdp, "Base program not reported in single program mode")
939 fail(len(ipl["xdp"]["attached"]) != 1,
946 fail(two_xdps["mode"] != 4, "Bad mode reported with multiple programs")
947 fail("prog" in two_xdps, "Base program reported in multi program mode")
948 fail(xdp["attached"][0] not in two_xdps["attached"],
950 fail(len(two_xdps["attached"]) != 2,
952 fail(two_xdps["attached"][0]["prog"]["id"] ==
955 fail(offloaded != offloaded2,
959 ret, _, err = sim.set_xdp(obj, "offload", fail=False, include_stderr=True)
960 fail(err.count("busy") != 1, "Replaced one of programs without -force")
964 fail=False, include_stderr=True)
965 fail(ret == 0, "Removed program with a bad mode")
972 fail(xdp["mode"] != 1, "Bad mode reported after multiple programs")
973 fail("prog" not in xdp,
975 fail(xdp["attached"][0] not in two_xdps["attached"],
977 fail(len(ipl["xdp"]["attached"]) != 1,
979 fail(offloaded != "0", "offload ID reported with only driver program left")
992 fail=False, include_stderr=True)
993 fail(ret == 0, "Loading TC when XDP active should fail")
999 ret, _, err = sim.set_xdp(obj, "offload", fail=False, include_stderr=True)
1000 fail(ret == 0, "Loading XDP when TC active should fail")
1019 ret, _ = sim.cls_bpf_add_filter(pinned, da=True, skip_sw=True, fail=False)
1020 fail(ret == 0, "Managed to attach XDP program to TC")
1025 fail=False, include_stderr=True)
1026 fail(ret == 0, "Managed to offload two TC filters at the same time")
1037 tc_proc = cmd(cmd_line, background=True, fail=False)
1043 ret, _ = cmd_result(tc_proc, fail=False)
1047 fail(ret == 0, "Managed to load TC filter on a unregistering device")
1049 fail(time_diff < delay_sec, "Removal process took %s, expected %s" %
1102 fail=False)
1103 fail(ret == 0, "added too many entries")
1114 fail=False)
1115 fail(ret == 0, "updated non-existing key")
1116 fail(err["error"].find("No such file or directory") == -1,
1124 fail=False)
1125 fail(ret == 0, "updated existing key")
1126 fail(err["error"].find("File exists") == -1,
1134 fail(key != i, "expected key %d, got %d" % (key, i))
1136 fail(val != i * 3, "expected value %d, got %d" % (val, i * 3))
1142 fail(key != 0, "next key %d, expected %d" % (key, 0))
1146 fail(key != 1, "next key %d, expected %d" % (key, 1))
1148 (m["id"], int2str("I", 1)), fail=False)
1149 fail(ret == 0, "got next key past the end of map")
1150 fail(err["error"].find("No such file or directory") == -1,
1160 (htab["id"], int2str("I", i)), fail=False)
1161 fail(ret == 0, "removed entry from an array")
1162 fail(err["error"].find("No such file or directory") == -1,
1178 ret, _ = sim.set_xdp(map_obj, "offload", JSON=False, fail=False)
1179 fail(ret == 0,
1204 ret, _ = simA.set_xdp(progB, "offload", force=True, JSON=False, fail=False)
1205 fail(ret == 0, "cross-ASIC program allowed")
1207 ret, _ = d.set_xdp(progA, "offload", force=True, JSON=False, fail=False)
1208 fail(ret == 0, "cross-ASIC program allowed")
1215 fail=False, include_stderr=True)
1216 fail(ret == 0, "cross-ASIC program allowed")
1220 fail=False, include_stderr=True)
1221 fail(ret == 0, "cross-ASIC program allowed")
1232 fail=False)
1233 fail(ret != 0, "couldn't reuse a map on the same ASIC")
1239 fail=False, include_stderr=True)
1240 fail(ret == 0, "could reuse a map on a different ASIC")
1241 fail(err.count("offload device mismatch between prog and map") == 0,
1247 fail=False, include_stderr=True)
1248 fail(ret == 0, "could reuse a map on a different ASIC")
1249 fail(err.count("offload device mismatch between prog and map") == 0,
1259 fail(ifnameB != simB1['ifname'], "program not bound to originial device")
1265 fail(ifnameB not in (simB2['ifname'], simB3['ifname']),
1270 fail(ifnameB != simB3['ifname'], "program not bound to remaining device")
1276 ret, out = bpftool("prog show %s" % (progB), fail=False)
1277 fail(ret == 0, "got information about orphaned program")
1278 fail("error" not in out, "no error reported for get info on orphaned")
1279 fail(out["error"] != "can't get prog info: No such device",