Message ID | 1462983171-4208-9-git-send-email-rkrcmar@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 11/05/2016 18:12, Radim Kr?má? wrote: > Turn skip into yellow SKIP and add reusable definitions of all tags. > > Reviewed-by: Andrew Jones <drjones@redhat.com> > Signed-off-by: Radim Kr?má? <rkrcmar@redhat.com> > --- > scripts/runtime.bash | 16 ++++++++++------ > 1 file changed, 10 insertions(+), 6 deletions(-) > > diff --git a/scripts/runtime.bash b/scripts/runtime.bash > index ed073721216c..8d374103a71c 100644 > --- a/scripts/runtime.bash > +++ b/scripts/runtime.bash > @@ -2,6 +2,10 @@ > : ${MAX_SMP:=$(getconf _NPROCESSORS_CONF)} > : ${TIMEOUT:=90s} > > +PASS() { echo -ne "\e[32mPASS\e[0m"; } > +SKIP() { echo -ne "\e[33mSKIP\e[0m"; } > +FAIL() { echo -ne "\e[31mFAIL\e[0m"; } If you use for example $'\e[32mPASS\e[0m', then you can use variables instead of functions. > + > function run() > { > local testname="$1" > @@ -23,7 +27,7 @@ function run() > fi > > if [ -n "$arch" ] && [ "$arch" != "$ARCH" ]; then > - echo "skip $1 ($arch only)" > + echo "`SKIP` $1 ($arch only)" > return 2 > fi > > @@ -34,7 +38,7 @@ function run() > path=${check_param%%=*} > value=${check_param#*=} > if [ "$path" ] && [ "$(cat $path)" != "$value" ]; then > - echo "skip $1 ($path not equal to $value)" > + echo "`SKIP` $1 ($path not equal to $value)" > return 2 > fi > done > @@ -50,13 +54,13 @@ function run() > ret=$? > > if [ $ret -eq 0 ]; then > - echo -e "\e[32mPASS\e[0m $1" > + echo "`PASS` $1" > elif [ $ret -eq 77 ]; then > - echo -e "\e[33mSKIP\e[0m $1" > + echo "`SKIP` $1" > elif [ $ret -eq 124 ]; then > - echo -e "\e[31mFAIL\e[0m $1 (timeout; duration=$timeout)" > + echo "`FAIL` $1 (timeout; duration=$timeout)" > else > - echo -e "\e[31mFAIL\e[0m $1" > + echo "`FAIL` $1" > fi > > return $ret > -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/scripts/runtime.bash b/scripts/runtime.bash index ed073721216c..8d374103a71c 100644 --- a/scripts/runtime.bash +++ b/scripts/runtime.bash @@ -2,6 +2,10 @@ : ${MAX_SMP:=$(getconf _NPROCESSORS_CONF)} : ${TIMEOUT:=90s} +PASS() { echo -ne "\e[32mPASS\e[0m"; } +SKIP() { echo -ne "\e[33mSKIP\e[0m"; } +FAIL() { echo -ne "\e[31mFAIL\e[0m"; } + function run() { local testname="$1" @@ -23,7 +27,7 @@ function run() fi if [ -n "$arch" ] && [ "$arch" != "$ARCH" ]; then - echo "skip $1 ($arch only)" + echo "`SKIP` $1 ($arch only)" return 2 fi @@ -34,7 +38,7 @@ function run() path=${check_param%%=*} value=${check_param#*=} if [ "$path" ] && [ "$(cat $path)" != "$value" ]; then - echo "skip $1 ($path not equal to $value)" + echo "`SKIP` $1 ($path not equal to $value)" return 2 fi done @@ -50,13 +54,13 @@ function run() ret=$? if [ $ret -eq 0 ]; then - echo -e "\e[32mPASS\e[0m $1" + echo "`PASS` $1" elif [ $ret -eq 77 ]; then - echo -e "\e[33mSKIP\e[0m $1" + echo "`SKIP` $1" elif [ $ret -eq 124 ]; then - echo -e "\e[31mFAIL\e[0m $1 (timeout; duration=$timeout)" + echo "`FAIL` $1 (timeout; duration=$timeout)" else - echo -e "\e[31mFAIL\e[0m $1" + echo "`FAIL` $1" fi return $ret