mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 12:59:02 +02:00
ltp_compliance: add new runtime
test runtimes in sec. AIO: 14 MEM: 94 MSG: 89 SEM: 30 SIG: 194 THR: 399 TMR: 867 TPS: 23 (From OE-Core rev: e099204c34d1cf90ae4bb44fb0f56e72904c664a) Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
65b50feabe
commit
b49916c252
104
meta/lib/oeqa/runtime/cases/ltp_compliance.py
Normal file
104
meta/lib/oeqa/runtime/cases/ltp_compliance.py
Normal file
|
@ -0,0 +1,104 @@
|
|||
# LTP compliance runtime
|
||||
#
|
||||
# Copyright (c) 2019 MontaVista Software, LLC
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms and conditions of the GNU General Public License,
|
||||
# version 2, as published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
# more details.
|
||||
#
|
||||
|
||||
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 LtpComplianceParser
|
||||
|
||||
class LtpPosixBase(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, 'ltpcomp_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['ltpposixresult.rawlogs'] = {'log': ""}
|
||||
|
||||
|
||||
@classmethod
|
||||
def ltp_finishup(cls):
|
||||
cls.extras['ltpposixresult.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 LtpPosixTest(LtpPosixBase):
|
||||
posix_groups = ["AIO", "MEM", "MSG", "SEM", "SIG", "THR", "TMR", "TPS"]
|
||||
|
||||
def runltp(self, posix_group):
|
||||
cmd = "/opt/ltp/bin/run-posix-option-group-test.sh %s 2>@1 | tee /opt/ltp/results/%s" % (posix_group, posix_group)
|
||||
starttime = time.time()
|
||||
(status, output) = self.target.run(cmd)
|
||||
endtime = time.time()
|
||||
|
||||
with open(os.path.join(self.ltptest_log_dir, "%s" % posix_group), 'w') as f:
|
||||
f.write(output)
|
||||
|
||||
self.extras['ltpposixresult.rawlogs']['log'] = self.extras['ltpposixresult.rawlogs']['log'] + output
|
||||
|
||||
parser = LtpComplianceParser()
|
||||
results, sections = parser.parse(os.path.join(self.ltptest_log_dir, "%s" % posix_group))
|
||||
|
||||
runtime = int(endtime-starttime)
|
||||
sections['duration'] = runtime
|
||||
self.sections[posix_group] = sections
|
||||
|
||||
failed_tests = {}
|
||||
for test in results:
|
||||
result = results[test]
|
||||
testname = ("ltpposixresult." + posix_group + "." + test)
|
||||
self.extras[testname] = {'status': result}
|
||||
if result == 'FAILED':
|
||||
failed_tests[posix_group] = test
|
||||
|
||||
if failed_tests:
|
||||
self.failmsg = self.failmsg + "Failed ptests:\n%s" % pprint.pformat(failed_tests)
|
||||
|
||||
# LTP Posix compliance runtime tests
|
||||
|
||||
@OETestDepends(['ssh.SSHTest.test_ssh'])
|
||||
@OEHasPackage(["ltp"])
|
||||
def test_posix_groups(self):
|
||||
for posix_group in self.posix_groups:
|
||||
self.runltp(posix_group)
|
Loading…
Reference in New Issue
Block a user