All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta][PATCH 0/2] Add kernel-sample tests for runtime test
@ 2018-06-05  2:32 Hongzhi.Song
  2018-06-05  2:32 ` [meta][PATCH 1/2] meta runtime testcases: enable kernel-sample features for runtime tests Hongzhi.Song
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Hongzhi.Song @ 2018-06-05  2:32 UTC (permalink / raw)
  To: openembedded-core

V4:
 * add support for qemu by default

V3:
 * remove duplicated code

V2:
 * use shared function to replace similar code

Hongzhi.Song (2):
  meta runtime testcases: enable kernel-sample features for runtime
    tests
  Meta runtime cases: add testcases for kernel sample

 meta/lib/oeqa/runtime/cases/ksample.py    | 213 ++++++++++++++++++++++++++++++
 meta/recipes-kernel/linux/linux-yocto.inc |   3 +
 2 files changed, 216 insertions(+)
 create mode 100644 meta/lib/oeqa/runtime/cases/ksample.py

-- 
2.8.1



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

* [meta][PATCH 1/2] meta runtime testcases: enable kernel-sample features for runtime tests
  2018-06-05  2:32 [meta][PATCH 0/2] Add kernel-sample tests for runtime test Hongzhi.Song
@ 2018-06-05  2:32 ` Hongzhi.Song
  2018-06-05  2:33 ` [meta][PATCH 2/2 v4] Meta runtime cases: add testcases for kernel sample Hongzhi.Song
  2018-06-08  2:03 ` [meta][PATCH 0/2] Add kernel-sample tests for runtime test Hongzhi, Song
  2 siblings, 0 replies; 7+ messages in thread
From: Hongzhi.Song @ 2018-06-05  2:32 UTC (permalink / raw)
  To: openembedded-core

Enable kernel-sample features by default with the machine of qemu.

Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
---
 meta/recipes-kernel/linux/linux-yocto.inc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc
index 3bb872a..b7511e5 100644
--- a/meta/recipes-kernel/linux/linux-yocto.inc
+++ b/meta/recipes-kernel/linux/linux-yocto.inc
@@ -67,3 +67,6 @@ do_install_append(){
 addtask kernel_version_sanity_check after do_kernel_metadata do_kernel_checkout before do_compile
 addtask validate_branches before do_patch after do_kernel_checkout
 addtask kernel_configcheck after do_configure before do_compile
+
+# enable kernel-sample for oeqa/runtime/cases's ksample.py test
+KERNEL_FEATURES_append_qemuall=" features/kernel-sample/kernel-sample.scc"
-- 
2.8.1



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

* [meta][PATCH 2/2 v4] Meta runtime cases: add testcases for kernel sample
  2018-06-05  2:32 [meta][PATCH 0/2] Add kernel-sample tests for runtime test Hongzhi.Song
  2018-06-05  2:32 ` [meta][PATCH 1/2] meta runtime testcases: enable kernel-sample features for runtime tests Hongzhi.Song
@ 2018-06-05  2:33 ` Hongzhi.Song
  2018-06-28 12:55   ` Burton, Ross
  2018-06-08  2:03 ` [meta][PATCH 0/2] Add kernel-sample tests for runtime test Hongzhi, Song
  2 siblings, 1 reply; 7+ messages in thread
From: Hongzhi.Song @ 2018-06-05  2:33 UTC (permalink / raw)
  To: openembedded-core

We are going to let runtime test support kernel tests. Now we just add
kernel self-contained sample tests. And we plan to add overall kernel
tests in the future.

This patch is just add kernel samples test which contains about 13 tests
enabled by kernel-sample.scc. So it needs statement,
KERNEL_FEATURES_append += " features/kernel-sample/kernel-sample.scc" in
local.conf.

Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
---
 meta/lib/oeqa/runtime/cases/ksample.py | 213 +++++++++++++++++++++++++++++++++
 1 file changed, 213 insertions(+)
 create mode 100644 meta/lib/oeqa/runtime/cases/ksample.py

diff --git a/meta/lib/oeqa/runtime/cases/ksample.py b/meta/lib/oeqa/runtime/cases/ksample.py
new file mode 100644
index 0000000..74f06e0
--- /dev/null
+++ b/meta/lib/oeqa/runtime/cases/ksample.py
@@ -0,0 +1,213 @@
+import os
+import time
+
+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 KSample(OERuntimeTestCase):
+    def cmd_and_check(self, cmd='', match_string=''):
+        if not match_string:
+            # send cmd
+            status, output = self.target.run(cmd)
+            msg = '%s failed, %s' % (cmd, output)
+            self.assertEqual(status, 0, msg=msg)
+        else:
+            # check result
+            status, output = self.target.run(cmd)
+            result = ("%s" % match_string) in output
+            self.assertTrue(result)
+            self.assertEqual(status, 0, cmd)
+
+    def check_config(self, config_opt=''):
+        cmd = "zcat /proc/config.gz | grep %s" % config_opt
+        status, output = self.target.run(cmd)
+        result = ("%s=y" % config_opt) in output
+        if not result:
+            self.skipTest("%s is not set" % config_opt)
+
+    def check_module_exist(self, path='', module_name=''):
+        status, output = self.target.run("uname -r")
+        cmd = "ls " + "/lib/modules/" + output + "/kernel/samples/" + path + module_name
+        status, output = self.target.run(cmd)
+        if status != 0:
+            error_info = module_name + "doesn't exist"
+            self.skipTest(error_info)
+
+    def kfifo_func(self, name=''):
+        module_prename = name + "-example"
+        module_name = name + "-example.ko"
+        sysmbol_name = name + "_example"
+
+        # make sure if module exists
+        self.check_module_exist("kfifo/", module_name)
+        # modprobe
+        self.cmd_and_check("modprobe %s" % module_prename)
+        # lsmod
+        self.cmd_and_check("lsmod | grep %s | cut -d\' \' -f1" % sysmbol_name, sysmbol_name)
+        # check result
+        self.cmd_and_check("dmesg | grep \"test passed\" ", "test passed")
+        # rmmod
+        self.cmd_and_check("rmmod %s" %  module_prename)
+
+    def kprobe_func(self, name=''):
+        # check config
+        self.check_config("CONFIG_KPROBES")
+
+        module_prename = name + "_example"
+        module_name = name + "_example.ko"
+        sysmbol_name = module_prename
+
+        # make sure if module exists
+        self.check_module_exist("kprobes/", module_name)
+        # modprobe
+        self.cmd_and_check("modprobe %s" % module_prename)
+        # lsmod
+        self.cmd_and_check("lsmod | grep %s | cut -d\' \' -f1" % sysmbol_name, sysmbol_name)
+        # check result
+        self.cmd_and_check("dmesg | grep Planted | head -n10", "Planted")
+        # rmmod
+        self.cmd_and_check("rmmod %s" % module_prename)
+
+    def kobject_func(self, name=''):
+        module_prename = name + "_example"
+        module_name = name + "-example.ko"
+        sysmbol_name = module_prename
+
+        # make sure if module exists
+        self.check_module_exist("kobject/", module_name)
+        # modprobe
+        self.cmd_and_check("modprobe %s" % module_prename)
+        # lsmod
+        self.cmd_and_check("lsmod | grep %s | cut -d\' \' -f1" % sysmbol_name, sysmbol_name)
+        # check result
+        self.cmd_and_check("ls /sys/kernel/%s/" % sysmbol_name, "bar")
+        # rmmod
+        self.cmd_and_check("rmmod %s" % module_prename)
+
+class KSampleTest(KSample):
+    # kfifo
+    @OETestID(33)
+    @OETestDepends(['ssh.SSHTest.test_ssh'])
+    def test_kfifo_test(self):
+        index = ["dma", "bytestream", "inttype", "record"]
+        for i in index:
+            self.kfifo_func(i)
+
+    # kprobe
+    @OETestID(43)
+    @OETestDepends(['ssh.SSHTest.test_ssh'])
+    def test_kprobe_test(self):
+        index = ["kprobe", "kretprobe"]
+        for i in index:
+            self.kprobe_func(i)
+
+    # kobject
+    @OETestID(53)
+    @OETestDepends(['ssh.SSHTest.test_ssh'])
+    def test_kobject_test(self):
+        index = ["kobject", "kset"]
+        for i in index:
+            self.kobject_func(i)
+
+    #trace
+    @OETestID(63)
+    @OETestDepends(['ssh.SSHTest.test_ssh'])
+    def test_trace_events(self):
+        # check config
+        self.check_config("CONFIG_TRACING_SUPPORT")
+        # make sure if module exists
+        self.check_module_exist("trace_events/", "trace-events-sample.ko")
+        # modprobe
+        self.cmd_and_check("modprobe trace-events-sample")
+        # lsmod
+        self.cmd_and_check("lsmod | grep trace_events_sample | cut -d\' \' -f1", "trace_events_sample")
+        # check dir
+        self.cmd_and_check("ls /sys/kernel/debug/tracing/events/ | grep sample-trace", "sample-trace")
+        # enable trace
+        self.cmd_and_check("echo 1 > /sys/kernel/debug/tracing/events/sample-trace/enable")
+        self.cmd_and_check("cat /sys/kernel/debug/tracing/events/sample-trace/enable")
+        # check result
+        self.cmd_and_check("cat /sys/kernel/debug/tracing/trace | grep hello | head -n1 | cut -d\':\' -f2", " foo_bar")
+        # disable trace
+        self.cmd_and_check("echo 0 > /sys/kernel/debug/tracing/events/sample-trace/enable")
+        # clean up trace
+        self.cmd_and_check("echo > /sys/kernel/debug/tracing/trace")
+        # rmmod
+        self.cmd_and_check("rmmod trace-events-sample")
+
+    @OETestID(64)
+    @OETestDepends(['ssh.SSHTest.test_ssh'])
+    def test_trace_printk(self):
+        # check config
+        self.check_config("CONFIG_TRACING_SUPPORT")
+        # make sure if module exists
+        self.check_module_exist("trace_printk/", "trace-printk.ko")
+        # modprobe
+        self.cmd_and_check("modprobe trace-printk")
+        # lsmod
+        self.cmd_and_check("lsmod | grep trace_printk | cut -d\' \' -f1", "trace_printk")
+        # check result
+        self.cmd_and_check("cat /sys/kernel/debug/tracing/trace | grep trace_printk_irq_work | head -n1 | cut -d\':\' -f2", " trace_printk_irq_work")
+        # clean up trace
+        self.cmd_and_check("echo > /sys/kernel/debug/tracing/trace")
+        # rmmod
+        self.cmd_and_check("rmmod trace-printk")
+
+    # hw breakpoint
+    @OETestID(73)
+    @OETestDepends(['ssh.SSHTest.test_ssh'])
+    def test_hw_breakpoint_example(self):
+        # check config
+        self.check_config("CONFIG_KALLSYMS_ALL")
+        # make sure if module exists
+        self.check_module_exist("hw_breakpoint/", "data_breakpoint.ko")
+        # modprobe
+        self.cmd_and_check("modprobe data_breakpoint")
+        # lsmod
+        self.cmd_and_check("lsmod | grep data_breakpoint | cut -d\' \' -f1", "data_breakpoint")
+        # check result
+        self.cmd_and_check("cat /var/log/messages | grep sample_hbp_handler", "sample_hbp_handler")
+        # rmmod
+        self.cmd_and_check("rmmod data_breakpoint")
+
+    @OETestID(83)
+    @OETestDepends(['ssh.SSHTest.test_ssh'])
+    def test_configfs_sample(self):
+        # check config
+        status, ret = self.target.run('zcat /proc/config.gz | grep CONFIG_CONFIGFS_FS')
+        if not ["CONFIG_CONFIGFS_FS=m" in ret or "CONFIG_CONFIGFS_FS=y" in ret]:
+            self.skipTest("CONFIG error")
+        # make sure if module exists
+        self.check_module_exist("configfs/", "configfs_sample.ko")
+        # modprobe
+        self.cmd_and_check("modprobe configfs_sample")
+        # lsmod
+        self.cmd_and_check("lsmod | grep configfs_sample | cut -d\' \' -f1 | head -n1", "configfs_sample")
+
+        status = 1
+        count = 0
+        while status != 0:
+            time.sleep(1)
+            status, ret = self.target.run('cat /sys/kernel/config/01-childless/description')
+            count = count + 1
+            if count > 300:
+                self.skipTest("Time out for check dir")
+
+        # rmmod
+        self.cmd_and_check("rmmod configfs_sample")
+
+    @OETestID(93)
+    @OETestDepends(['ssh.SSHTest.test_ssh'])
+    def test_cn_test(self):
+        # make sure if module exists
+        self.check_module_exist("connector/", "cn_test.ko")
+        # modprobe
+        self.cmd_and_check("modprobe cn_test")
+        # lsmod
+        self.cmd_and_check("lsmod | grep cn_test | cut -d\' \' -f1", "cn_test")
+        # check result
+        self.cmd_and_check("cat /proc/net/connector | grep cn_test | head -n1 | cut -d\' \' -f1", "cn_test")
+        # rmmod
+        self.cmd_and_check("rmmod cn_test")
-- 
2.8.1



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

* Re: [meta][PATCH 0/2] Add kernel-sample tests for runtime test
  2018-06-05  2:32 [meta][PATCH 0/2] Add kernel-sample tests for runtime test Hongzhi.Song
  2018-06-05  2:32 ` [meta][PATCH 1/2] meta runtime testcases: enable kernel-sample features for runtime tests Hongzhi.Song
  2018-06-05  2:33 ` [meta][PATCH 2/2 v4] Meta runtime cases: add testcases for kernel sample Hongzhi.Song
@ 2018-06-08  2:03 ` Hongzhi, Song
  2018-06-19  5:54   ` Hongzhi, Song
  2 siblings, 1 reply; 7+ messages in thread
From: Hongzhi, Song @ 2018-06-08  2:03 UTC (permalink / raw)
  To: openembedded-core

ping...


A bug has been created, but the patch hasn't been adapted.

bug 12774 : https://bugzilla.yoctoproject.org/show_bug.cgi?id=12774


We plan to add more tests about kernel in the next time.


If there is no objection, could you adapt my patch?


-- Hongzhi


On 2018年06月05日 10:32, Hongzhi.Song wrote:
> V4:
>   * add support for qemu by default
>
> V3:
>   * remove duplicated code
>
> V2:
>   * use shared function to replace similar code
>
> Hongzhi.Song (2):
>    meta runtime testcases: enable kernel-sample features for runtime
>      tests
>    Meta runtime cases: add testcases for kernel sample
>
>   meta/lib/oeqa/runtime/cases/ksample.py    | 213 ++++++++++++++++++++++++++++++
>   meta/recipes-kernel/linux/linux-yocto.inc |   3 +
>   2 files changed, 216 insertions(+)
>   create mode 100644 meta/lib/oeqa/runtime/cases/ksample.py
>



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

* Re: [meta][PATCH 0/2] Add kernel-sample tests for runtime test
  2018-06-08  2:03 ` [meta][PATCH 0/2] Add kernel-sample tests for runtime test Hongzhi, Song
@ 2018-06-19  5:54   ` Hongzhi, Song
  2018-06-28  8:46     ` Hongzhi, Song
  0 siblings, 1 reply; 7+ messages in thread
From: Hongzhi, Song @ 2018-06-19  5:54 UTC (permalink / raw)
  To: openembedded-core

ping

--Hongzhi


On 2018年06月08日 10:03, Hongzhi, Song wrote:
> ping...
>
>
> A bug has been created, but the patch hasn't been adapted.
>
> bug 12774 : https://bugzilla.yoctoproject.org/show_bug.cgi?id=12774
>
>
> We plan to add more tests about kernel in the next time.
>
>
> If there is no objection, could you adapt my patch?
>
>
> -- Hongzhi
>
>
> On 2018年06月05日 10:32, Hongzhi.Song wrote:
>> V4:
>>   * add support for qemu by default
>>
>> V3:
>>   * remove duplicated code
>>
>> V2:
>>   * use shared function to replace similar code
>>
>> Hongzhi.Song (2):
>>    meta runtime testcases: enable kernel-sample features for runtime
>>      tests
>>    Meta runtime cases: add testcases for kernel sample
>>
>>   meta/lib/oeqa/runtime/cases/ksample.py    | 213 
>> ++++++++++++++++++++++++++++++
>>   meta/recipes-kernel/linux/linux-yocto.inc |   3 +
>>   2 files changed, 216 insertions(+)
>>   create mode 100644 meta/lib/oeqa/runtime/cases/ksample.py
>>
>



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

* Re: [meta][PATCH 0/2] Add kernel-sample tests for runtime test
  2018-06-19  5:54   ` Hongzhi, Song
@ 2018-06-28  8:46     ` Hongzhi, Song
  0 siblings, 0 replies; 7+ messages in thread
From: Hongzhi, Song @ 2018-06-28  8:46 UTC (permalink / raw)
  To: openembedded-core, Richard Purdie, Burton, Ross

ping

-- Hongzhi


On 2018年06月19日 13:54, Hongzhi, Song wrote:
> ping
>
> --Hongzhi
>
>
> On 2018年06月08日 10:03, Hongzhi, Song wrote:
>> ping...
>>
>>
>> A bug has been created, but the patch hasn't been adapted.
>>
>> bug 12774 : https://bugzilla.yoctoproject.org/show_bug.cgi?id=12774
>>
>>
>> We plan to add more tests about kernel in the next time.
>>
>>
>> If there is no objection, could you adapt my patch?
>>
>>
>> -- Hongzhi
>>
>>
>> On 2018年06月05日 10:32, Hongzhi.Song wrote:
>>> V4:
>>>   * add support for qemu by default
>>>
>>> V3:
>>>   * remove duplicated code
>>>
>>> V2:
>>>   * use shared function to replace similar code
>>>
>>> Hongzhi.Song (2):
>>>    meta runtime testcases: enable kernel-sample features for runtime
>>>      tests
>>>    Meta runtime cases: add testcases for kernel sample
>>>
>>>   meta/lib/oeqa/runtime/cases/ksample.py    | 213 
>>> ++++++++++++++++++++++++++++++
>>>   meta/recipes-kernel/linux/linux-yocto.inc |   3 +
>>>   2 files changed, 216 insertions(+)
>>>   create mode 100644 meta/lib/oeqa/runtime/cases/ksample.py
>>>
>>
>



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

* Re: [meta][PATCH 2/2 v4] Meta runtime cases: add testcases for kernel sample
  2018-06-05  2:33 ` [meta][PATCH 2/2 v4] Meta runtime cases: add testcases for kernel sample Hongzhi.Song
@ 2018-06-28 12:55   ` Burton, Ross
  0 siblings, 0 replies; 7+ messages in thread
From: Burton, Ross @ 2018-06-28 12:55 UTC (permalink / raw)
  To: Hongzhi.Song; +Cc: OE-core

On 5 June 2018 at 03:33, Hongzhi.Song <hongzhi.song@windriver.com> wrote:
> +    # kfifo
> +    @OETestID(33)
> +    @OETestDepends(['ssh.SSHTest.test_ssh'])
> +    def test_kfifo_test(self):

These test IDs don't exist in Testopia, which is what the test IDs are
referencing.  Presumably they're internal WR identifiers?  Please
remove them.

Ross


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

end of thread, other threads:[~2018-06-28 12:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-05  2:32 [meta][PATCH 0/2] Add kernel-sample tests for runtime test Hongzhi.Song
2018-06-05  2:32 ` [meta][PATCH 1/2] meta runtime testcases: enable kernel-sample features for runtime tests Hongzhi.Song
2018-06-05  2:33 ` [meta][PATCH 2/2 v4] Meta runtime cases: add testcases for kernel sample Hongzhi.Song
2018-06-28 12:55   ` Burton, Ross
2018-06-08  2:03 ` [meta][PATCH 0/2] Add kernel-sample tests for runtime test Hongzhi, Song
2018-06-19  5:54   ` Hongzhi, Song
2018-06-28  8:46     ` Hongzhi, Song

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.