[ACT][PATCH] UBUNTU: SAUCE: ubuntu_ltp_controllers: split controllers test out of ubuntu_ltp

Po-Hsu Lin po-hsu.lin at canonical.com
Wed Sep 29 10:38:34 UTC 2021


Move the controller 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 shortcoming will be the cost of the extra deployment time, test
build time and the extra storage space it will take.

This patch works as expected on our dev jenkins with a Hirsute KVM
instance.

Note that the test plan in CKCT needs to be updated as well.

Signed-off-by: Po-Hsu Lin <po-hsu.lin at canonical.com>
---
 ubuntu_ltp/control                            |   2 +-
 ubuntu_ltp_controllers/blacklist.precise      |   1 +
 ubuntu_ltp_controllers/control                |  29 +++++
 .../ubuntu_ltp_controllers.py                 | 123 ++++++++++++++++++
 4 files changed, 154 insertions(+), 1 deletion(-)
 create mode 100644 ubuntu_ltp_controllers/blacklist.precise
 create mode 100644 ubuntu_ltp_controllers/control
 create mode 100644 ubuntu_ltp_controllers/ubuntu_ltp_controllers.py

diff --git a/ubuntu_ltp/control b/ubuntu_ltp/control
index 27ec8602..c6bd0bd5 100644
--- a/ubuntu_ltp/control
+++ b/ubuntu_ltp/control
@@ -15,7 +15,7 @@ name = 'ubuntu_ltp'
 results = job.run_test_detail('ubuntu_ltp', test_name='setup', tag='setup', timeout=30*60)
 
 tests = [
-    'fs',         'mm',           'controllers', 'commands',
+    'fs',         'mm',           'commands',
     'cpuhotplug', 'net.ipv6_lib', 'cve',         'crypto',
     'kernel_misc'
 ]
diff --git a/ubuntu_ltp_controllers/blacklist.precise b/ubuntu_ltp_controllers/blacklist.precise
new file mode 100644
index 00000000..d00491fd
--- /dev/null
+++ b/ubuntu_ltp_controllers/blacklist.precise
@@ -0,0 +1 @@
+1
diff --git a/ubuntu_ltp_controllers/control b/ubuntu_ltp_controllers/control
new file mode 100644
index 00000000..c4164c53
--- /dev/null
+++ b/ubuntu_ltp_controllers/control
@@ -0,0 +1,29 @@
+AUTHOR = "Ubuntu"
+NAME = "ubuntu_ltp_controllers"
+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*30)
+if result == 'ERROR':
+    print("ERROR: test failed to build, skipping all the sub tests")
+else:
+    fn = '/opt/ltp/runtest/controllers'
+    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]
+                timeout_threshold = 60*60
+                job.run_test_detail(NAME, test_name=testcase, tag=testcase, timeout=timeout_threshold)
+
+
+# vi:set ts=4 sw=4 expandtab syntax=python:
diff --git a/ubuntu_ltp_controllers/ubuntu_ltp_controllers.py b/ubuntu_ltp_controllers/ubuntu_ltp_controllers.py
new file mode 100644
index 00000000..87bfdca9
--- /dev/null
+++ b/ubuntu_ltp_controllers/ubuntu_ltp_controllers.py
@@ -0,0 +1,123 @@
+#
+#
+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_controllers(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',
+            'virt-what',
+            'xfslibs-dev',
+            'xfsprogs',
+        ]
+        gcc = 'gcc' if arch in ['ppc64le', 'aarch64', 's390x', 'riscv64'] else 'gcc-multilib'
+        pkgs.append(gcc)
+
+        if self.flavour in ['aws', 'azure', 'azure-fips', 'gcp', 'gcp-fips', 'gke', 'gkeop']:
+            if not (self.flavour == 'aws' and self.series == 'trusty'):
+                pkgs.append('linux-modules-extra-' + self.flavour + '*')
+        if self.flavour not in ['kvm']:
+            pkgs.append('nfs-kernel-server')
+        if self.series not in ['trusty']:
+            pkgs.append('haveged')
+        if self.series in ['xenial', 'bionic', 'focal']:
+            pkgs.append('python-packaging')
+
+        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