* [PATCH V2 0/1] linux-yocto: add ptest support
@ 2018-06-14 2:49 Dengke Du
2018-06-14 2:49 ` [PATCH V2 1/1] " Dengke Du
0 siblings, 1 reply; 5+ messages in thread
From: Dengke Du @ 2018-06-14 2:49 UTC (permalink / raw)
To: bruce.ashfield; +Cc: openembedded-core
Changed in V2:
Put the run-ptest script in linux-yocto directory.
The following changes since commit ddbd7b0cd6580ee26e11aa87e426fb294b372d64:
meta-yocto-bsp: bump to the latest linux stable kernel for edgerouter/beaglebone (2018-06-12 23:34:40 +0100)
are available in the git repository at:
https://github.com/DengkeDu/openembedded-core.git kernel-ptest
https://github.com//tree/kernel-ptest
Dengke Du (1):
linux-yocto: add ptest support
meta/recipes-kernel/linux/linux-yocto/run-ptest | 138 ++++++++++++++++++++++++
meta/recipes-kernel/linux/linux-yocto_4.14.bb | 9 ++
2 files changed, 147 insertions(+)
create mode 100644 meta/recipes-kernel/linux/linux-yocto/run-ptest
--
2.7.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH V2 1/1] linux-yocto: add ptest support
2018-06-14 2:49 [PATCH V2 0/1] linux-yocto: add ptest support Dengke Du
@ 2018-06-14 2:49 ` Dengke Du
2018-06-21 7:03 ` lei yang
2018-06-21 12:57 ` Bruce Ashfield
0 siblings, 2 replies; 5+ messages in thread
From: Dengke Du @ 2018-06-14 2:49 UTC (permalink / raw)
To: bruce.ashfield; +Cc: openembedded-core
Signed-off-by: Dengke Du <dengke.du@windriver.com>
---
meta/recipes-kernel/linux/linux-yocto/run-ptest | 138 ++++++++++++++++++++++++
meta/recipes-kernel/linux/linux-yocto_4.14.bb | 9 ++
2 files changed, 147 insertions(+)
create mode 100644 meta/recipes-kernel/linux/linux-yocto/run-ptest
diff --git a/meta/recipes-kernel/linux/linux-yocto/run-ptest b/meta/recipes-kernel/linux/linux-yocto/run-ptest
new file mode 100644
index 0000000..6db4d93
--- /dev/null
+++ b/meta/recipes-kernel/linux/linux-yocto/run-ptest
@@ -0,0 +1,138 @@
+#!/bin/bash
+depmod
+touch kernel.log
+
+#dma-example bytestream-example inttype-example record-example
+list1=("dma-example" "bytestream-example" "inttype-example" "record-example")
+for i in "${list1[@]}"
+do
+ dmesg -c
+ modprobe "$i"
+ result=""
+ IFS="-" read -ra array <<< "$i"
+ len=${#array[@]}
+ if [ $len -eq 2 ];then
+ result="${array[0]}_${array[1]}"
+ elif [ $len -eq 3 ];then
+ result="${array[0]}_${array[1]}_${array[2]}"
+ fi
+ lsmod | grep -q "$result"
+ if [ $? -eq 0 ];then
+ dmesg | grep "test passed"
+ if [ $? -eq 0 ];then
+ echo "$i: PASS" >> kernel.log
+ fi
+ else
+ echo "$i: FAILED" >> kernel.log
+ fi
+ rmmod "$i"
+done
+
+#kobject-example kset-example
+list2=("kobject-example" "kset-example")
+for i in "${list2[@]}"
+do
+ dmesg -c
+ modprobe "$i"
+ result=""
+ IFS="-" read -ra array <<< "$i"
+ len=${#array[@]}
+ if [ $len -eq 2 ];then
+ result="${array[0]}_${array[1]}"
+ elif [ $len -eq 3 ];then
+ result="${array[0]}_${array[1]}_${array[2]}"
+ fi
+ basedir="/sys/kernel/${result}"
+ echo "$basedir"
+ if [ -e ${basedir}/bar -a -e ${basedir}/baz -a -e ${basedir}/foo ];then
+ echo "$i: PASS" >> kernel.log
+ else
+ echo "$i: FAILED" >> kernel.log
+ fi
+ rmmod "$i"
+done
+
+#trace-events-sample
+list3="trace-events-sample"
+result=""
+IFS="-" read -ra array <<< "$list3"
+len=${#array[@]}
+if [ $len -eq 2 ];then
+ result="${array[0]}_${array[1]}"
+elif [ $len -eq 3 ];then
+ result="${array[0]}_${array[1]}_${array[2]}"
+fi
+modprobe "$list3"
+lsmod | grep "$result"
+if [ $? -eq 0 ];then
+ if [ -e "/sys/kernel/debug/tracing/events/sample-trace" ];then
+ echo 1 > /sys/kernel/debug/tracing/events/sample-trace/enable
+ sleep 5
+ ret=`cat /sys/kernel/debug/tracing/trace | grep hello | head -n1 | cut -d':' -f2`
+ if [ "$ret" = " foo_bar" ];then
+ echo "$list3: PASS" >> kernel.log
+ else
+ echo "$list3: FAILED-" >> kernel.log
+ fi
+ else
+ echo "$list3: FAILED--" >> kernel.log
+ fi
+else
+ echo "$list3: FAILED---" >> kernel.log
+fi
+rmmod "$list3"
+
+#trace-printk
+list4="trace-printk"
+modprobe "$list4"
+lsmod | grep "trace_printk"
+if [ $? -eq 0 ];then
+ ret=`cat /sys/kernel/debug/tracing/trace | grep trace_printk | head -n1 | cut -d':' -f2`
+ if [ "$ret" = " trace_printk_irq_work" ];then
+ echo "$list4: PASS" >> kernel.log
+ rmmod "$list4"
+ else
+ echo "$list4: FAILED" >> kernel.log
+ fi
+else
+ echo "$list4: FAILED" >> kernel.log
+fi
+rmmod "$list4"
+
+#kprobe_example
+list5="kprobe_example"
+dmesg -c
+modprobe "$list5"
+lsmod | grep "$list5"
+if [ $? -eq 0 ];then
+ dmesg | grep "_do_fork"
+ if [ $? -eq 0 ];then
+ echo "$list5: PASS" >> kernel.log
+ else
+ echo "$list5: FAILED" >> kernel.log
+ fi
+else
+ echo "$list5: FAILED" >> kernel.log
+fi
+rmmod "$list5"
+
+#kretprobe_example
+list6="kretprobe_example"
+dmesg -c
+modprobe "$list6"
+lsmod | grep "$list6"
+if [ $? -eq 0 ];then
+ dmesg | grep "_do_fork returned"
+ if [ $? -eq 0 ];then
+ echo "$list6: PASS" >> kernel.log
+ else
+ echo "$list6: FAILED" >> kernel.log
+ fi
+else
+ echo "$list6: FAILED" >> kernel.log
+fi
+rmmod "$list6"
+
+echo "#####result#####"
+cat kernel.log
+rm kernel.log
diff --git a/meta/recipes-kernel/linux/linux-yocto_4.14.bb b/meta/recipes-kernel/linux/linux-yocto_4.14.bb
index 0449213..9650ee2 100644
--- a/meta/recipes-kernel/linux/linux-yocto_4.14.bb
+++ b/meta/recipes-kernel/linux/linux-yocto_4.14.bb
@@ -45,3 +45,12 @@ KERNEL_FEATURES_append_qemuall=" cfg/virtio.scc"
KERNEL_FEATURES_append_qemux86=" cfg/sound.scc cfg/paravirt_kvm.scc"
KERNEL_FEATURES_append_qemux86-64=" cfg/sound.scc cfg/paravirt_kvm.scc"
KERNEL_FEATURES_append = " ${@bb.utils.contains("TUNE_FEATURES", "mx32", " cfg/x32.scc", "" ,d)}"
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+inherit ptest
+SRC_URI_append = " file://run-ptest \
+"
+do_install_ptest_append() {
+ install -D ${WORKDIR}/run-ptest ${D}${PTEST_PATH}/run-ptest
+}
+KERNEL_FEATURES_append = " ${@bb.utils.contains("DISTRO_FEATURES", "ptest", "features/kernel-sample/kernel-sample.scc", "", d)}"
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH V2 1/1] linux-yocto: add ptest support
2018-06-14 2:49 ` [PATCH V2 1/1] " Dengke Du
@ 2018-06-21 7:03 ` lei yang
2018-06-21 12:57 ` Bruce Ashfield
1 sibling, 0 replies; 5+ messages in thread
From: lei yang @ 2018-06-21 7:03 UTC (permalink / raw)
To: Dengke Du, bruce.ashfield; +Cc: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 6361 bytes --]
On 2018年06月14日 10:49, Dengke Du wrote:
> Signed-off-by: Dengke Du <dengke.du@windriver.com>
> ---
> meta/recipes-kernel/linux/linux-yocto/run-ptest | 138 ++++++++++++++++++++++++
> meta/recipes-kernel/linux/linux-yocto_4.14.bb | 9 ++
> 2 files changed, 147 insertions(+)
> create mode 100644 meta/recipes-kernel/linux/linux-yocto/run-ptest
>
> diff --git a/meta/recipes-kernel/linux/linux-yocto/run-ptest b/meta/recipes-kernel/linux/linux-yocto/run-ptest
> new file mode 100644
> index 0000000..6db4d93
> --- /dev/null
> +++ b/meta/recipes-kernel/linux/linux-yocto/run-ptest
> @@ -0,0 +1,138 @@
> +#!/bin/bash
> +depmod
> +touch kernel.log
> +
> +#dma-example bytestream-example inttype-example record-example
> +list1=("dma-example" "bytestream-example" "inttype-example" "record-example")
> +for i in "${list1[@]}"
> +do
> + dmesg -c
> + modprobe "$i"
> + result=""
> + IFS="-" read -ra array <<< "$i"
> + len=${#array[@]}
> + if [ $len -eq 2 ];then
> + result="${array[0]}_${array[1]}"
> + elif [ $len -eq 3 ];then
> + result="${array[0]}_${array[1]}_${array[2]}"
> + fi
if you want to substitute "-" to "_" here, using bash pattern
substitution will be much easier
# i="xx-yy-zz-ff"
# echo ${i//-/_}
xx_yy_zz_ff
> + lsmod | grep -q "$result"
> + if [ $? -eq 0 ];then
> + dmesg | grep "test passed"
> + if [ $? -eq 0 ];then
> + echo "$i: PASS" >> kernel.log
> + fi
> + else
> + echo "$i: FAILED" >> kernel.log
> + fi
most ptest (but not all) result format are following the same rule
"[PASS|SKIP|FAIL]" : testname
look at here
https://www.yoctoproject.org/docs/2.5/dev-manual/dev-manual.html#testing-packages-with-ptest
PS: unified test output matters for LAVA testparse patten.
> + rmmod "$i"
> +done
> +
> +#kobject-example kset-example
> +list2=("kobject-example" "kset-example")
> +for i in "${list2[@]}"
> +do
> + dmesg -c
> + modprobe "$i"
> + result=""
> + IFS="-" read -ra array <<< "$i"
> + len=${#array[@]}
> + if [ $len -eq 2 ];then
> + result="${array[0]}_${array[1]}"
> + elif [ $len -eq 3 ];then
> + result="${array[0]}_${array[1]}_${array[2]}"
> + fi
> + basedir="/sys/kernel/${result}"
> + echo "$basedir"
> + if [ -e ${basedir}/bar -a -e ${basedir}/baz -a -e ${basedir}/foo ];then
> + echo "$i: PASS" >> kernel.log
> + else
> + echo "$i: FAILED" >> kernel.log
> + fi
> + rmmod "$i"
> +done
> +
> +#trace-events-sample
> +list3="trace-events-sample"
> +result=""
> +IFS="-" read -ra array <<< "$list3"
> +len=${#array[@]}
> +if [ $len -eq 2 ];then
> + result="${array[0]}_${array[1]}"
> +elif [ $len -eq 3 ];then
> + result="${array[0]}_${array[1]}_${array[2]}"
> +fi
> +modprobe "$list3"
> +lsmod | grep "$result"
> +if [ $? -eq 0 ];then
> + if [ -e "/sys/kernel/debug/tracing/events/sample-trace" ];then
> + echo 1 > /sys/kernel/debug/tracing/events/sample-trace/enable
> + sleep 5
> + ret=`cat /sys/kernel/debug/tracing/trace | grep hello | head -n1 | cut -d':' -f2`
> + if [ "$ret" = " foo_bar" ];then
> + echo "$list3: PASS" >> kernel.log
> + else
> + echo "$list3: FAILED-" >> kernel.log
> + fi
> + else
> + echo "$list3: FAILED--" >> kernel.log
> + fi
> +else
> + echo "$list3: FAILED---" >> kernel.log
> +fi
> +rmmod "$list3"
> +
> +#trace-printk
> +list4="trace-printk"
> +modprobe "$list4"
> +lsmod | grep "trace_printk"
> +if [ $? -eq 0 ];then
> + ret=`cat /sys/kernel/debug/tracing/trace | grep trace_printk | head -n1 | cut -d':' -f2`
> + if [ "$ret" = " trace_printk_irq_work" ];then
> + echo "$list4: PASS" >> kernel.log
> + rmmod "$list4"
> + else
> + echo "$list4: FAILED" >> kernel.log
> + fi
> +else
> + echo "$list4: FAILED" >> kernel.log
> +fi
> +rmmod "$list4"
> +
> +#kprobe_example
> +list5="kprobe_example"
> +dmesg -c
> +modprobe "$list5"
> +lsmod | grep "$list5"
> +if [ $? -eq 0 ];then
> + dmesg | grep "_do_fork"
> + if [ $? -eq 0 ];then
> + echo "$list5: PASS" >> kernel.log
> + else
> + echo "$list5: FAILED" >> kernel.log
> + fi
> +else
> + echo "$list5: FAILED" >> kernel.log
> +fi
> +rmmod "$list5"
> +
> +#kretprobe_example
> +list6="kretprobe_example"
> +dmesg -c
> +modprobe "$list6"
> +lsmod | grep "$list6"
> +if [ $? -eq 0 ];then
> + dmesg | grep "_do_fork returned"
> + if [ $? -eq 0 ];then
> + echo "$list6: PASS" >> kernel.log
> + else
> + echo "$list6: FAILED" >> kernel.log
> + fi
> +else
> + echo "$list6: FAILED" >> kernel.log
> +fi
> +rmmod "$list6"
> +
> +echo "#####result#####"
> +cat kernel.log
> +rm kernel.log
> diff --git a/meta/recipes-kernel/linux/linux-yocto_4.14.bb b/meta/recipes-kernel/linux/linux-yocto_4.14.bb
> index 0449213..9650ee2 100644
> --- a/meta/recipes-kernel/linux/linux-yocto_4.14.bb
> +++ b/meta/recipes-kernel/linux/linux-yocto_4.14.bb
only enable ptest for linux-yocto_4.14 is not good.
we can still have one copy of run-ptest for different kernel version,
but we need to make it works for different kernel.
To be clear, for example, linux-yocto-4.14, you might have 10 test
cases, while in linux-yocto-4.15, you might have 12 test cases
so run-ptest might be like
a) run whatever test case we have, and the first thing is the check
whether the test case exists, for example, if directory
"samples/trace_printk" exists, run it, if not , do nothing or SKIP.
or
b) maintain a test list in different kernel recipes, run-pest would run
the test in the given list from the kernel recipe.
Lei
> @@ -45,3 +45,12 @@ KERNEL_FEATURES_append_qemuall=" cfg/virtio.scc"
> KERNEL_FEATURES_append_qemux86=" cfg/sound.scc cfg/paravirt_kvm.scc"
> KERNEL_FEATURES_append_qemux86-64=" cfg/sound.scc cfg/paravirt_kvm.scc"
> KERNEL_FEATURES_append = " ${@bb.utils.contains("TUNE_FEATURES", "mx32", " cfg/x32.scc", "" ,d)}"
> +
> +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
> +inherit ptest
> +SRC_URI_append = " file://run-ptest \
> +"
> +do_install_ptest_append() {
> + install -D ${WORKDIR}/run-ptest ${D}${PTEST_PATH}/run-ptest
> +}
> +KERNEL_FEATURES_append = " ${@bb.utils.contains("DISTRO_FEATURES", "ptest", "features/kernel-sample/kernel-sample.scc", "", d)}"
[-- Attachment #2: Type: text/html, Size: 7789 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2 1/1] linux-yocto: add ptest support
2018-06-14 2:49 ` [PATCH V2 1/1] " Dengke Du
2018-06-21 7:03 ` lei yang
@ 2018-06-21 12:57 ` Bruce Ashfield
2018-07-04 10:04 ` Dengke Du
1 sibling, 1 reply; 5+ messages in thread
From: Bruce Ashfield @ 2018-06-21 12:57 UTC (permalink / raw)
To: Dengke Du; +Cc: Patches and discussions about the oe-core layer
My general comment still stands from v1, That I don't see a lot of
value in creating a
whole set of custom tests and wrappers just for ptest use.
i.e. ltp already has a lot of these covered. kprobes, as do the
built-in self tests.
I want to be sure that we aren't creating custom wrappers that will
need to be maintained
for a long time.
Comments/documentation in the script don't exist, so it is difficult
to look at this and
understand what it is actually trying to test. A header block and
comments before each
test are required.
On Wed, Jun 13, 2018 at 10:49 PM, Dengke Du <dengke.du@windriver.com> wrote:
>
> Signed-off-by: Dengke Du <dengke.du@windriver.com>
> ---
> meta/recipes-kernel/linux/linux-yocto/run-ptest | 138 ++++++++++++++++++++++++
> meta/recipes-kernel/linux/linux-yocto_4.14.bb | 9 ++
> 2 files changed, 147 insertions(+)
> create mode 100644 meta/recipes-kernel/linux/linux-yocto/run-ptest
>
> diff --git a/meta/recipes-kernel/linux/linux-yocto/run-ptest b/meta/recipes-kernel/linux/linux-yocto/run-ptest
> new file mode 100644
> index 0000000..6db4d93
> --- /dev/null
> +++ b/meta/recipes-kernel/linux/linux-yocto/run-ptest
> @@ -0,0 +1,138 @@
> +#!/bin/bash
> +depmod
> +touch kernel.log
> +
> +#dma-example bytestream-example inttype-example record-example
> +list1=("dma-example" "bytestream-example" "inttype-example" "record-example")
> +for i in "${list1[@]}"
> +do
> + dmesg -c
> + modprobe "$i"
All of the modprobes really should be checking for failure, I realize you are
doing some lsmod calls and checking those, but that isn't always the case
in this script.
Cheers,
Bruce
> + result=""
> + IFS="-" read -ra array <<< "$i"
> + len=${#array[@]}
> + if [ $len -eq 2 ];then
> + result="${array[0]}_${array[1]}"
> + elif [ $len -eq 3 ];then
> + result="${array[0]}_${array[1]}_${array[2]}"
> + fi
> + lsmod | grep -q "$result"
> + if [ $? -eq 0 ];then
> + dmesg | grep "test passed"
> + if [ $? -eq 0 ];then
> + echo "$i: PASS" >> kernel.log
> + fi
> + else
> + echo "$i: FAILED" >> kernel.log
> + fi
> + rmmod "$i"
> +done
> +
> +#kobject-example kset-example
> +list2=("kobject-example" "kset-example")
> +for i in "${list2[@]}"
> +do
> + dmesg -c
> + modprobe "$i"
> + result=""
> + IFS="-" read -ra array <<< "$i"
> + len=${#array[@]}
> + if [ $len -eq 2 ];then
> + result="${array[0]}_${array[1]}"
> + elif [ $len -eq 3 ];then
> + result="${array[0]}_${array[1]}_${array[2]}"
> + fi
> + basedir="/sys/kernel/${result}"
> + echo "$basedir"
> + if [ -e ${basedir}/bar -a -e ${basedir}/baz -a -e ${basedir}/foo ];then
> + echo "$i: PASS" >> kernel.log
> + else
> + echo "$i: FAILED" >> kernel.log
> + fi
> + rmmod "$i"
> +done
> +
> +#trace-events-sample
> +list3="trace-events-sample"
> +result=""
> +IFS="-" read -ra array <<< "$list3"
> +len=${#array[@]}
> +if [ $len -eq 2 ];then
> + result="${array[0]}_${array[1]}"
> +elif [ $len -eq 3 ];then
> + result="${array[0]}_${array[1]}_${array[2]}"
> +fi
> +modprobe "$list3"
> +lsmod | grep "$result"
> +if [ $? -eq 0 ];then
> + if [ -e "/sys/kernel/debug/tracing/events/sample-trace" ];then
> + echo 1 > /sys/kernel/debug/tracing/events/sample-trace/enable
> + sleep 5
> + ret=`cat /sys/kernel/debug/tracing/trace | grep hello | head -n1 | cut -d':' -f2`
> + if [ "$ret" = " foo_bar" ];then
> + echo "$list3: PASS" >> kernel.log
> + else
> + echo "$list3: FAILED-" >> kernel.log
> + fi
> + else
> + echo "$list3: FAILED--" >> kernel.log
> + fi
> +else
> + echo "$list3: FAILED---" >> kernel.log
> +fi
> +rmmod "$list3"
> +
> +#trace-printk
> +list4="trace-printk"
> +modprobe "$list4"
> +lsmod | grep "trace_printk"
> +if [ $? -eq 0 ];then
> + ret=`cat /sys/kernel/debug/tracing/trace | grep trace_printk | head -n1 | cut -d':' -f2`
> + if [ "$ret" = " trace_printk_irq_work" ];then
> + echo "$list4: PASS" >> kernel.log
> + rmmod "$list4"
> + else
> + echo "$list4: FAILED" >> kernel.log
> + fi
> +else
> + echo "$list4: FAILED" >> kernel.log
> +fi
> +rmmod "$list4"
> +
> +#kprobe_example
> +list5="kprobe_example"
> +dmesg -c
> +modprobe "$list5"
> +lsmod | grep "$list5"
> +if [ $? -eq 0 ];then
> + dmesg | grep "_do_fork"
> + if [ $? -eq 0 ];then
> + echo "$list5: PASS" >> kernel.log
> + else
> + echo "$list5: FAILED" >> kernel.log
> + fi
> +else
> + echo "$list5: FAILED" >> kernel.log
> +fi
> +rmmod "$list5"
> +
> +#kretprobe_example
> +list6="kretprobe_example"
> +dmesg -c
> +modprobe "$list6"
> +lsmod | grep "$list6"
> +if [ $? -eq 0 ];then
> + dmesg | grep "_do_fork returned"
> + if [ $? -eq 0 ];then
> + echo "$list6: PASS" >> kernel.log
> + else
> + echo "$list6: FAILED" >> kernel.log
> + fi
> +else
> + echo "$list6: FAILED" >> kernel.log
> +fi
> +rmmod "$list6"
> +
> +echo "#####result#####"
> +cat kernel.log
> +rm kernel.log
> diff --git a/meta/recipes-kernel/linux/linux-yocto_4.14.bb b/meta/recipes-kernel/linux/linux-yocto_4.14.bb
> index 0449213..9650ee2 100644
> --- a/meta/recipes-kernel/linux/linux-yocto_4.14.bb
> +++ b/meta/recipes-kernel/linux/linux-yocto_4.14.bb
> @@ -45,3 +45,12 @@ KERNEL_FEATURES_append_qemuall=" cfg/virtio.scc"
> KERNEL_FEATURES_append_qemux86=" cfg/sound.scc cfg/paravirt_kvm.scc"
> KERNEL_FEATURES_append_qemux86-64=" cfg/sound.scc cfg/paravirt_kvm.scc"
> KERNEL_FEATURES_append = " ${@bb.utils.contains("TUNE_FEATURES", "mx32", " cfg/x32.scc", "" ,d)}"
> +
> +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
> +inherit ptest
> +SRC_URI_append = " file://run-ptest \
> +"
> +do_install_ptest_append() {
> + install -D ${WORKDIR}/run-ptest ${D}${PTEST_PATH}/run-ptest
> +}
> +KERNEL_FEATURES_append = " ${@bb.utils.contains("DISTRO_FEATURES", "ptest", "features/kernel-sample/kernel-sample.scc", "", d)}"
> --
> 2.7.4
>
--
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end"
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2 1/1] linux-yocto: add ptest support
2018-06-21 12:57 ` Bruce Ashfield
@ 2018-07-04 10:04 ` Dengke Du
0 siblings, 0 replies; 5+ messages in thread
From: Dengke Du @ 2018-07-04 10:04 UTC (permalink / raw)
To: Bruce Ashfield; +Cc: Patches and discussions about the oe-core layer
On 2018年06月21日 20:57, Bruce Ashfield wrote:
> My general comment still stands from v1, That I don't see a lot of
> value in creating a
> whole set of custom tests and wrappers just for ptest use.
>
> i.e. ltp already has a lot of these covered. kprobes, as do the
> built-in self tests.
The ltp doesn't contain kernel selftests, the kprobes in kernel samples
directory just contain some easy test for kprobes.
>
> I want to be sure that we aren't creating custom wrappers that will
> need to be maintained
> for a long time.
The maintaining work very little, because the kernel samples and kernel
selftest's change were not constantly changing very much.
>
> Comments/documentation in the script don't exist, so it is difficult
> to look at this and
> understand what it is actually trying to test. A header block and
> comments before each
> test are required.
Ok, I have complete it and will send V3.
>
> On Wed, Jun 13, 2018 at 10:49 PM, Dengke Du <dengke.du@windriver.com> wrote:
>> Signed-off-by: Dengke Du <dengke.du@windriver.com>
>> ---
>> meta/recipes-kernel/linux/linux-yocto/run-ptest | 138 ++++++++++++++++++++++++
>> meta/recipes-kernel/linux/linux-yocto_4.14.bb | 9 ++
>> 2 files changed, 147 insertions(+)
>> create mode 100644 meta/recipes-kernel/linux/linux-yocto/run-ptest
>>
>> diff --git a/meta/recipes-kernel/linux/linux-yocto/run-ptest b/meta/recipes-kernel/linux/linux-yocto/run-ptest
>> new file mode 100644
>> index 0000000..6db4d93
>> --- /dev/null
>> +++ b/meta/recipes-kernel/linux/linux-yocto/run-ptest
>> @@ -0,0 +1,138 @@
>> +#!/bin/bash
>> +depmod
>> +touch kernel.log
>> +
>> +#dma-example bytestream-example inttype-example record-example
>> +list1=("dma-example" "bytestream-example" "inttype-example" "record-example")
>> +for i in "${list1[@]}"
>> +do
>> + dmesg -c
>> + modprobe "$i"
> All of the modprobes really should be checking for failure, I realize you are
> doing some lsmod calls and checking those, but that isn't always the case
> in this script.
>
> Cheers,
>
> Bruce
>
>> + result=""
>> + IFS="-" read -ra array <<< "$i"
>> + len=${#array[@]}
>> + if [ $len -eq 2 ];then
>> + result="${array[0]}_${array[1]}"
>> + elif [ $len -eq 3 ];then
>> + result="${array[0]}_${array[1]}_${array[2]}"
>> + fi
>> + lsmod | grep -q "$result"
>> + if [ $? -eq 0 ];then
>> + dmesg | grep "test passed"
>> + if [ $? -eq 0 ];then
>> + echo "$i: PASS" >> kernel.log
>> + fi
>> + else
>> + echo "$i: FAILED" >> kernel.log
>> + fi
>> + rmmod "$i"
>> +done
>> +
>> +#kobject-example kset-example
>> +list2=("kobject-example" "kset-example")
>> +for i in "${list2[@]}"
>> +do
>> + dmesg -c
>> + modprobe "$i"
>> + result=""
>> + IFS="-" read -ra array <<< "$i"
>> + len=${#array[@]}
>> + if [ $len -eq 2 ];then
>> + result="${array[0]}_${array[1]}"
>> + elif [ $len -eq 3 ];then
>> + result="${array[0]}_${array[1]}_${array[2]}"
>> + fi
>> + basedir="/sys/kernel/${result}"
>> + echo "$basedir"
>> + if [ -e ${basedir}/bar -a -e ${basedir}/baz -a -e ${basedir}/foo ];then
>> + echo "$i: PASS" >> kernel.log
>> + else
>> + echo "$i: FAILED" >> kernel.log
>> + fi
>> + rmmod "$i"
>> +done
>> +
>> +#trace-events-sample
>> +list3="trace-events-sample"
>> +result=""
>> +IFS="-" read -ra array <<< "$list3"
>> +len=${#array[@]}
>> +if [ $len -eq 2 ];then
>> + result="${array[0]}_${array[1]}"
>> +elif [ $len -eq 3 ];then
>> + result="${array[0]}_${array[1]}_${array[2]}"
>> +fi
>> +modprobe "$list3"
>> +lsmod | grep "$result"
>> +if [ $? -eq 0 ];then
>> + if [ -e "/sys/kernel/debug/tracing/events/sample-trace" ];then
>> + echo 1 > /sys/kernel/debug/tracing/events/sample-trace/enable
>> + sleep 5
>> + ret=`cat /sys/kernel/debug/tracing/trace | grep hello | head -n1 | cut -d':' -f2`
>> + if [ "$ret" = " foo_bar" ];then
>> + echo "$list3: PASS" >> kernel.log
>> + else
>> + echo "$list3: FAILED-" >> kernel.log
>> + fi
>> + else
>> + echo "$list3: FAILED--" >> kernel.log
>> + fi
>> +else
>> + echo "$list3: FAILED---" >> kernel.log
>> +fi
>> +rmmod "$list3"
>> +
>> +#trace-printk
>> +list4="trace-printk"
>> +modprobe "$list4"
>> +lsmod | grep "trace_printk"
>> +if [ $? -eq 0 ];then
>> + ret=`cat /sys/kernel/debug/tracing/trace | grep trace_printk | head -n1 | cut -d':' -f2`
>> + if [ "$ret" = " trace_printk_irq_work" ];then
>> + echo "$list4: PASS" >> kernel.log
>> + rmmod "$list4"
>> + else
>> + echo "$list4: FAILED" >> kernel.log
>> + fi
>> +else
>> + echo "$list4: FAILED" >> kernel.log
>> +fi
>> +rmmod "$list4"
>> +
>> +#kprobe_example
>> +list5="kprobe_example"
>> +dmesg -c
>> +modprobe "$list5"
>> +lsmod | grep "$list5"
>> +if [ $? -eq 0 ];then
>> + dmesg | grep "_do_fork"
>> + if [ $? -eq 0 ];then
>> + echo "$list5: PASS" >> kernel.log
>> + else
>> + echo "$list5: FAILED" >> kernel.log
>> + fi
>> +else
>> + echo "$list5: FAILED" >> kernel.log
>> +fi
>> +rmmod "$list5"
>> +
>> +#kretprobe_example
>> +list6="kretprobe_example"
>> +dmesg -c
>> +modprobe "$list6"
>> +lsmod | grep "$list6"
>> +if [ $? -eq 0 ];then
>> + dmesg | grep "_do_fork returned"
>> + if [ $? -eq 0 ];then
>> + echo "$list6: PASS" >> kernel.log
>> + else
>> + echo "$list6: FAILED" >> kernel.log
>> + fi
>> +else
>> + echo "$list6: FAILED" >> kernel.log
>> +fi
>> +rmmod "$list6"
>> +
>> +echo "#####result#####"
>> +cat kernel.log
>> +rm kernel.log
>> diff --git a/meta/recipes-kernel/linux/linux-yocto_4.14.bb b/meta/recipes-kernel/linux/linux-yocto_4.14.bb
>> index 0449213..9650ee2 100644
>> --- a/meta/recipes-kernel/linux/linux-yocto_4.14.bb
>> +++ b/meta/recipes-kernel/linux/linux-yocto_4.14.bb
>> @@ -45,3 +45,12 @@ KERNEL_FEATURES_append_qemuall=" cfg/virtio.scc"
>> KERNEL_FEATURES_append_qemux86=" cfg/sound.scc cfg/paravirt_kvm.scc"
>> KERNEL_FEATURES_append_qemux86-64=" cfg/sound.scc cfg/paravirt_kvm.scc"
>> KERNEL_FEATURES_append = " ${@bb.utils.contains("TUNE_FEATURES", "mx32", " cfg/x32.scc", "" ,d)}"
>> +
>> +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
>> +inherit ptest
>> +SRC_URI_append = " file://run-ptest \
>> +"
>> +do_install_ptest_append() {
>> + install -D ${WORKDIR}/run-ptest ${D}${PTEST_PATH}/run-ptest
>> +}
>> +KERNEL_FEATURES_append = " ${@bb.utils.contains("DISTRO_FEATURES", "ptest", "features/kernel-sample/kernel-sample.scc", "", d)}"
>> --
>> 2.7.4
>>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-07-04 10:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-14 2:49 [PATCH V2 0/1] linux-yocto: add ptest support Dengke Du
2018-06-14 2:49 ` [PATCH V2 1/1] " Dengke Du
2018-06-21 7:03 ` lei yang
2018-06-21 12:57 ` Bruce Ashfield
2018-07-04 10:04 ` Dengke Du
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox