diff mbox

[kvm-unit-tests,v4,08/13] scripts/runtime: consolidate summary tags

Message ID 20160525174624.GI14795@potion (mailing list archive)
State New, archived
Headers show

Commit Message

Radim Krčmář May 25, 2016, 5:46 p.m. UTC
2016-05-17 14:22+0200, Paolo Bonzini:
> 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.

Great, thanks.  A fixup is below

---8<---
--
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 mbox

Patch

diff --git a/scripts/runtime.bash b/scripts/runtime.bash
index 39a9072ed103..2bbdb864c889 100644
--- a/scripts/runtime.bash
+++ b/scripts/runtime.bash
@@ -2,9 +2,9 @@ 
 : ${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"; }
+PASS=$'\e[32mPASS\e[0m'
+SKIP=$'\e[33mSKIP\e[0m'
+FAIL=$'\e[31mFAIL\e[0m'
 
 extract_summary()
 {
@@ -53,18 +53,18 @@  function run()
     fi
 
     if [ -n "$arch" ] && [ "$arch" != "$ARCH" ]; then
-        echo "`SKIP` $1 ($arch only)"
+        echo "$SKIP $1 ($arch only)"
         return 2
     fi
 
     eval $check || {
         echo "skipped $testname (\`$check\` returned $?)" | RUNTIME_log_stderr
-        echo "`SKIP` $testname (check failed)"
+        echo "$SKIP $testname (check failed)"
         return 77
     }
 
     last_line=$(premature_failure) && {
-        echo "`SKIP` $1 ($last_line)"
+        echo "$SKIP $1 ($last_line)"
         return 77
     }
 
@@ -80,13 +80,13 @@  function run()
     ret=$?
 
     if [ $ret -eq 0 ]; then
-        echo "`PASS` $1 $summary"
+        echo "$PASS $1 $summary"
     elif [ $ret -eq 77 ]; then
-        echo "`SKIP` $1 $summary"
+        echo "$SKIP $1 $summary"
     elif [ $ret -eq 124 ]; then
-        echo "`FAIL` $1 (timeout; duration=$timeout)"
+        echo "$FAIL $1 (timeout; duration=$timeout)"
     else
-        echo "`FAIL` $1 $summary"
+        echo "$FAIL $1 $summary"
     fi
 
     return $ret