diff options
author | Christian Breunig <christian@breunig.cc> | 2023-03-23 15:20:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-23 15:20:54 +0100 |
commit | 63f735891741ed71bff357cf570b00543365d981 (patch) | |
tree | 9d8306da66cd895901411de6d8ee5897266eda2f /smoketest/scripts/system/test_kernel_options.py | |
parent | 4a791a69985d246f694e53ffe9908ff0f34af214 (diff) | |
parent | 32e94e1699c20f4ba3c0a2248f3eb27c07a3f170 (diff) | |
download | vyos-1x-63f735891741ed71bff357cf570b00543365d981.tar.gz vyos-1x-63f735891741ed71bff357cf570b00543365d981.zip |
Merge pull request #1908 from sever-sever/T5086-kern
T5086: Add smoketest DROP_MONITOR kernel option
Diffstat (limited to 'smoketest/scripts/system/test_kernel_options.py')
-rwxr-xr-x | smoketest/scripts/system/test_kernel_options.py | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/smoketest/scripts/system/test_kernel_options.py b/smoketest/scripts/system/test_kernel_options.py index 4d9cbacbe..94be0483a 100755 --- a/smoketest/scripts/system/test_kernel_options.py +++ b/smoketest/scripts/system/test_kernel_options.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2020 VyOS maintainers and contributors +# Copyright (C) 2020-2023 VyOS maintainers and contributors # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 or later as @@ -14,14 +14,19 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +import gzip import re +import os import platform import unittest +from vyos.util import call from vyos.util import read_file kernel = platform.release() config = read_file(f'/boot/config-{kernel}') +CONFIG = '/proc/config.gz' + class TestKernelModules(unittest.TestCase): """ VyOS makes use of a lot of Kernel drivers, modules and features. The @@ -42,6 +47,22 @@ class TestKernelModules(unittest.TestCase): tmp = re.findall(f'{option}=(y|m)', config) self.assertTrue(tmp) + def test_dropmon_enabled(self): + options_to_check = [ + 'CONFIG_NET_DROP_MONITOR=y', + 'CONFIG_UPROBE_EVENTS=y', + 'CONFIG_BPF_EVENTS=y', + 'CONFIG_TRACEPOINTS=y' + ] + if not os.path.isfile(CONFIG): + call('sudo modprobe configs') + + with gzip.open(CONFIG, 'rt') as f: + config_data = f.read() + for option in options_to_check: + self.assertIn(option, config_data, + f"Option {option} is not present in /proc/config.gz") + def test_qemu_support(self): # The bond/lacp interface must be enabled in the OS Kernel for option in ['CONFIG_VIRTIO_BLK', 'CONFIG_SCSI_VIRTIO', @@ -58,6 +79,7 @@ class TestKernelModules(unittest.TestCase): tmp = re.findall(f'{option}=(y|m)', config) self.assertTrue(tmp) + if __name__ == '__main__': unittest.main(verbosity=2) |