def mod(): """ Build LlvmSysctlModule for net.core.* sysctl options shared among tests. """ source = KernelSource("kernel/linux-3.10.0-862.el7", True) kernel_module = source.get_module_from_source("net/core/sysctl_net_core.c") yield LlvmSysctlModule(kernel_module, "net_core_table") source.finalize()
def test_find_param_var(): """ Test finding the name of a variable corresponding to a module parameter. This is necessary since for parameters defined with module_param_named, names of the parameter and of the variable differ. """ source = KernelSource("kernel/linux-3.10", True) mod = source.get_module_from_source("net/rfkill/core.c") assert mod.find_param_var("default_state").name == "rfkill_default_state"
def test_get_child(): """Test getting child of a sysctl definition.""" source = KernelSource("kernel/linux-3.10.0-862.el7", True) kernel_module = source.get_module_from_source("kernel/sysctl.c") sysctl_module = LlvmSysctlModule(kernel_module, "sysctl_base_table") assert sysctl_module.get_child("vm").name == "vm_table"