mirror of
https://git.yoctoproject.org/poky
synced 2026-06-01 00:59:48 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
371283df2e
commit
742a801536
@@ -18,7 +18,8 @@ class KSample(OERuntimeTestCase):
|
|||||||
else:
|
else:
|
||||||
# check result
|
# check result
|
||||||
result = ("%s" % match_string) in output
|
result = ("%s" % match_string) in output
|
||||||
self.assertTrue(result)
|
msg = output
|
||||||
|
self.assertTrue(result, msg)
|
||||||
self.assertEqual(status, 0, cmd)
|
self.assertEqual(status, 0, cmd)
|
||||||
|
|
||||||
def check_config(self, config_opt=''):
|
def check_config(self, config_opt=''):
|
||||||
@@ -126,7 +127,16 @@ class KSampleTest(KSample):
|
|||||||
self.cmd_and_check("echo 1 > /sys/kernel/debug/tracing/events/sample-trace/enable")
|
self.cmd_and_check("echo 1 > /sys/kernel/debug/tracing/events/sample-trace/enable")
|
||||||
self.cmd_and_check("cat /sys/kernel/debug/tracing/events/sample-trace/enable")
|
self.cmd_and_check("cat /sys/kernel/debug/tracing/events/sample-trace/enable")
|
||||||
# check result
|
# check result
|
||||||
self.cmd_and_check("cat /sys/kernel/debug/tracing/trace | grep hello | head -n1 | cut -d\':\' -f2", " foo_bar")
|
status = 1
|
||||||
|
count = 0
|
||||||
|
while status != 0:
|
||||||
|
time.sleep(1)
|
||||||
|
status, output = self.target.run('cat /sys/kernel/debug/tracing/trace | grep hello | head -n1 | cut -d\':\' -f2')
|
||||||
|
if " foo_bar" in output:
|
||||||
|
break
|
||||||
|
count = count + 1
|
||||||
|
if count > 5:
|
||||||
|
self.assertTrue(False, "Time out when check result")
|
||||||
# disable trace
|
# disable trace
|
||||||
self.cmd_and_check("echo 0 > /sys/kernel/debug/tracing/events/sample-trace/enable")
|
self.cmd_and_check("echo 0 > /sys/kernel/debug/tracing/events/sample-trace/enable")
|
||||||
# clean up trace
|
# clean up trace
|
||||||
|
|||||||
Reference in New Issue
Block a user