All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] oeqa/runtime/stap.py: add runtime test for systemtap
@ 2018-04-03 15:25 Victor Kamensky
  2018-04-13 13:23 ` Burton, Ross
  0 siblings, 1 reply; 2+ messages in thread
From: Victor Kamensky @ 2018-04-03 15:25 UTC (permalink / raw)
  To: openembedded-core; +Cc: Alexander Kanavin

Add runtime test for stap to test basic SystemTap
operations: can compile very basic module and run on
target device.

Note we disable (-DSTP_NO_VERREL_CHECK) SystemTap
additional kernel release check since during OE testing
mismatching kernel-devsrc and kernels are used.

Signed-off-by: Victor Kamensky <kamensky@cisco.com>
---

 v2 updates:
    * prepare in /usr/src/kernel make as in
      kernelmodule.py

    * use of uname -r for kernel release retrieval

    * adds -DSTP_NO_VERREL_CHECK to allow mismatch
      between running kernel and kernel-devsrc

 meta/lib/oeqa/runtime/cases/stap.py   | 33 +++++++++++++++++++++++++++++++++
 meta/lib/oeqa/runtime/files/hello.stp |  1 +
 2 files changed, 34 insertions(+)
 create mode 100644 meta/lib/oeqa/runtime/cases/stap.py
 create mode 100644 meta/lib/oeqa/runtime/files/hello.stp

diff --git a/meta/lib/oeqa/runtime/cases/stap.py b/meta/lib/oeqa/runtime/cases/stap.py
new file mode 100644
index 0000000..fc728bf
--- /dev/null
+++ b/meta/lib/oeqa/runtime/cases/stap.py
@@ -0,0 +1,33 @@
+import os
+
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.core.decorator.depends import OETestDepends
+from oeqa.core.decorator.oeid import OETestID
+from oeqa.core.decorator.data import skipIfNotFeature
+
+class StapTest(OERuntimeTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        src = os.path.join(cls.tc.runtime_files_dir, 'hello.stp')
+        dst = '/tmp/hello.stp'
+        cls.tc.target.copyTo(src, dst)
+
+    @classmethod
+    def tearDownClass(cls):
+        files = '/tmp/hello.stp'
+        cls.tc.target.run('rm %s' % files)
+
+    @OETestID(1652)
+    @skipIfNotFeature('tools-profile',
+                      'Test requires tools-profile to be in IMAGE_FEATURES')
+    @OETestDepends(['kernelmodule.KernelModuleTest.test_kernel_module'])
+    def test_stap(self):
+        cmds = [
+            'cd /usr/src/kernel && make scripts prepare',
+            'cd /lib/modules/`uname -r` && (if [ ! -L build ]; then ln -s /usr/src/kernel build; fi)',
+            'stap --disable-cache -DSTP_NO_VERREL_CHECK /tmp/hello.stp'
+            ]
+        for cmd in cmds:
+            status, output = self.target.run(cmd, 900)
+            self.assertEqual(status, 0, msg='\n'.join([cmd, output]))
diff --git a/meta/lib/oeqa/runtime/files/hello.stp b/meta/lib/oeqa/runtime/files/hello.stp
new file mode 100644
index 0000000..3677147
--- /dev/null
+++ b/meta/lib/oeqa/runtime/files/hello.stp
@@ -0,0 +1 @@
+probe oneshot { println("hello world") }
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] oeqa/runtime/stap.py: add runtime test for systemtap
  2018-04-03 15:25 [PATCH v2] oeqa/runtime/stap.py: add runtime test for systemtap Victor Kamensky
@ 2018-04-13 13:23 ` Burton, Ross
  0 siblings, 0 replies; 2+ messages in thread
From: Burton, Ross @ 2018-04-13 13:23 UTC (permalink / raw)
  To: Victor Kamensky; +Cc: Alexander Kanavin, OE-core

On 3 April 2018 at 16:25, Victor Kamensky <kamensky@cisco.com> wrote:
> +    @OETestID(1652)
> +    @skipIfNotFeature('tools-profile',
> +                      'Test requires tools-profile to be in IMAGE_FEATURES')
> +    @OETestDepends(['kernelmodule.KernelModuleTest.test_kernel_module'])
> +    def test_stap(self):

Instead of skipIfNotFeature use OETestDepends(systemtap), as platforms
which don't support systemtap can still have tools-profile enabled
(such as musl systems).

Then please add stap to the default cases in testimage.bbclass for the
sdk images.

Also shouldn't the test be looking at the output to check that 'hello
world' was displayed?  Otherwise stap might have done exit(0) but the
script didn't actually run.

Ross


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-04-13 13:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-03 15:25 [PATCH v2] oeqa/runtime/stap.py: add runtime test for systemtap Victor Kamensky
2018-04-13 13:23 ` Burton, Ross

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.