mirror of
https://git.yoctoproject.org/poky
synced 2026-02-11 19:23:03 +01:00
Split the test up into compile and execute phases, as the stap binary is known to be quite memory-hungry and this can result in the probe being unable to allocate enough memory for the buffers it needs. If the test fails, dump the dmesg as any useful messages will be there. (From OE-Core rev: 6cf4d23a2d26c2767edd93f2eb317ff759b5a992) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
33 lines
1.2 KiB
Python
33 lines
1.2 KiB
Python
#
|
|
# SPDX-License-Identifier: MIT
|
|
#
|
|
|
|
import os
|
|
|
|
from oeqa.runtime.case import OERuntimeTestCase
|
|
from oeqa.core.decorator.data import skipIfNotFeature
|
|
from oeqa.runtime.decorator.package import OEHasPackage
|
|
|
|
class StapTest(OERuntimeTestCase):
|
|
@skipIfNotFeature('tools-profile', 'Test requires tools-profile to be in IMAGE_FEATURES')
|
|
@OEHasPackage(['systemtap'])
|
|
@OEHasPackage(['gcc-symlinks'])
|
|
@OEHasPackage(['kernel-devsrc'])
|
|
def test_stap(self):
|
|
try:
|
|
cmd = 'make -j -C /usr/src/kernel scripts prepare'
|
|
status, output = self.target.run(cmd, 900)
|
|
self.assertEqual(status, 0, msg='\n'.join([cmd, output]))
|
|
|
|
cmd = 'stap -v -p4 -m stap-hello --disable-cache -DSTP_NO_VERREL_CHECK -e \'probe oneshot { print("Hello, "); println("SystemTap!") }\''
|
|
status, output = self.target.run(cmd, 900)
|
|
self.assertEqual(status, 0, msg='\n'.join([cmd, output]))
|
|
|
|
cmd = 'staprun -v -R -b1 stap-hello.ko'
|
|
self.assertEqual(status, 0, msg='\n'.join([cmd, output]))
|
|
self.assertIn('Hello, SystemTap!', output, msg='\n'.join([cmd, output]))
|
|
except:
|
|
status, dmesg = self.target.run('dmesg')
|
|
if status == 0:
|
|
print(dmesg)
|