Lines Matching refs:test

1434 static int load_sysctl_prog_insns(struct sysctl_test *test,
1437 struct bpf_insn *prog = test->insns;
1443 if (test->fixup_value_insn) {
1460 if (fixup_sysctl_value(buf, len, prog, test->fixup_value_insn))
1468 if (ret < 0 && test->result != LOAD_REJECT) {
1476 static int load_sysctl_prog_file(struct sysctl_test *test)
1481 if (bpf_prog_test_load(test->prog_file, BPF_PROG_TYPE_CGROUP_SYSCTL, &obj, &prog_fd)) {
1482 if (test->result != LOAD_REJECT)
1484 test->prog_file);
1491 static int load_sysctl_prog(struct sysctl_test *test, const char *sysctl_path)
1493 return test->prog_file
1494 ? load_sysctl_prog_file(test)
1495 : load_sysctl_prog_insns(test, sysctl_path);
1499 const struct sysctl_test *test)
1504 fd = open(sysctl_path, test->open_flags | O_CLOEXEC);
1508 if (test->seek && lseek(fd, test->seek, SEEK_SET) == -1) {
1509 log_err("lseek(%d) failed", test->seek);
1513 if (test->open_flags == O_RDONLY) {
1518 if (test->oldval &&
1519 strncmp(buf, test->oldval, strlen(test->oldval))) {
1520 log_err("Read value %s != %s", buf, test->oldval);
1523 } else if (test->open_flags == O_WRONLY) {
1524 if (!test->newval) {
1528 if (write(fd, test->newval, strlen(test->newval)) == -1)
1543 static int run_test_case(int cgfd, struct sysctl_test *test)
1545 enum bpf_attach_type atype = test->attach_type;
1550 printf("Test case: %s .. ", test->descr);
1553 test->sysctl);
1555 progfd = load_sysctl_prog(test, sysctl_path);
1557 if (test->result == LOAD_REJECT)
1564 if (test->result == ATTACH_REJECT)
1571 if (access_sysctl(sysctl_path, test) == -1) {
1572 if (test->result == OP_EPERM && errno == EPERM)
1578 if (test->result != SUCCESS) {