]> git.donarmstrong.com Git - biopieces.git/commitdiff
fortified assert_no_diff_dir function
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Wed, 12 Oct 2011 14:20:55 +0000 (14:20 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Wed, 12 Oct 2011 14:20:55 +0000 (14:20 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@1545 74ccb610-7750-0410-82ae-013aeee3265d

bp_test/lib/test.sh

index 530c7a4dd1cae809e7f5bfaf1694649ebf8d00f6..68e3825ed62ff155e36dc75b635617058612b56a 100755 (executable)
@@ -64,8 +64,20 @@ function assert_no_diff_dir
     local src_dir=$1
     local dst_dir=$2
 
-    src_cksum=`find $src_dir -type f | xargs cat | cksum`
-    dst_cksum=`find $dst_dir -type f | xargs cat | cksum`
+    if [ ! -d $src_dir ]; then
+        echo_red "FAIL"
+        log "FAIL"
+        return
+    fi
+
+    if [ ! -d $dst_dir ]; then
+        echo_red "FAIL"
+        log "FAIL"
+        return
+    fi
+
+    local src_cksum=`find $src_dir -type f | xargs cat | cksum`
+    local dst_cksum=`find $dst_dir -type f | xargs cat | cksum`
 
     if [ "$src_cksum" == "$dst_cksum" ]; then
         echo_green "OK"