All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bruce Ashfield <bruce.ashfield@gmail.com>
To: Dengke Du <dengke.du@windriver.com>
Cc: Patches and discussions about the oe-core layer
	<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH 1/1] linux-yocto: add ptest support
Date: Thu, 31 May 2018 00:19:15 -0400	[thread overview]
Message-ID: <CADkTA4MU3Po893UfDcTeusYA0kkJdMHFHPWx3Z3RdMJS5gj8Xg@mail.gmail.com> (raw)
In-Reply-To: <59e700bb0582088cba026b990ed423ab0d1e2ebe.1527735211.git.dengke.du@windriver.com>

[-- Attachment #1: Type: text/plain, Size: 7183 bytes --]

On Wed, May 30, 2018 at 11:08 PM, Dengke Du <dengke.du@windriver.com> wrote:

> Signed-off-by: Dengke Du <dengke.du@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 |   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
> b/meta/recipes-kernel/linux/linux-yocto_4.14.bb
> index 16142f8..7002693 100644
> --- a/meta/recipes-kernel/linux/linux-yocto_4.14.bb
> +++ b/meta/recipes-kernel/linux/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}; \
>             git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;
> name=meta;branch=yocto-4.14;destsuffix=${KMETA}"
> --
> 2.7.4
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>



-- 
"Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end"

[-- Attachment #2: Type: text/html, Size: 10878 bytes --]

  reply	other threads:[~2018-05-31  4:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-31  3:08 [PATCH 0/1] linux-yocto: add ptest support Dengke Du
2018-05-31  3:08 ` [PATCH 1/1] " Dengke Du
2018-05-31  4:19   ` Bruce Ashfield [this message]
2018-05-31 14:08     ` lei yang
2018-06-01  7:55       ` Dengke Du
2018-06-01  7:52     ` Dengke Du
2018-06-03 16:08       ` Richard Purdie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADkTA4MU3Po893UfDcTeusYA0kkJdMHFHPWx3Z3RdMJS5gj8Xg@mail.gmail.com \
    --to=bruce.ashfield@gmail.com \
    --cc=dengke.du@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.