summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/runtime
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2019-11-16 19:19:43 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-11-21 23:08:19 +0000
commit5834f2ff44c518ac1baa1ec1e51c4031fe59d6d4 (patch)
treeed5fc1faa917bb2fa7c986b90f25ae74fb87ceaf /meta/lib/oeqa/runtime
parentbd67c56d366cb70e6af80dbedbe5036671bcae49 (diff)
downloadpoky-5834f2ff44c518ac1baa1ec1e51c4031fe59d6d4.tar.gz
oeqa/manual/compliance-test: move crashme to runtime
[v3] remove fork12 from crashme. runs forever missed in v2 resend (From OE-Core rev: 5d32ff52a36bdcc6abe55b89bf81c3312a03160a) Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/runtime')
-rw-r--r--meta/lib/oeqa/runtime/cases/ltp_stress.py98
1 files changed, 98 insertions, 0 deletions
diff --git a/meta/lib/oeqa/runtime/cases/ltp_stress.py b/meta/lib/oeqa/runtime/cases/ltp_stress.py
new file mode 100644
index 0000000000..2445ffbc93
--- /dev/null
+++ b/meta/lib/oeqa/runtime/cases/ltp_stress.py
@@ -0,0 +1,98 @@
1# LTP Stress runtime
2#
3# Copyright (c) 2019 MontaVista Software, LLC
4#
5# SPDX-License-Identifier: MIT
6#
7
8import time
9import datetime
10import pprint
11
12from oeqa.runtime.case import OERuntimeTestCase
13from oeqa.core.decorator.depends import OETestDepends
14from oeqa.runtime.decorator.package import OEHasPackage
15from oeqa.core.decorator.data import skipIfQemu
16from oeqa.utils.logparser import LtpParser
17
18class LtpStressBase(OERuntimeTestCase):
19
20 @classmethod
21 def setUpClass(cls):
22 cls.ltp_startup()
23
24 @classmethod
25 def tearDownClass(cls):
26 cls.ltp_finishup()
27
28 @classmethod
29 def ltp_startup(cls):
30 cls.sections = {}
31 cls.failmsg = ""
32 test_log_dir = os.path.join(cls.td.get('WORKDIR', ''), 'testimage')
33 timestamp = datetime.datetime.now().strftime('%Y%m%d%H%M%S')
34
35 cls.ltptest_log_dir_link = os.path.join(test_log_dir, 'ltpstress_log')
36 cls.ltptest_log_dir = '%s.%s' % (cls.ltptest_log_dir_link, timestamp)
37 os.makedirs(cls.ltptest_log_dir)
38
39 cls.tc.target.run("mkdir -p /opt/ltp/results")
40
41 if not hasattr(cls.tc, "extraresults"):
42 cls.tc.extraresults = {}
43 cls.extras = cls.tc.extraresults
44 cls.extras['ltpstressresult.rawlogs'] = {'log': ""}
45
46
47 @classmethod
48 def ltp_finishup(cls):
49 cls.extras['ltpstressresult.sections'] = cls.sections
50
51 # update symlink to ltp_log
52 if os.path.exists(cls.ltptest_log_dir_link):
53 os.remove(cls.ltptest_log_dir_link)
54
55 os.symlink(os.path.basename(cls.ltptest_log_dir), cls.ltptest_log_dir_link)
56
57 if cls.failmsg:
58 cls.fail(cls.failmsg)
59
60class LtpStressTest(LtpStressBase):
61
62 def runltp(self, stress_group):
63 cmd = '/opt/ltp/runltp -f %s -p -q 2>@1 | tee /opt/ltp/results/%s' % (stress_group, stress_group)
64 starttime = time.time()
65 (status, output) = self.target.run(cmd)
66 endtime = time.time()
67 with open(os.path.join(self.ltptest_log_dir, "%s" % stress_group), 'w') as f:
68 f.write(output)
69
70 self.extras['ltpstressresult.rawlogs']['log'] = self.extras['ltpstressresult.rawlogs']['log'] + output
71
72 parser = LtpParser()
73 results, sections = parser.parse(os.path.join(self.ltptest_log_dir, "%s" % stress_group))
74
75 runtime = int(endtime-starttime)
76 sections['duration'] = runtime
77 self.sections[stress_group] = sections
78
79 failed_tests = {}
80 for test in results:
81 result = results[test]
82 testname = ("ltpstressresult." + stress_group + "." + test)
83 self.extras[testname] = {'status': result}
84 if result == 'FAILED':
85 failed_tests[stress_group] = test
86
87 if failed_tests:
88 self.failmsg = self.failmsg + "Failed ptests:\n%s" % pprint.pformat(failed_tests)
89
90 # LTP stress runtime tests
91 #
92 @skipIfQemu('qemuall', 'Test only runs on real hardware')
93
94 @OETestDepends(['ssh.SSHTest.test_ssh'])
95 @OEHasPackage(["ltp"])
96 def test_ltp_stress(self):
97 self.tc.target.run("sed -i -r 's/^fork12.*//' /opt/ltp/runtest/crashme")
98 self.runltp('crashme')