tools/net/ynl/tests/rt-link.c

Source file repositories/reference/linux-study-clean/tools/net/ynl/tests/rt-link.c

File Facts

System
Linux kernel
Corpus path
tools/net/ynl/tests/rt-link.c
Extension
.c
Size
4693 bytes
Lines
207
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

if (link->_hdr.ifi_index == netkit_ifindex) {
			rt_link_print(_metadata, link);
			found = true;
		}
	}
	rt_link_getlink_list_free(rsp);
	EXPECT_TRUE(found);

	netkit_delete(_metadata, self->ys, netkit_ifindex);
}

TEST_F(rt_link, netkit_err_msg)
{
	struct rt_link_newlink_req *req;
	int ret;

	/* Test creating netkit with bad policy - should fail */
	req = rt_link_newlink_req_alloc();
	ASSERT_NE(NULL, req);
	rt_link_newlink_req_set_nlflags(req, NLM_F_CREATE);
	rt_link_newlink_req_set_linkinfo_kind(req, "netkit");
	rt_link_newlink_req_set_linkinfo_data_netkit_policy(req, 10);

	ret = rt_link_newlink(self->ys, req);
	rt_link_newlink_req_free(req);
	EXPECT_NE(0, ret) {
		TH_LOG("creating netkit with bad policy should fail");
	}

	/* Expect:
	 * Kernel error: 'Provided default xmit policy not supported' (bad attribute: .linkinfo.data(netkit).policy)
	 */
	EXPECT_NE(NULL, strstr(self->ys->err.msg, "bad attribute: .linkinfo.data(netkit).policy")) {
		TH_LOG("expected extack msg not found: %s",
		       self->ys->err.msg);
	}
}

TEST_HARNESS_MAIN

Annotation

Implementation Notes