Fix align test.
authorMilan Broz <gmazyland@gmail.com>
Fri, 16 Apr 2010 13:16:11 +0000 (13:16 +0000)
committerMilan Broz <gmazyland@gmail.com>
Fri, 16 Apr 2010 13:16:11 +0000 (13:16 +0000)
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@200 36d66b0a-2a48-0410-832c-cd162a569da5

tests/align_test

index cb3e78a..a6c1eaf 100755 (executable)
@@ -3,11 +3,17 @@
 CRYPTSETUP="../src/cryptsetup"
 DEV=""
 
+fail()
+{
+       [ -n "$1" ] && echo "$1"
+       exit 100
+}
+
 add_device() {
        modprobe scsi_debug $@
-       DEV=/dev/$(grep scsi_debug /sys/block/*/device/model | cut -f4 -d /)
        sleep 2
-       [ -b $DEV ] || exit 100
+       DEV=/dev/$(grep scsi_debug /sys/block/*/device/model | cut -f4 -d /)
+       [ -b $DEV ] || fail "Cannot find $DEV."
 }
 
 cleanup() {
@@ -32,7 +38,7 @@ format() # key_bits expected [forced]
        if [ $ALIGN -ne $2 ] ; then
                echo "FAIL"
                echo "Expected alignment differs: expected $2 != detected $ALIGN"
-               exit 100
+               fail
        fi
        echo "PASSED"
 }