]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: do not use -e in ceph-disk.sh
authorLoic Dachary <ldachary@redhat.com>
Wed, 1 Apr 2015 12:38:29 +0000 (14:38 +0200)
committerLoic Dachary <ldachary@redhat.com>
Sun, 5 Apr 2015 23:58:18 +0000 (01:58 +0200)
The tests explicitly return on error when relevant. Add two error cases:

* detect when the allocation of a loop device fails.
* in the outer loop, return immediately if one of the test fails

Signed-off-by: Loic Dachary <ldachary@redhat.com>
src/test/ceph-disk.sh

index 1a99a755a138e28adc9594ff0b7ce89c0a4fdb76..8524098a9da18f26f78af62c2e56d7ff5bd0edcc 100755 (executable)
@@ -15,8 +15,6 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU Library Public License for more details.
 #
-set -e
-
 source test/test_btrfs_common.sh
 
 PS4='${FUNCNAME[0]}: $LINENO: '
@@ -450,17 +448,21 @@ function test_activate_dev() {
 
     loop_sanity_check || return 1
 
-    local disk=$(create_dev vdf.disk)
-    local journal=$(create_dev vdg.disk)
-    local newdisk=$(create_dev vdh.disk)
+    local dir=$(pwd)/$DIR
+    local disk
+    disk=$(create_dev $dir/vdf.disk) || return 1
+    local journal
+    journal=$(create_dev $dir/vdg.disk) || return 1
+    local newdisk
+    newdisk=$(create_dev $dir/vdh.disk) || return 1
 
     activate_dev_body $disk $journal $newdisk
     status=$?
     test $status != 0 && teardown
 
-    destroy_dev vdf.disk $disk
-    destroy_dev vdg.disk $journal
-    destroy_dev vdh.disk $newdisk
+    destroy_dev $dir/vdf.disk $disk
+    destroy_dev $dir/vdg.disk $journal
+    destroy_dev $dir/vdh.disk $newdisk
 
     return $status
 }
@@ -583,8 +585,10 @@ function run() {
     local actions=${@:-$default_actions}
     for action in $actions  ; do
         setup
-        $action || return 1
+        $action
+        status=$?
         teardown
+        test $status != 0 || return $status
     done
 }