testsuite: fixups and color
authorHarald Hoyer <harald@redhat.com>
Fri, 20 Jul 2012 09:20:12 +0000 (11:20 +0200)
committerHarald Hoyer <harald@redhat.com>
Fri, 20 Jul 2012 09:20:12 +0000 (11:20 +0200)
test/TEST-12-RAID-DEG/test.sh
test/TEST-30-ISCSI/test.sh
test/test-functions

index 05e5f8a..96c84f8 100755 (executable)
@@ -9,15 +9,15 @@ KVERSION=${KVERSION-$(uname -r)}
 
 client_run() {
     echo "CLIENT TEST START: $@"
-    cp --sparse=always $TESTDIR/disk2.img $TESTDIR/disk2.img.new
-    cp --sparse=always $TESTDIR/disk3.img $TESTDIR/disk3.img.new
+    cp --sparse=always --reflink=auto $TESTDIR/disk2.img $TESTDIR/disk2.img.new
+    cp --sparse=always --reflink=auto $TESTDIR/disk3.img $TESTDIR/disk3.img.new
 
     $testdir/run-qemu \
        -hda $TESTDIR/root.ext2 -m 256M -nographic \
        -hdc $TESTDIR/disk2.img.new \
        -hdd $TESTDIR/disk3.img.new \
        -net none -kernel /boot/vmlinuz-$KVERSION \
-       -append "$@ root=LABEL=root rw quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug  $DEBUGFAIL " \
+       -append "$* root=LABEL=root rw quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug  $DEBUGFAIL " \
        -initrd $TESTDIR/initramfs.testing
     if ! grep -m 1 -q dracut-root-block-success $TESTDIR/root.ext2; then
        echo "CLIENT TEST END: $@ [FAIL]"
index c5dba80..1b1924b 100755 (executable)
@@ -45,7 +45,7 @@ run_client() {
         -net nic,macaddr=52:54:00:12:34:00,model=e1000 \
         -net socket,connect=127.0.0.1:12330 \
         -kernel /boot/vmlinuz-$KVERSION \
-        -append "$@ rw quiet rd.retry=5 rd.debug rd.info  console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" \
+        -append "$* rw quiet rd.retry=5 rd.debug rd.info  console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" \
         -initrd $TESTDIR/initramfs.testing
     if ! grep -m 1 -q iscsi-OK $TESTDIR/client.img; then
        echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
index 968551f..13e23b2 100644 (file)
@@ -15,6 +15,16 @@ command -v test_check &>/dev/null || test_check() {
     :
 }
 
+# terminal sequence to set color to a 'success' color (currently: green)
+function SETCOLOR_SUCCESS() { echo -en '\033[0;32m'; }
+# terminal sequence to set color to a 'failure' color (currently: red)
+function SETCOLOR_FAILURE() { echo -en '\033[0;31m'; }
+# terminal sequence to set color to a 'warning' color (currently: yellow)
+function SETCOLOR_WARNING() { echo -en '\033[0;33m'; }
+# terminal sequence to reset to the default color.
+function SETCOLOR_NORMAL() { echo -en '\033[0;39m'; }
+
+
 while (($# > 0)); do
     case $1 in
         --run)
@@ -34,7 +44,9 @@ while (($# > 0)); do
         --all)
            echo -n "TEST: $TEST_DESCRIPTION ";
             if ! test_check 2&>test.log ; then
+                SETCOLOR_WARNING
                 echo "[SKIPPED]"
+                SETCOLOR_NORMAL
                exit 0;
             fi
             if [ "$V" != "1" ]; then
@@ -61,9 +73,13 @@ while (($# > 0)); do
             set +o pipefail
            if [ $ret -eq 0 ]; then
                rm test.log
+               SETCOLOR_SUCCESS
               echo "[OK]"
+               SETCOLOR_NORMAL
            else
+               SETCOLOR_FAILURE
               echo "[FAILED]"
+               SETCOLOR_NORMAL
               echo "see $(pwd)/test.log"
            fi
            exit $ret;;