[PATCH 1/1] UBUNTU: SAUCE: ubuntu_kernel_selftests: check kernel config against net seltests requirements

Paolo Pisati paolo.pisati at canonical.com
Thu Apr 2 09:10:48 UTC 2020


BugLink: https://bugs.launchpad.net/bugs/1870299

Signed-off-by: Paolo Pisati <paolo.pisati at canonical.com>
---
 .../ubuntu_kernel_selftests.py                | 72 +++++++++++++++++++
 1 file changed, 72 insertions(+)

diff --git a/ubuntu_kernel_selftests/ubuntu_kernel_selftests.py b/ubuntu_kernel_selftests/ubuntu_kernel_selftests.py
index bd754f6d..4916e786 100644
--- a/ubuntu_kernel_selftests/ubuntu_kernel_selftests.py
+++ b/ubuntu_kernel_selftests/ubuntu_kernel_selftests.py
@@ -41,6 +41,7 @@ class ubuntu_kernel_selftests(test.test):
     def initialize(self):
         self.flavour = platform.uname()[2].split('-')[-1]
         self.series = platform.dist()[2]
+        self.kernel_config = None
         pass
 
     def download(self):
@@ -61,6 +62,28 @@ class ubuntu_kernel_selftests(test.test):
             return True
         return False
 
+    def kconfig_load(self):
+        fn = '/boot/config-%s' % platform.release()
+        if os.path.exists(fn):
+            configfile = open(fn, 'r')
+            self.kernel_config = configfile.read()
+            configfile.close()
+        else:
+            print "W: can't access %s, kernel config check disabled" % fn
+
+    def kconfig_check(self, options, tests):
+            makefile = 'linux/tools/testing/selftests/net/Makefile'
+            if not self.kernel_config:
+                return
+            for option in options:
+                matches = re.findall(option, self.kernel_config)
+                if not matches:
+                    for test in tests:
+                        print 'W: %s missing, skipping %s' % (option, test)
+                        cmd = 'sed -i "s/%s//" %s' % (test, makefile)
+                        utils.system(cmd)
+                    break
+
     def setup(self):
         self.install_required_pkgs()
         self.job.require_gcc()
@@ -130,6 +153,55 @@ class ubuntu_kernel_selftests(test.test):
                 cmd = 'chmod -x ' + fn
                 utils.system(cmd)
 
+            #
+            # kernel .config check
+            #
+            self.kconfig_load()
+            self.kconfig_check(
+                    [ 'CONFIG_DUMMY=[y|m]' ],
+                    [
+                      'fib_rule_tests.sh',
+                      'rtnetlink.sh'
+                    ]
+                )
+            self.kconfig_check(
+                    [
+                      'CONFIG_DUMMY=[y|m]',
+                      'CONFIG_IP_ROUTE_MULTIPATH=y',
+                      'CONFIG_NET_ACT_MIRRED=[y|m]',
+                      'CONFIG_NET_CLS_BASIC=[y|m]',
+                      'CONFIG_NET_SCH_FQ_CODEL=[y|m]',
+                      'CONFIG_NET_VRF=[y|m]'
+                    ],
+                    [
+                      'fib_tests.sh'
+                    ]
+                )
+            self.kconfig_check(
+                    ['CONFIG_NET_VRF=[y|m]' ],
+                    [
+                      'fib-onlink-tests.sh',
+                      'test_vxlan_under_vrf.sh'
+                    ]
+                )
+            self.kconfig_check(
+                    [
+                      'CONFIG_NET_SCH_ETF=[y|m]',
+                      'CONFIG_NET_SCH_FQ=[y|m]',
+                      'CONFIG_NET_VRF=[y|m]'
+                    ],
+                    [ 'so_txtime.sh' ]
+                )
+            self.kconfig_check(
+                    [
+                      'CONFIG_DUMMY=[y|m]'
+                      'CONFIG_IPV6=y',
+                      'CONFIG_IPV6_VTI=[y|m]',
+                      'CONFIG_NET_IPVTI=[y|m]'
+                    ],
+                    [ 'pmtu.sh' ]
+                )
+
             #
             # update fix CPU hotplug test, new and old versions
             #
-- 
2.25.1




More information about the kernel-team mailing list