summaryrefslogtreecommitdiff
path: root/common/scripts/kselftest-runner.sh
blob: f1526ac092e376473da20a01f851ca213e70d7de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

TEST_NAME=$1
COMMAND=$(basename $2)
DIR=$(dirname $2)
LOG="result.log";

cd ${DIR}
chmod a+x ${COMMAND}
(./${COMMAND} 2>&1 || echo "${TEST_NAME}: [FAIL]") | tee ${LOG}
if [ -n "`grep \"skip\" ${LOG}`" ]; then
    echo "${TEST_NAME}: [SKIP]";
elif [ -z "`grep \"SKIP\|FAIL\" ${LOG}`" ]; then
    echo "${TEST_NAME}: [PASS]"
fi

while read l;
do
    [ -n "`echo $l|grep 'running'`" ] && test="`echo $l|sed 's/running //'`"
    [ -n "`echo $l|grep \"\[PASS\|FAIL\|SKIP\"`" ] && result=$l
    [ "${test}" -a "${result}" ] && echo "${test}: ${result}" && unset test && unset result
done < ${LOG}