blob: c492caffd67efcffc8bd419e89facdb28901311b [file] [log] [blame]
Brad Bishop316dfdd2018-06-25 12:45:53 -04001import os
2
3from oeqa.runtime.case import OERuntimeTestCase
4from oeqa.core.decorator.depends import OETestDepends
5from oeqa.core.decorator.oeid import OETestID
6from oeqa.core.decorator.data import skipIfNotFeature
Brad Bishop977dc1a2019-02-06 16:01:43 -05007from oeqa.runtime.decorator.package import OEHasPackage
Brad Bishop316dfdd2018-06-25 12:45:53 -04008
9class StapTest(OERuntimeTestCase):
10
11 @classmethod
Brad Bishop977dc1a2019-02-06 16:01:43 -050012 def setUp(cls):
Brad Bishop316dfdd2018-06-25 12:45:53 -040013 src = os.path.join(cls.tc.runtime_files_dir, 'hello.stp')
14 dst = '/tmp/hello.stp'
15 cls.tc.target.copyTo(src, dst)
16
17 @classmethod
Brad Bishop977dc1a2019-02-06 16:01:43 -050018 def tearDown(cls):
Brad Bishop316dfdd2018-06-25 12:45:53 -040019 files = '/tmp/hello.stp'
20 cls.tc.target.run('rm %s' % files)
21
22 @OETestID(1652)
23 @skipIfNotFeature('tools-profile',
24 'Test requires tools-profile to be in IMAGE_FEATURES')
25 @OETestDepends(['kernelmodule.KernelModuleTest.test_kernel_module'])
Brad Bishop977dc1a2019-02-06 16:01:43 -050026 @OEHasPackage(['systemtap'])
Brad Bishop316dfdd2018-06-25 12:45:53 -040027 def test_stap(self):
28 cmds = [
29 'cd /usr/src/kernel && make scripts prepare',
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080030 'cd /lib/modules/`uname -r` && (if [ ! -e build ]; then ln -s /usr/src/kernel build; fi)',
Brad Bishop316dfdd2018-06-25 12:45:53 -040031 'stap --disable-cache -DSTP_NO_VERREL_CHECK /tmp/hello.stp'
32 ]
33 for cmd in cmds:
34 status, output = self.target.run(cmd, 900)
35 self.assertEqual(status, 0, msg='\n'.join([cmd, output]))