[OE-core] [PATCH 1/1] linux-yocto: add ptest support
lei yang
lei.yang at windriver.com
Thu May 31 14:08:35 UTC 2018
hi dengke,
some of the kernel modules were rmmod-ed twice, some of them forget to
be rmmod-ed when it fails,
please take a look.
Lei
On 2018年05月31日 12:19, Bruce Ashfield wrote:
>
>
> On Wed, May 30, 2018 at 11:08 PM, Dengke Du <dengke.du at windriver.com
> <mailto:dengke.du at windriver.com>> wrote:
>
> Signed-off-by: Dengke Du <dengke.du at windriver.com
> <mailto:dengke.du at windriver.com>>
> ---
> meta/recipes-kernel/linux/files/run-ptest | 138
> ++++++++++++++++++++++++++
>
>
> Nothing else in linux-yocto uses "files", and this shouldn't either.
>
> We can't guarantee that these are version independent, so they need to
> be in a versioned
> kernel subdirectory.
>
> meta/recipes-kernel/linux/linux-yocto.inc | 8 ++
> meta/recipes-kernel/linux/linux-yocto_4.14.bb
> <http://linux-yocto_4.14.bb> | 2 +-
> 3 files changed, 147 insertions(+), 1 deletion(-)
> create mode 100644 meta/recipes-kernel/linux/files/run-ptest
>
> diff --git a/meta/recipes-kernel/linux/files/run-ptest
> b/meta/recipes-kernel/linux/files/run-ptest
> new file mode 100644
> index 0000000..a3d9e14
> --- /dev/null
> +++ b/meta/recipes-kernel/linux/files/run-ptest
> @@ -0,0 +1,138 @@
> +#!/bin/bash
>
>
> This script should have a license and proper header file.
>
> Also, if the ptests are mainly trace/sample related, name the script
> to indicate that.
>
> The kernel already has a significant number of selftests, which are
> likely better than
> these ptests. Is there any reason why they aren't being used instead ?
>
> +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
> + rmmod "$i"
> + else
> + echo "$i: FAILED" >> kernel.log
> + fi
> +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
> + rmmod "$i"
> + else
> + echo "$i: FAILED" >> kernel.log
> + fi
> +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.inc
> b/meta/recipes-kernel/linux/linux-yocto.inc
> index 95ec2a2..7e1773e 100644
> --- a/meta/recipes-kernel/linux/linux-yocto.inc
> +++ b/meta/recipes-kernel/linux/linux-yocto.inc
> @@ -67,3 +67,11 @@ 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
> +
> +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)}"
> diff --git a/meta/recipes-kernel/linux/linux-yocto_4.14.bb
> <http://linux-yocto_4.14.bb>
> b/meta/recipes-kernel/linux/linux-yocto_4.14.bb
> <http://linux-yocto_4.14.bb>
> index 16142f8..7002693 100644
> --- a/meta/recipes-kernel/linux/linux-yocto_4.14.bb
> <http://linux-yocto_4.14.bb>
> +++ b/meta/recipes-kernel/linux/linux-yocto_4.14.bb
> <http://linux-yocto_4.14.bb>
> @@ -19,7 +19,7 @@ SRCREV_machine_qemux86 ?=
> "74f6cd2b6976e37491779fcb1bc4966d3a61492c"
> SRCREV_machine_qemux86-64 ?=
> "74f6cd2b6976e37491779fcb1bc4966d3a61492c"
> SRCREV_machine_qemumips64 ?=
> "9863b327e770b42b8c18da3e0cfaf06e8f99ae97"
> SRCREV_machine ?= "74f6cd2b6976e37491779fcb1bc4966d3a61492c"
> -SRCREV_meta ?= "ea9330894eea727bd1655569b16f338976b72563"
> +SRCREV_meta ?= "53336e1b7d969f21d8214ec9ceeb48fba4f99372"
>
>
> Do not bump the SRCREV for meta in this series.
>
> If your feature depends on something in the meta branch (which it
> does), wait until I've sent my next series before sending this.
>
> Bruce
>
>
> SRC_URI =
> "git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=${KBRANCH}
> <http://git.yoctoproject.org/linux-yocto.git;name=machine;branch=$%7BKBRANCH%7D>;
> \
>
> git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.14;destsuffix=${KMETA}
> <http://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.14;destsuffix=$%7BKMETA%7D>"
> --
> 2.7.4
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core at lists.openembedded.org
> <mailto:Openembedded-core at lists.openembedded.org>
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
> <http://lists.openembedded.org/mailman/listinfo/openembedded-core>
>
>
>
>
> --
> "Thou shalt not follow the NULL pointer, for chaos and madness await
> thee at its end"
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20180531/0b4a7341/attachment-0002.html>
More information about the Openembedded-core
mailing list