ACK: [ACT][PATCH] UBUNTU: SAUCE: ubuntu_ltp: split those passed tests to ubuntu_ltp_stable

Francis Ginther francis.ginther at canonical.com
Tue Mar 9 16:34:48 UTC 2021


On Tue, Mar 09, 2021 at 10:53:30PM +0800, Po-Hsu Lin wrote:
> Even with syscalls test split into the ubuntu_ltp_syscalls suite,
> the ubuntu_ltp suite is still a huge chunk.
> 
> Those test that always pass will now be put into the
> ubuntu_ltp_stable suite.
> 
> On the other hand, those subsets that keeps failing will be tested in
> ubuntu_ltp, subsets as follows:
>  * fs
>  * mm
>  * controllers
>  * commands
>  * cpuhotplug
>  * net.ipv6_lib
>  * cve
>  * crypto
>  * kernel_misc
> 
> In this way the ubuntu_ltp will be eaiser to review, and reduce the
> chance to timeout on some instances.
> 
> Signed-off-by: Po-Hsu Lin <po-hsu.lin at canonical.com>
Acked-by: Francis Ginther <francis.ginther at canonical.com>
> ---
>  ubuntu_ltp/control                     |   8 +-
>  ubuntu_ltp_stable/blacklist.precise    |   1 +
>  ubuntu_ltp_stable/blacklist.trusty     |   1 +
>  ubuntu_ltp_stable/blacklist.xenial     |   1 +
>  ubuntu_ltp_stable/control              |  27 +++++
>  ubuntu_ltp_stable/skip                 |   6 +
>  ubuntu_ltp_stable/ubuntu_ltp_stable.py | 149 +++++++++++++++++++++++++
>  7 files changed, 187 insertions(+), 6 deletions(-)
>  create mode 100644 ubuntu_ltp_stable/blacklist.precise
>  create mode 100644 ubuntu_ltp_stable/blacklist.trusty
>  create mode 100644 ubuntu_ltp_stable/blacklist.xenial
>  create mode 100644 ubuntu_ltp_stable/control
>  create mode 100644 ubuntu_ltp_stable/skip
>  create mode 100644 ubuntu_ltp_stable/ubuntu_ltp_stable.py
> 
> diff --git a/ubuntu_ltp/control b/ubuntu_ltp/control
> index 0343d8d1..27ec8602 100644
> --- a/ubuntu_ltp/control
> +++ b/ubuntu_ltp/control
> @@ -15,12 +15,8 @@ name = 'ubuntu_ltp'
>  results = job.run_test_detail('ubuntu_ltp', test_name='setup', tag='setup', timeout=30*60)
>  
>  tests = [
> -    'fs',         'fs_perms_simple', 'fsx',            'dio',         'io',
> -    'mm',         'ipc',             'sched',          'math',        'nptl',
> -    'pty',        'containers',      'fs_bind',        'controllers', 'filecaps',
> -    'cap_bounds', 'fcntl-locktests', 'connectors',     'power_management_tests',
> -    'hugetlb',    'commands',        'hyperthreading', 'can',
> -    'cpuhotplug', 'net.ipv6_lib',    'input',          'cve',         'crypto',
> +    'fs',         'mm',           'controllers', 'commands',
> +    'cpuhotplug', 'net.ipv6_lib', 'cve',         'crypto',
>      'kernel_misc'
>  ]
>  for test in tests:
> diff --git a/ubuntu_ltp_stable/blacklist.precise b/ubuntu_ltp_stable/blacklist.precise
> new file mode 100644
> index 00000000..27ba77dd
> --- /dev/null
> +++ b/ubuntu_ltp_stable/blacklist.precise
> @@ -0,0 +1 @@
> +true
> diff --git a/ubuntu_ltp_stable/blacklist.trusty b/ubuntu_ltp_stable/blacklist.trusty
> new file mode 100644
> index 00000000..27ba77dd
> --- /dev/null
> +++ b/ubuntu_ltp_stable/blacklist.trusty
> @@ -0,0 +1 @@
> +true
> diff --git a/ubuntu_ltp_stable/blacklist.xenial b/ubuntu_ltp_stable/blacklist.xenial
> new file mode 100644
> index 00000000..27ba77dd
> --- /dev/null
> +++ b/ubuntu_ltp_stable/blacklist.xenial
> @@ -0,0 +1 @@
> +true
> diff --git a/ubuntu_ltp_stable/control b/ubuntu_ltp_stable/control
> new file mode 100644
> index 00000000..fec4a8c1
> --- /dev/null
> +++ b/ubuntu_ltp_stable/control
> @@ -0,0 +1,27 @@
> +AUTHOR = "Ubuntu"
> +NAME = "ltp"
> +CRITERIA = """
> +Use the upstream LTP repository
> +"""
> +SUITE = "None"
> +TIME = "SHORT"
> +TEST_CLASS = 'kernel'
> +TEST_CATEGORY = 'Functional'
> +TEST_TYPE = "client"
> +DOC = ""
> +
> +name = 'ubuntu_ltp_stable'
> +
> +results = job.run_test_detail('ubuntu_ltp_stable', test_name='setup', tag='setup', timeout=30*60)
> +
> +tests = [
> +    'fs_perms_simple', 'fsx',             'dio',        'io',
> +    'ipc',             'sched',           'math',       'nptl',
> +    'pty',             'containers',      'fs_bind',    'filecaps',
> +    'cap_bounds',      'fcntl-locktests', 'connectors', 'power_management_tests',
> +    'hugetlb',         'hyperthreading',  'can',        'input'
> +]
> +for test in tests:
> +    results = job.run_test_detail('ubuntu_ltp_stable', test_name=test, tag=test, timeout=60*60*2)
> +
> +# vi:set ts=4 sw=4 expandtab syntax=python:
> diff --git a/ubuntu_ltp_stable/skip b/ubuntu_ltp_stable/skip
> new file mode 100644
> index 00000000..0624078e
> --- /dev/null
> +++ b/ubuntu_ltp_stable/skip
> @@ -0,0 +1,6 @@
> +oom01
> +oom02
> +oom03
> +oom04
> +oom05
> +mkswap01_sh mkswap01.sh
> diff --git a/ubuntu_ltp_stable/ubuntu_ltp_stable.py b/ubuntu_ltp_stable/ubuntu_ltp_stable.py
> new file mode 100644
> index 00000000..1d86ae5d
> --- /dev/null
> +++ b/ubuntu_ltp_stable/ubuntu_ltp_stable.py
> @@ -0,0 +1,149 @@
> +#
> +#
> +import multiprocessing
> +import os
> +import platform
> +import re
> +import time
> +from autotest.client                        import test, utils
> +from autotest.client.shared     import error
> +
> +class ubuntu_ltp_stable(test.test):
> +    version = 1
> +
> +    def install_required_pkgs(self):
> +        try:
> +            series = platform.dist()[2]
> +        except AttributeError:
> +            import distro
> +            series = distro.codename()
> +
> +        pkgs = [
> +            'automake',
> +            'bison',
> +            'build-essential',
> +            'byacc',
> +            'flex',
> +            'git',
> +            'keyutils',
> +            '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 self.arch in ['ppc64le', 'aarch64', 's390x', 'riscv64'] else 'gcc-multilib'
> +        pkgs.append(gcc)
> +
> +        if self.flavour in ['aws', 'azure', 'azure-fips', 'gcp', 'gke', 'gkeop']:
> +             pkgs.append('linux-modules-extra-' + self.flavour + '*')
> +
> +        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):
> +        self.flavour = re.split('-\d*-', platform.uname()[2])[-1]
> +        self.arch = platform.processor()
> +        pass
> +
> +    # 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)
> +        cmd = 'git clone --depth=1 https://github.com/linux-test-project/ltp.git'
> +        self.results = 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'))
> +        sha1 = utils.system_output('git rev-parse --short HEAD', retain_output=False, verbose=False)
> +        print("Test suite HEAD SHA1: {}".format(sha1))
> +
> +        # 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')
> +
> +        cmd = 'cat %s > /tmp/skip' % os.path.join(self.bindir, 'skip')
> +        utils.system_output(cmd)
> +
> +    # run_once
> +    #
> +    #    Driven by the control file for each individual test.
> +    #
> +    def run_once(self, test_name):
> +        if test_name == 'setup':
> +            return
> +        fn = '/tmp/syscalls-' + time.strftime("%h%d-%H%M%S")
> +        log_failed = fn + '.failed'
> +        log_output = fn + '.output'
> +
> +        fn = '/opt/ltp/runtest/%s' % (test_name)
> +
> +        print("Setting LTP_TIMEOUT_MUL exceptions...")
> +        timeout_cases = { 'zram01': '5'}
> +        if utils.system_output('virt-what', verbose=False):
> +            print("Running in VM, set timeout multiplier LTP_TIMEOUT_MUL=3 for memcg_test_3 (lp:1836694)")
> +            timeout_cases['memcg_test_3'] = '3'
> +        if self.flavour in ['azure', 'oracle']:
> +            print("Running on Azure / Oracle, set timeout multiplier LTP_TIMEOUT_MUL=3 for cve-2018-1000204 / ioctl_sg01 (lp:1899413)")
> +            timeout_cases['ioctl_sg01'] = '3'
> +        if self.arch in ['ppc64le']:
> +            print("Running on PowerPC, set timeout multiplier LTP_TIMEOUT_MUL=3 for fs_fill (lp:1878763)")
> +            timeout_cases['fs_fill'] = '3'
> +
> +        os.environ["LTP_TIMEOUT_MUL"] = '1'
> +        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)
> +
> +                    for _case in timeout_cases:
> +                        if _case in line:
> +                            os.environ["LTP_TIMEOUT_MUL"] = timeout_cases[_case]
> +                            break
> +
> +                    cmd = '/opt/ltp/runltp -f /tmp/target -S /tmp/skip -C %s -q -l %s -o %s -T /dev/null' % (log_failed, log_output, log_output)
> +                    utils.run(cmd, ignore_status=True, verbose=False)
> +                    # /dev/loop# creation will be taken care by the runltp
> +
> +                    # Restore the timeout multiplier
> +                    os.environ["LTP_TIMEOUT_MUL"] = '1'
> +
> +        num_failed = sum(1 for line in open(log_failed))
> +        print("== Test Suite Summary ==")
> +        print("{} test cases failed".format(num_failed))
> +
> +        if num_failed > 0:
> +            cmd = "awk '{print$1}' " + log_failed + " | sort | uniq | tr '\n' ' '"
> +            failed_list = utils.system_output(cmd, retain_output=False, verbose=False)
> +            print("Failed test cases : %s" % failed_list)
> +
> +        cmd = 'cat ' + log_output
> +        utils.system_output(cmd, retain_output=True, verbose=False)
> +
> +        if num_failed > 0:
> +            raise error.TestError('Test failed for ' + test_name)
> +
> +# vi:set ts=4 sw=4 expandtab syntax=python:
> -- 
> 2.17.1
> 
> 
> -- 
> kernel-team mailing list
> kernel-team at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team



More information about the kernel-team mailing list