Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [RFC PATCH 0/1] selftests/run_kselftest.sh: make each test individually selectable
@ 2020-03-09 10:12 Hangbin Liu
  2020-03-09 10:12 ` [RFC PATCH 1/1] " Hangbin Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Hangbin Liu @ 2020-03-09 10:12 UTC (permalink / raw)
  To: linux-kselftest; +Cc: Shuah Khan, Hangbin Liu

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


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

end of thread, other threads:[~2020-09-14  2:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-09 10:12 [RFC PATCH 0/1] selftests/run_kselftest.sh: make each test individually selectable Hangbin Liu
2020-03-09 10:12 ` [RFC PATCH 1/1] " 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox