[ACT][PATCH] UBUNTU: SAUCE: ubuntu_ltp_kernel_misc: split kernel_misc test out of ubuntu_ltp

Po-Hsu Lin po-hsu.lin at canonical.com
Tue Oct 19 10:04:32 UTC 2021


Move the kernel_misc test out of the LTP test suite, and run it like
how we did for the ubuntu_ltp_syscalls test. This change can improve
our test granularity and make the result hinting become more precise.

The ubuntu_ltp test on KVM kernels is hanging with the tpci test in
this kernel_misc test (lp:1947422), it should be able to finish
properly with this test split out. (But it is still expected to see
it hanging with this ubuntu_ltp_kernel_misc test.)

The downside of this is that it will cost some extra time for the
deployment and building the test suite.

This change will require a test plan update on CKCT as well.

Signed-off-by: Po-Hsu Lin <po-hsu.lin at canonical.com>
---
 ubuntu_ltp/control                            |   3 +-
 ubuntu_ltp_kernel_misc/blacklist.trusty       |   1 +
 ubuntu_ltp_kernel_misc/blacklist.xenial       |   1 +
 ubuntu_ltp_kernel_misc/control                |  28 +++++
 .../ubuntu_ltp_kernel_misc.py                 | 112 ++++++++++++++++++
 5 files changed, 143 insertions(+), 2 deletions(-)
 create mode 100644 ubuntu_ltp_kernel_misc/blacklist.trusty
 create mode 100644 ubuntu_ltp_kernel_misc/blacklist.xenial
 create mode 100644 ubuntu_ltp_kernel_misc/control
 create mode 100644 ubuntu_ltp_kernel_misc/ubuntu_ltp_kernel_misc.py

diff --git a/ubuntu_ltp/control b/ubuntu_ltp/control
index 8f7b2f18..b713a6ac 100644
--- a/ubuntu_ltp/control
+++ b/ubuntu_ltp/control
@@ -16,8 +16,7 @@ results = job.run_test_detail('ubuntu_ltp', test_name='setup', tag='setup', time
 
 tests = [
     'fs',         'mm',           'commands',
-    'cpuhotplug', 'net.ipv6_lib', 'cve',         'crypto',
-    'kernel_misc'
+    'cpuhotplug', 'net.ipv6_lib', 'cve',         'crypto'
 ]
 for test in tests:
     results = job.run_test_detail('ubuntu_ltp', test_name=test, tag=test, timeout=60*60*2)
diff --git a/ubuntu_ltp_kernel_misc/blacklist.trusty b/ubuntu_ltp_kernel_misc/blacklist.trusty
new file mode 100644
index 00000000..c2c77c6f
--- /dev/null
+++ b/ubuntu_ltp_kernel_misc/blacklist.trusty
@@ -0,0 +1 @@
+Blacklisted on this series as this kernel_misc test was splitted out from ubuntu_ltp, which got this series blacklisted as well.
diff --git a/ubuntu_ltp_kernel_misc/blacklist.xenial b/ubuntu_ltp_kernel_misc/blacklist.xenial
new file mode 100644
index 00000000..c2c77c6f
--- /dev/null
+++ b/ubuntu_ltp_kernel_misc/blacklist.xenial
@@ -0,0 +1 @@
+Blacklisted on this series as this kernel_misc test was splitted out from ubuntu_ltp, which got this series blacklisted as well.
diff --git a/ubuntu_ltp_kernel_misc/control b/ubuntu_ltp_kernel_misc/control
new file mode 100644
index 00000000..1bbf9e96
--- /dev/null
+++ b/ubuntu_ltp_kernel_misc/control
@@ -0,0 +1,28 @@
+AUTHOR = "Ubuntu"
+NAME = "ubuntu_ltp_kernel_misc"
+CRITERIA = """
+Use the upstream LTP repository
+"""
+SUITE = "None"
+TIME = "MEDIUM"
+TEST_CLASS = 'kernel'
+TEST_CATEGORY = 'Functional'
+TEST_TYPE = "client"
+DOC = ""
+
+# This test will take about 50min to run on google cloud
+result = job.run_test_detail(NAME, test_name='setup', tag='setup', timeout=60*40)
+if result == 'ERROR':
+    print("ERROR: test failed to build, skipping all the sub tests")
+else:
+    fn = '/opt/ltp/runtest/kernel_misc'
+    with open(fn , 'r') as f:
+        for line in f:
+            if line.strip() and not line.startswith('#'):
+                with open ('/tmp/target' , 'w') as t:
+                    t.write(line)
+                testcase = line.split()[0]
+                job.run_test_detail(NAME, test_name=testcase, tag=testcase, timeout=60*20)
+
+
+# vi:set ts=4 sw=4 expandtab syntax=python:
diff --git a/ubuntu_ltp_kernel_misc/ubuntu_ltp_kernel_misc.py b/ubuntu_ltp_kernel_misc/ubuntu_ltp_kernel_misc.py
new file mode 100644
index 00000000..c08ba117
--- /dev/null
+++ b/ubuntu_ltp_kernel_misc/ubuntu_ltp_kernel_misc.py
@@ -0,0 +1,112 @@
+#
+#
+import multiprocessing
+import os
+import platform
+import re
+import sys
+import shutil
+import signal
+from autotest.client import test, utils
+from autotest.client.shared import error
+
+# python is redefining the SIGXFSZ handler internally, blocking the delivery of
+# this signal to any forked task. Make sure to restore the default signal
+# handler for SIGXFSZ before running any test.
+try:
+    signal.signal(signal.SIGXFSZ, signal.SIG_DFL)
+except Exception, e:
+    print(e)
+    sys.stdout.flush()
+
+
+class ubuntu_ltp_kernel_misc(test.test):
+    version = 1
+
+    def install_required_pkgs(self):
+        arch = platform.processor()
+
+        pkgs = [
+            'automake',
+            'bison',
+            'build-essential',
+            'byacc',
+            'flex',
+            'git',
+            'libacl1-dev',
+            'libaio-dev',
+            'libcap-dev',
+            'libmm-dev',
+            'libnuma-dev',
+            'libsctp-dev',
+            'libselinux1-dev',
+            'libssl-dev',
+            'libtirpc-dev',
+            'pkg-config',
+            'quota',
+            'xfslibs-dev',
+            'xfsprogs',
+        ]
+        gcc = 'gcc' if arch in ['ppc64le', 'aarch64', 's390x', 'riscv64'] else 'gcc-multilib'
+        pkgs.append(gcc)
+
+        cmd = 'yes "" | DEBIAN_FRONTEND=noninteractive apt-get install --yes --force-yes ' + ' '.join(pkgs)
+        self.results = utils.system_output(cmd, retain_output=True)
+
+    def initialize(self):
+        try:
+            self.series = platform.dist()[2]
+        except AttributeError:
+            import distro
+            self.series = distro.codename()
+        self.flavour = re.split('-\d*-', platform.uname()[2])[-1]
+        self.kernel = platform.uname()[2].split('-')[0]
+
+    # setup
+    #
+    #    Automatically run when there is no autotest/client/tmp/<test-suite> directory
+    #
+    def setup(self):
+        self.install_required_pkgs()
+        self.job.require_gcc()
+        os.chdir(self.srcdir)
+        shutil.rmtree('ltp', ignore_errors=True)
+        branch = 'sru'
+        if self.series in ['trusty', 'xenial']:
+            branch = 'sru-' + self.series
+            print("Use a fixed branch for ESM series - {}".format(branch))
+
+        cmd = 'git clone -b {} --depth 1 git://kernel.ubuntu.com/ubuntu/ltp.git'.format(branch)
+        utils.system_output(cmd, retain_output=True)
+
+        # Print test suite HEAD SHA1 commit id for future reference
+        os.chdir(os.path.join(self.srcdir, 'ltp'))
+        title = utils.system_output("git log --oneline -1 | sed 's/(.*)//'", retain_output=False, verbose=False)
+        print("Latest commit in '{}' branch: {}".format(branch, title))
+
+        # Disable NTFS as we disable RW support
+        cmd = 'sed -i /ntfs/d lib/tst_supported_fs_types.c'
+        utils.system_output(cmd)
+
+        utils.make('autotools')
+        utils.configure()
+        try:
+            nprocs = '-j' + str(multiprocessing.cpu_count())
+        except:
+            nprocs = ''
+        utils.make(nprocs)
+        utils.make('install')
+
+    # run_once
+    #
+    #    Driven by the control file for each individual test.
+    #
+    def run_once(self, test_name):
+        if test_name == 'setup':
+            return
+
+        cmd = '/opt/ltp/runltp -f /tmp/target -q -C /dev/null -l /dev/null -T /dev/null'
+        print(utils.system_output(cmd, verbose=False))
+        # /dev/loop# creation will be taken care by the runltp
+
+# vi:set ts=4 sw=4 expandtab syntax=python:
-- 
2.25.1




More information about the kernel-team mailing list