summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/runtime/cases/stap.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/runtime/cases/stap.py')
-rw-r--r--meta/lib/oeqa/runtime/cases/stap.py41
1 files changed, 19 insertions, 22 deletions
diff --git a/meta/lib/oeqa/runtime/cases/stap.py b/meta/lib/oeqa/runtime/cases/stap.py
index 5342f6ac34..3be4162108 100644
--- a/meta/lib/oeqa/runtime/cases/stap.py
+++ b/meta/lib/oeqa/runtime/cases/stap.py
@@ -1,37 +1,34 @@
1# 1#
2# Copyright OpenEmbedded Contributors
3#
2# SPDX-License-Identifier: MIT 4# SPDX-License-Identifier: MIT
3# 5#
4 6
5import os 7import os
6 8
7from oeqa.runtime.case import OERuntimeTestCase 9from oeqa.runtime.case import OERuntimeTestCase
8from oeqa.core.decorator.depends import OETestDepends
9from oeqa.core.decorator.data import skipIfNotFeature 10from oeqa.core.decorator.data import skipIfNotFeature
10from oeqa.runtime.decorator.package import OEHasPackage 11from oeqa.runtime.decorator.package import OEHasPackage
11 12
12class StapTest(OERuntimeTestCase): 13class StapTest(OERuntimeTestCase):
13 14 @skipIfNotFeature('tools-profile', 'Test requires tools-profile to be in IMAGE_FEATURES')
14 @classmethod
15 def setUp(cls):
16 src = os.path.join(cls.tc.runtime_files_dir, 'hello.stp')
17 dst = '/tmp/hello.stp'
18 cls.tc.target.copyTo(src, dst)
19
20 @classmethod
21 def tearDown(cls):
22 files = '/tmp/hello.stp'
23 cls.tc.target.run('rm %s' % files)
24
25 @skipIfNotFeature('tools-profile',
26 'Test requires tools-profile to be in IMAGE_FEATURES')
27 @OETestDepends(['kernelmodule.KernelModuleTest.test_kernel_module'])
28 @OEHasPackage(['systemtap']) 15 @OEHasPackage(['systemtap'])
16 @OEHasPackage(['gcc-symlinks'])
17 @OEHasPackage(['kernel-devsrc'])
29 def test_stap(self): 18 def test_stap(self):
30 cmds = [ 19 try:
31 'cd /usr/src/kernel && make scripts prepare', 20 cmd = 'make -j -C /usr/src/kernel scripts prepare'
32 'cd /lib/modules/`uname -r` && (if [ ! -e build ]; then ln -s /usr/src/kernel build; fi)',
33 'stap --disable-cache -DSTP_NO_VERREL_CHECK /tmp/hello.stp'
34 ]
35 for cmd in cmds:
36 status, output = self.target.run(cmd, 900) 21 status, output = self.target.run(cmd, 900)
37 self.assertEqual(status, 0, msg='\n'.join([cmd, output])) 22 self.assertEqual(status, 0, msg='\n'.join([cmd, output]))
23
24 cmd = 'stap -v -p4 -m stap-hello --disable-cache -DSTP_NO_VERREL_CHECK -e \'probe oneshot { print("Hello, "); println("SystemTap!") }\''
25 status, output = self.target.run(cmd, 900)
26 self.assertEqual(status, 0, msg='\n'.join([cmd, output]))
27
28 cmd = 'staprun -v -R -b1 stap-hello.ko'
29 self.assertEqual(status, 0, msg='\n'.join([cmd, output]))
30 self.assertIn('Hello, SystemTap!', output, msg='\n'.join([cmd, output]))
31 except:
32 status, dmesg = self.target.run('dmesg')
33 if status == 0:
34 print(dmesg)