diff options
author | Armin Kuster <akuster808@gmail.com> | 2019-11-16 19:19:43 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-11-21 23:08:19 +0000 |
commit | 5834f2ff44c518ac1baa1ec1e51c4031fe59d6d4 (patch) | |
tree | ed5fc1faa917bb2fa7c986b90f25ae74fb87ceaf /meta/lib/oeqa/runtime | |
parent | bd67c56d366cb70e6af80dbedbe5036671bcae49 (diff) | |
download | poky-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.py | 98 |
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 | |||
8 | import time | ||
9 | import datetime | ||
10 | import pprint | ||
11 | |||
12 | from oeqa.runtime.case import OERuntimeTestCase | ||
13 | from oeqa.core.decorator.depends import OETestDepends | ||
14 | from oeqa.runtime.decorator.package import OEHasPackage | ||
15 | from oeqa.core.decorator.data import skipIfQemu | ||
16 | from oeqa.utils.logparser import LtpParser | ||
17 | |||
18 | class 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 | |||
60 | class 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') | ||