Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Hangbin Liu <liuhangbin@gmail.com>
To: linux-kselftest@vger.kernel.org
Cc: Shuah Khan <shuahkh@osg.samsung.com>, Hangbin Liu <liuhangbin@gmail.com>
Subject: [RFC PATCH 0/1] selftests/run_kselftest.sh: make each test individually selectable
Date: Mon,  9 Mar 2020 18:12:55 +0800	[thread overview]
Message-ID: <20200309101256.868-1-liuhangbin@gmail.com> (raw)

Hi, this patch enhanced the run_kselftest.sh to make the tests individually
selectable. I'm not sure the if I could add the reuslt in the patch commit,
as the log is too long. So I just put the result to the cover-letter:

Note: I use `tr -s "/-" "_"` to cover the path name in tests to function name.
e.g. networking/timestamping -> networking_timestamping. I'm not sure if it's
legal in Makefile.

Before the patch:

]# ./kselftest_install.sh /tmp/kselftests
]# cat /tmp/kselftests/run_kselftest.sh
#!/bin/sh
BASE_DIR=$(realpath $(dirname $0))
cd $BASE_DIR
. ./kselftest/runner.sh
ROOT=$PWD
if [ "$1" = "--summary" ]; then
  logfile=$BASE_DIR/output.log
  cat /dev/null > $logfile
fi
[ -w /dev/kmsg ] && echo "kselftest: Running tests in android" >> /dev/kmsg
cd android
run_many        \
        "run.sh"
cd $ROOT
...<snip>...
[ -w /dev/kmsg ] && echo "kselftest: Running tests in zram" >> /dev/kmsg
cd zram
run_many        \
        "zram.sh"
cd $ROOT

After the patch:
]# ./kselftest_install.sh /tmp/kselftests
]# cat /tmp/kselftests/run_kselftest.sh
#!/bin/sh
BASE_DIR=$(realpath $(dirname $0))
. ./kselftest/runner.sh
TESTS="android ...<snip>... zram"

run_android()
{
        [ -w /dev/kmsg ] && echo "kselftest: Running tests in android" >> /dev/kmsg
        cd android
        run_many        \
                "run.sh"
        cd $ROOT
}

...<snip>...

run_zram()
{
        [ -w /dev/kmsg ] && echo "kselftest: Running tests in zram" >> /dev/kmsg
        cd zram
        run_many        \
                "zram.sh"
        cd $ROOT
}

usage()
{
        cat <<EOF
usage: ${0##*/} OPTS
        -s | --summary          Only print summary info and put detailed log in output.log
        -t | --tests            Test name you want to run specifically
        -h | --help             Show this usage info
EOF
}

while true; do
        case "$1" in
        -s | --summary ) logfile=$BASE_DIR/output.log; cat /dev/null > $logfile; shift ;;
        -t | --tests ) TESTS=$2; shift 2 ;;
        -h | --help ) usage; exit 0;;
        "" ) break;;
        * ) usage; exit 1;;
        esac
done

cd $BASE_DIR
ROOT=$PWD
for test in $TESTS; do
        run_$test
done


Hangbin Liu (1):
  selftests/run_kselftest.sh: make each test individually selectable

 tools/testing/selftests/Makefile | 48 +++++++++++++++++++++++++-------
 tools/testing/selftests/lib.mk   |  2 +-
 2 files changed, 39 insertions(+), 11 deletions(-)

-- 
2.19.2


             reply	other threads:[~2020-03-09 10:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-09 10:12 Hangbin Liu [this message]
2020-03-09 10:12 ` [RFC PATCH 1/1] selftests/run_kselftest.sh: make each test individually selectable Hangbin Liu
2020-03-13 19:42 ` [RFC PATCH 0/1] " shuah
2020-03-15  3:27   ` Hangbin Liu
2020-03-16  7:26 ` [RFC PATCHv2] " Hangbin Liu
2020-09-10  1:20   ` Hangbin Liu
2020-09-10 14:10     ` Shuah Khan
2020-09-11  8:30   ` [PATCHv3] " Hangbin Liu
2020-09-14  2:17     ` [PATCHv4 kselftest next] " Hangbin Liu

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=20200309101256.868-1-liuhangbin@gmail.com \
    --to=liuhangbin@gmail.com \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuahkh@osg.samsung.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox