diff options
author | Hongzhi.Song <hongzhi.song@windriver.com> | 2018-08-16 00:38:47 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-08-16 22:40:28 +0100 |
commit | 742a801536b9d46c8b7ad9a3d580c7dcb0dc98cb (patch) | |
tree | 74a65475282c81868d2a3ddfc5a1bcbdb0dac734 /meta/lib/oeqa/runtime/cases | |
parent | 371283df2e315de452891c7ea5f7563ed19cdc88 (diff) | |
download | poky-742a801536b9d46c8b7ad9a3d580c7dcb0dc98cb.tar.gz |
runtime selftest: test_trace_events_sample of ksample.py
The debug info can not be written to trace buffer immediately
by thread. So we should sleep some seconds.
(From OE-Core rev: 5ccf8150b4c65f2feac16cc2881188f14d9e5390)
Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/runtime/cases')
-rw-r--r-- | meta/lib/oeqa/runtime/cases/ksample.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/meta/lib/oeqa/runtime/cases/ksample.py b/meta/lib/oeqa/runtime/cases/ksample.py index 260bc3cfbd..26fbe9d8cb 100644 --- a/meta/lib/oeqa/runtime/cases/ksample.py +++ b/meta/lib/oeqa/runtime/cases/ksample.py | |||
@@ -18,7 +18,8 @@ class KSample(OERuntimeTestCase): | |||
18 | else: | 18 | else: |
19 | # check result | 19 | # check result |
20 | result = ("%s" % match_string) in output | 20 | result = ("%s" % match_string) in output |
21 | self.assertTrue(result) | 21 | msg = output |
22 | self.assertTrue(result, msg) | ||
22 | self.assertEqual(status, 0, cmd) | 23 | self.assertEqual(status, 0, cmd) |
23 | 24 | ||
24 | def check_config(self, config_opt=''): | 25 | def check_config(self, config_opt=''): |
@@ -126,7 +127,16 @@ class KSampleTest(KSample): | |||
126 | self.cmd_and_check("echo 1 > /sys/kernel/debug/tracing/events/sample-trace/enable") | 127 | self.cmd_and_check("echo 1 > /sys/kernel/debug/tracing/events/sample-trace/enable") |
127 | self.cmd_and_check("cat /sys/kernel/debug/tracing/events/sample-trace/enable") | 128 | self.cmd_and_check("cat /sys/kernel/debug/tracing/events/sample-trace/enable") |
128 | # check result | 129 | # check result |
129 | self.cmd_and_check("cat /sys/kernel/debug/tracing/trace | grep hello | head -n1 | cut -d\':\' -f2", " foo_bar") | 130 | status = 1 |
131 | count = 0 | ||
132 | while status != 0: | ||
133 | time.sleep(1) | ||
134 | status, output = self.target.run('cat /sys/kernel/debug/tracing/trace | grep hello | head -n1 | cut -d\':\' -f2') | ||
135 | if " foo_bar" in output: | ||
136 | break | ||
137 | count = count + 1 | ||
138 | if count > 5: | ||
139 | self.assertTrue(False, "Time out when check result") | ||
130 | # disable trace | 140 | # disable trace |
131 | self.cmd_and_check("echo 0 > /sys/kernel/debug/tracing/events/sample-trace/enable") | 141 | self.cmd_and_check("echo 0 > /sys/kernel/debug/tracing/events/sample-trace/enable") |
132 | # clean up trace | 142 | # clean up trace |