Path: blob/main/tests/sys/netlink/test_netlink_message_writer.py
39536 views
import mmap1import pytest23from atf_python.ktest import BaseKernelTest4from atf_python.sys.netlink.attrs import NlAttrU3256M_NOWAIT = 17M_WAITOK = 289NLMSG_SMALL = 12810NLMSG_LARGE = 20481112class TestNetlinkMessageWriter(BaseKernelTest):13KTEST_MODULE_NAME = "ktest_netlink_message_writer"1415@pytest.mark.parametrize(16"malloc_flags",17[18pytest.param(M_NOWAIT, id="NOWAIT"),19pytest.param(M_WAITOK, id="WAITOK"),20],21)22@pytest.mark.parametrize(23"sz",24[25pytest.param([NLMSG_SMALL, NLMSG_SMALL], id="NLMSG_SMALL"),26pytest.param([NLMSG_LARGE, NLMSG_LARGE], id="NLMSG_LARGE"),27pytest.param([NLMSG_LARGE + 256, NLMSG_LARGE + 256], id="NLMSG_LARGE+256"),28],29)30def test_nlbuf_writer_allocation(self, sz, malloc_flags):31"""override to parametrize"""3233test_meta = [34NlAttrU32(1, sz[0]), # size35NlAttrU32(2, sz[1]), # expected_avail36NlAttrU32(3, malloc_flags),37]38self.runtest(test_meta)394041