]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa/runtime/stap: improve systemtap test
authorRoss Burton <ross@burtonini.com>
Mon, 31 Jan 2022 13:54:08 +0000 (13:54 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 1 Feb 2022 07:29:44 +0000 (07:29 +0000)
Split the test up into compile and execute phases, as the stap binary
is known to be quite memory-hungry and this can result in the probe
being unable to allocate enough memory for the buffers it needs.

If the test fails, dump the dmesg as any useful messages will be there.

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/runtime/cases/stap.py

index 615c290ce61f2d52bb1506f549b08e3d0749fafb..480eaabf2dbd7304166b84fe61960ad12cbb34a7 100644 (file)
@@ -14,11 +14,19 @@ class StapTest(OERuntimeTestCase):
     @OEHasPackage(['gcc-symlinks'])
     @OEHasPackage(['kernel-devsrc'])
     def test_stap(self):
-        cmd = 'make -C /usr/src/kernel scripts prepare'
-        status, output = self.target.run(cmd, 900)
-        self.assertEqual(status, 0, msg='\n'.join([cmd, output]))
+        try:
+            cmd = 'make -j -C /usr/src/kernel scripts prepare'
+            status, output = self.target.run(cmd, 900)
+            self.assertEqual(status, 0, msg='\n'.join([cmd, output]))
 
-        cmd = 'stap -v --disable-cache -DSTP_NO_VERREL_CHECK -s1 -e \'probe oneshot { print("Hello, "); println("world!") }\''
-        status, output = self.target.run(cmd, 900)
-        self.assertEqual(status, 0, msg='\n'.join([cmd, output]))
-        self.assertIn('Hello, world!', output, msg='\n'.join([cmd, output]))
+            cmd = 'stap -v -p4 -m stap-hello --disable-cache -DSTP_NO_VERREL_CHECK -e \'probe oneshot { print("Hello, "); println("SystemTap!") }\''
+            status, output = self.target.run(cmd, 900)
+            self.assertEqual(status, 0, msg='\n'.join([cmd, output]))
+
+            cmd = 'staprun -v -R -b1 stap-hello.ko'
+            self.assertEqual(status, 0, msg='\n'.join([cmd, output]))
+            self.assertIn('Hello, SystemTap!', output, msg='\n'.join([cmd, output]))
+        except:
+            status, dmesg = self.target.run('dmesg')
+            if status == 0:
+                print(dmesg)