oeqa/runtime/stap: improve systemtap test

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>
This commit is contained in:
Ross Burton
2022-01-31 13:54:08 +00:00
committed by Richard Purdie
parent 351ee239c7
commit 440a5f6ee6

View File

@@ -14,11 +14,19 @@ class StapTest(OERuntimeTestCase):
@OEHasPackage(['gcc-symlinks'])
@OEHasPackage(['kernel-devsrc'])
def test_stap(self):
cmd = 'make -C /usr/src/kernel scripts prepare'
status, output = self.target.run(cmd, 900)
self.assertEqual(status, 0, msg='\n'.join([cmd, output]))
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 --disable-cache -DSTP_NO_VERREL_CHECK -s1 -e \'probe oneshot { print("Hello, "); println("world!") }\''
status, output = self.target.run(cmd, 900)
self.assertEqual(status, 0, msg='\n'.join([cmd, output]))
self.assertIn('Hello, world!', output, 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)