Files
poky/meta/lib/oeqa/runtime/cases/ltp.py
Petr Vorel a37dba3063 ltp: Update to 20200120
Removed ffsb copying file and associated runtest file fs_ext4
(both removed in this release).

Added LIBS=-lfts for MUSL.

Removed patches (accepted upstream)
* 0001-mkswap01.sh-Add-udevadm-trigger-before-swap-verifica.patch
* 0001-testcases-fix-an-absent-format-string-issue.patch
* 0001-nm01-Remove-prefix-zeros-of-the-addresses-output-by-.patch

Merged patches
* 0006-rt_tgsigqueueinfo-disable-test-on-musl.patch
(into 0001-build-Add-option-to-select-libc-implementation.patch as they
touch the same files)

Refreshed patches (some tests have been fixed for musl)
* 0001-Add-more-musl-exclusions.patch
* 0001-build-Add-option-to-select-libc-implementation.patch
* 0002-kernel-controllers-Link-with-libfts-explicitly-on-mu.patch
IMHO this one shouldn't be needed not, but CI still fails without it

Updated status
* 0008-testcases-network-nfsv4-acl-acl1.c-Security-fix-on-s.patch
* 0001-syscalls-Check-for-time64-unsafe-syscalls-before-usi.patch

(From OE-Core rev: 62e2063698477a13c55ae370451e52a2f1e18e45)

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-03-02 16:16:27 +00:00

119 lines
4.0 KiB
Python

# LTP runtime
#
# Copyright (c) 2019 MontaVista Software, LLC
#
# SPDX-License-Identifier: GPL-2.0-only
#
import time
import datetime
import pprint
from oeqa.runtime.case import OERuntimeTestCase
from oeqa.core.decorator.depends import OETestDepends
from oeqa.runtime.decorator.package import OEHasPackage
from oeqa.utils.logparser import LtpParser
class LtpTestBase(OERuntimeTestCase):
@classmethod
def setUpClass(cls):
cls.ltp_startup()
@classmethod
def tearDownClass(cls):
cls.ltp_finishup()
@classmethod
def ltp_startup(cls):
cls.sections = {}
cls.failmsg = ""
test_log_dir = os.path.join(cls.td.get('WORKDIR', ''), 'testimage')
timestamp = datetime.datetime.now().strftime('%Y%m%d%H%M%S')
cls.ltptest_log_dir_link = os.path.join(test_log_dir, 'ltp_log')
cls.ltptest_log_dir = '%s.%s' % (cls.ltptest_log_dir_link, timestamp)
os.makedirs(cls.ltptest_log_dir)
cls.tc.target.run("mkdir -p /opt/ltp/results")
if not hasattr(cls.tc, "extraresults"):
cls.tc.extraresults = {}
cls.extras = cls.tc.extraresults
cls.extras['ltpresult.rawlogs'] = {'log': ""}
@classmethod
def ltp_finishup(cls):
cls.extras['ltpresult.sections'] = cls.sections
# update symlink to ltp_log
if os.path.exists(cls.ltptest_log_dir_link):
os.remove(cls.ltptest_log_dir_link)
os.symlink(os.path.basename(cls.ltptest_log_dir), cls.ltptest_log_dir_link)
if cls.failmsg:
cls.fail(cls.failmsg)
class LtpTest(LtpTestBase):
ltp_groups = ["math", "syscalls", "dio", "io", "mm", "ipc", "sched", "nptl", "pty", "containers", "controllers", "filecaps", "cap_bounds", "fcntl-locktests", "connectors", "commands", "net.ipv6_lib", "input","fs_perms_simple"]
ltp_fs = ["fs", "fsx", "fs_bind"]
# skip kernel cpuhotplug
ltp_kernel = ["power_management_tests", "hyperthreading ", "kernel_misc", "hugetlb"]
ltp_groups += ltp_fs
def runltp(self, ltp_group):
cmd = '/opt/ltp/runltp -f %s -p -q -r /opt/ltp -l /opt/ltp/results/%s -I 1 -d /opt/ltp' % (ltp_group, ltp_group)
starttime = time.time()
(status, output) = self.target.run(cmd)
endtime = time.time()
with open(os.path.join(self.ltptest_log_dir, "%s-raw.log" % ltp_group), 'w') as f:
f.write(output)
self.extras['ltpresult.rawlogs']['log'] = self.extras['ltpresult.rawlogs']['log'] + output
# copy nice log from DUT
dst = os.path.join(self.ltptest_log_dir, "%s" % ltp_group )
remote_src = "/opt/ltp/results/%s" % ltp_group
(status, output) = self.target.copyFrom(remote_src, dst)
msg = 'File could not be copied. Output: %s' % output
self.assertEqual(status, 0, msg=msg)
parser = LtpParser()
results, sections = parser.parse(dst)
runtime = int(endtime-starttime)
sections['duration'] = runtime
self.sections[ltp_group] = sections
failed_tests = {}
for test in results:
result = results[test]
testname = ("ltpresult." + ltp_group + "." + test)
self.extras[testname] = {'status': result}
if result == 'FAILED':
failed_tests[ltp_group] = test
if failed_tests:
self.failmsg = self.failmsg + "Failed ptests:\n%s" % pprint.pformat(failed_tests)
# LTP runtime tests
@OETestDepends(['ssh.SSHTest.test_ssh'])
@OEHasPackage(["ltp"])
def test_ltp_help(self):
(status, output) = self.target.run('/opt/ltp/runltp --help')
msg = 'Failed to get ltp help. Output: %s' % output
self.assertEqual(status, 0, msg=msg)
@OETestDepends(['ltp.LtpTest.test_ltp_help'])
def test_ltp_groups(self):
for ltp_group in self.ltp_groups:
self.runltp(ltp_group)
@OETestDepends(['ltp.LtpTest.test_ltp_groups'])
def test_ltp_runltp_cve(self):
self.runltp("cve")