diff options
| author | Ross Burton <ross@burtonini.com> | 2022-01-14 18:08:10 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-01-15 16:23:24 +0000 |
| commit | af01b73f3cad4c43ab2a37965ef0fd8cde6c3aed (patch) | |
| tree | 5d916fed5a328d47ade1ceda1437103b9c741beb | |
| parent | c1af5e38198257a68560800799b346f8c24f7a5b (diff) | |
| download | poky-af01b73f3cad4c43ab2a37965ef0fd8cde6c3aed.tar.gz | |
oeqa/runtime/stap: rewrite test
There's no need to copy files to the target when stap can take the short
probe directly.
Add more has-package decorators for the kernel source and GCC symlinks.
Remove the test dependencies as it's not a hard dependency.
Change the probe to print a message with some minimal logic, and verify
that the message was correctly constructed in the output.
(From OE-Core rev: 3954dc857df1d2a7e559b4fd357b54f39cf7374a)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/lib/oeqa/runtime/cases/stap.py | 35 | ||||
| -rw-r--r-- | meta/lib/oeqa/runtime/files/hello.stp | 1 |
2 files changed, 11 insertions, 25 deletions
diff --git a/meta/lib/oeqa/runtime/cases/stap.py b/meta/lib/oeqa/runtime/cases/stap.py index 5342f6ac34..ac0125edb2 100644 --- a/meta/lib/oeqa/runtime/cases/stap.py +++ b/meta/lib/oeqa/runtime/cases/stap.py | |||
| @@ -5,33 +5,20 @@ | |||
| 5 | import os | 5 | import os |
| 6 | 6 | ||
| 7 | from oeqa.runtime.case import OERuntimeTestCase | 7 | from oeqa.runtime.case import OERuntimeTestCase |
| 8 | from oeqa.core.decorator.depends import OETestDepends | ||
| 9 | from oeqa.core.decorator.data import skipIfNotFeature | 8 | from oeqa.core.decorator.data import skipIfNotFeature |
| 10 | from oeqa.runtime.decorator.package import OEHasPackage | 9 | from oeqa.runtime.decorator.package import OEHasPackage |
| 11 | 10 | ||
| 12 | class StapTest(OERuntimeTestCase): | 11 | class StapTest(OERuntimeTestCase): |
| 13 | 12 | @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']) | 13 | @OEHasPackage(['systemtap']) |
| 14 | @OEHasPackage(['gcc-symlinks']) | ||
| 15 | @OEHasPackage(['kernel-devsrc']) | ||
| 29 | def test_stap(self): | 16 | def test_stap(self): |
| 30 | cmds = [ | 17 | cmd = 'make -C /usr/src/kernel scripts prepare' |
| 31 | 'cd /usr/src/kernel && make scripts prepare', | 18 | status, output = self.target.run(cmd, 900) |
| 32 | 'cd /lib/modules/`uname -r` && (if [ ! -e build ]; then ln -s /usr/src/kernel build; fi)', | 19 | self.assertEqual(status, 0, msg='\n'.join([cmd, output])) |
| 33 | 'stap --disable-cache -DSTP_NO_VERREL_CHECK /tmp/hello.stp' | 20 | |
| 34 | ] | 21 | cmd = 'stap -v --disable-cache -DSTP_NO_VERREL_CHECK -e \'probe oneshot { print("Hello, "); println("world!") }\'' |
| 35 | for cmd in cmds: | 22 | status, output = self.target.run(cmd, 900) |
| 36 | status, output = self.target.run(cmd, 900) | 23 | self.assertEqual(status, 0, msg='\n'.join([cmd, output])) |
| 37 | self.assertEqual(status, 0, msg='\n'.join([cmd, output])) | 24 | self.assertIn('Hello, world!', output, msg='\n'.join([cmd, output])) |
diff --git a/meta/lib/oeqa/runtime/files/hello.stp b/meta/lib/oeqa/runtime/files/hello.stp deleted file mode 100644 index 3677147162..0000000000 --- a/meta/lib/oeqa/runtime/files/hello.stp +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | probe oneshot { println("hello world") } | ||
