stap.py 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. import os
  2. from oeqa.runtime.case import OERuntimeTestCase
  3. from oeqa.core.decorator.depends import OETestDepends
  4. from oeqa.core.decorator.data import skipIfNotFeature
  5. from oeqa.runtime.decorator.package import OEHasPackage
  6. class StapTest(OERuntimeTestCase):
  7. @classmethod
  8. def setUp(cls):
  9. src = os.path.join(cls.tc.runtime_files_dir, 'hello.stp')
  10. dst = '/tmp/hello.stp'
  11. cls.tc.target.copyTo(src, dst)
  12. @classmethod
  13. def tearDown(cls):
  14. files = '/tmp/hello.stp'
  15. cls.tc.target.run('rm %s' % files)
  16. @skipIfNotFeature('tools-profile',
  17. 'Test requires tools-profile to be in IMAGE_FEATURES')
  18. @OETestDepends(['kernelmodule.KernelModuleTest.test_kernel_module'])
  19. @OEHasPackage(['systemtap'])
  20. def test_stap(self):
  21. cmds = [
  22. 'cd /usr/src/kernel && make scripts prepare',
  23. 'cd /lib/modules/`uname -r` && (if [ ! -e build ]; then ln -s /usr/src/kernel build; fi)',
  24. 'stap --disable-cache -DSTP_NO_VERREL_CHECK /tmp/hello.stp'
  25. ]
  26. for cmd in cmds:
  27. status, output = self.target.run(cmd, 900)
  28. self.assertEqual(status, 0, msg='\n'.join([cmd, output]))