Message ID | 20200402091048.29552-2-paolo.pisati@canonical.com |
---|---|
State | New |
Headers | show |
Series | ubuntu_kernel_selftests: net: | expand |
Apology for the late reply. My filter for autotest-client-tests didn't catch this. Please see inline comments for some nitpicking reviews. On Thu, Apr 2, 2020 at 5:11 PM Paolo Pisati <paolo.pisati@canonical.com> wrote: > BugLink: https://bugs.launchpad.net/bugs/1870299 Can you add some comments here for this commit. It will be easier for people to read the git log. > > Signed-off-by: Paolo Pisati <paolo.pisati@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') I would suggest to use "with open" recommended here: https://docs.python.org/3/tutorial/inputoutput.html > + 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', This config was not listed as a requirement in the tools/testing/selftests/net/config file from the source tree, how can you tell this is needed? I guess it's from reading the test script? If that's the case maybe we can add this to the config file upstream. > + 'CONFIG_NET_ACT_MIRRED=[y|m]', Same as CONFIG_IP_ROUTE_MULTIPATH. > + 'CONFIG_NET_CLS_BASIC=[y|m]', Same as CONFIG_IP_ROUTE_MULTIPATH. > + 'CONFIG_NET_SCH_FQ_CODEL=[y|m]', Same as CONFIG_IP_ROUTE_MULTIPATH. > + '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]' Missing coma here. This will make it to check for CONFIG_DUMMY=[y|m]CONFIG_IPV6=y > + '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 > > > -- > kernel-team mailing list > kernel-team@lists.ubuntu.com > https://lists.ubuntu.com/mailman/listinfo/kernel-team
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 #
BugLink: https://bugs.launchpad.net/bugs/1870299 Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com> --- .../ubuntu_kernel_selftests.py | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+)