summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2019-04-22 06:32:43 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-06-18 11:28:58 +0100
commitf3457dfbc3fa121466d0ac1954e7fd14f63a5502 (patch)
treef05902b0ed0156df1596ebb54d7abe75d67ef3e9 /meta
parentacf1e0b1fe19feffd8ac350f699502b6c43559a0 (diff)
downloadpoky-f3457dfbc3fa121466d0ac1954e7fd14f63a5502.tar.gz
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: 2ad81e503afdde2711ccc54942e83fce02f4cbe5) Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/runtime/cases/ltp_compliance.py104
1 files changed, 104 insertions, 0 deletions
diff --git a/meta/lib/oeqa/runtime/cases/ltp_compliance.py b/meta/lib/oeqa/runtime/cases/ltp_compliance.py
new file mode 100644
index 0000000000..be9a9a32af
--- /dev/null
+++ b/meta/lib/oeqa/runtime/cases/ltp_compliance.py
@@ -0,0 +1,104 @@
1# LTP compliance runtime
2#
3# Copyright (c) 2019 MontaVista Software, LLC
4#
5# This program is free software; you can redistribute it and/or modify it
6# under the terms and conditions of the GNU General Public License,
7# version 2, as published by the Free Software Foundation.
8#
9# This program is distributed in the hope it will be useful, but WITHOUT
10# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12# more details.
13#
14
15import time
16import datetime
17import pprint
18
19from oeqa.runtime.case import OERuntimeTestCase
20from oeqa.core.decorator.depends import OETestDepends
21from oeqa.runtime.decorator.package import OEHasPackage
22from oeqa.utils.logparser import LtpComplianceParser
23
24class LtpPosixBase(OERuntimeTestCase):
25
26 @classmethod
27 def setUpClass(cls):
28 cls.ltp_startup()
29
30 @classmethod
31 def tearDownClass(cls):
32 cls.ltp_finishup()
33
34 @classmethod
35 def ltp_startup(cls):
36 cls.sections = {}
37 cls.failmsg = ""
38 test_log_dir = os.path.join(cls.td.get('WORKDIR', ''), 'testimage')
39 timestamp = datetime.datetime.now().strftime('%Y%m%d%H%M%S')
40
41 cls.ltptest_log_dir_link = os.path.join(test_log_dir, 'ltpcomp_log')
42 cls.ltptest_log_dir = '%s.%s' % (cls.ltptest_log_dir_link, timestamp)
43 os.makedirs(cls.ltptest_log_dir)
44
45 cls.tc.target.run("mkdir -p /opt/ltp/results")
46
47 if not hasattr(cls.tc, "extraresults"):
48 cls.tc.extraresults = {}
49 cls.extras = cls.tc.extraresults
50 cls.extras['ltpposixresult.rawlogs'] = {'log': ""}
51
52
53 @classmethod
54 def ltp_finishup(cls):
55 cls.extras['ltpposixresult.sections'] = cls.sections
56
57 # update symlink to ltp_log
58 if os.path.exists(cls.ltptest_log_dir_link):
59 os.remove(cls.ltptest_log_dir_link)
60
61 os.symlink(os.path.basename(cls.ltptest_log_dir), cls.ltptest_log_dir_link)
62
63 if cls.failmsg:
64 cls.fail(cls.failmsg)
65
66class LtpPosixTest(LtpPosixBase):
67 posix_groups = ["AIO", "MEM", "MSG", "SEM", "SIG", "THR", "TMR", "TPS"]
68
69 def runltp(self, posix_group):
70 cmd = "/opt/ltp/bin/run-posix-option-group-test.sh %s 2>@1 | tee /opt/ltp/results/%s" % (posix_group, posix_group)
71 starttime = time.time()
72 (status, output) = self.target.run(cmd)
73 endtime = time.time()
74
75 with open(os.path.join(self.ltptest_log_dir, "%s" % posix_group), 'w') as f:
76 f.write(output)
77
78 self.extras['ltpposixresult.rawlogs']['log'] = self.extras['ltpposixresult.rawlogs']['log'] + output
79
80 parser = LtpComplianceParser()
81 results, sections = parser.parse(os.path.join(self.ltptest_log_dir, "%s" % posix_group))
82
83 runtime = int(endtime-starttime)
84 sections['duration'] = runtime
85 self.sections[posix_group] = sections
86
87 failed_tests = {}
88 for test in results:
89 result = results[test]
90 testname = ("ltpposixresult." + posix_group + "." + test)
91 self.extras[testname] = {'status': result}
92 if result == 'FAILED':
93 failed_tests[posix_group] = test
94
95 if failed_tests:
96 self.failmsg = self.failmsg + "Failed ptests:\n%s" % pprint.pformat(failed_tests)
97
98 # LTP Posix compliance runtime tests
99
100 @OETestDepends(['ssh.SSHTest.test_ssh'])
101 @OEHasPackage(["ltp"])
102 def test_posix_groups(self):
103 for posix_group in self.posix_groups:
104 self.runltp(posix_group)