Whamcloud - gitweb
LU-1538 tests: fix test cases when OST is full
authorAndreas Dilger <adilger@whamcloud.com>
Sat, 13 Oct 2012 21:04:44 +0000 (15:04 -0600)
committerOleg Drokin <green@whamcloud.com>
Thu, 18 Oct 2012 19:13:26 +0000 (15:13 -0400)
In sanity.sh test_101d() the test didn't check if "dd" failed to write
the full file size, and produced an confusing error about readahead
performance.

In sanityn.sh test_36() it also didn't check if "dd" failed to write
the full file size, and then multiop read was stuck in a loop of zero
length reads forever.  Fix both "dd" error checking, and multiop.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: Ic4d5ec90d77b1a9302d3e8f128f292b3765611d7
Reviewed-on: http://review.whamcloud.com/4265
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Li Wei <liwei@whamcloud.com>
Reviewed-by: Yu Jian <yujian@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/multiop.c
lustre/tests/sanity.sh
lustre/tests/sanityn.sh

index 6c6a70a..9ed0522 100644 (file)
@@ -369,9 +369,12 @@ int main(int argc, char **argv)
                                         perror("read");
                                         exit(save_errno);
                                 }
                                         perror("read");
                                         exit(save_errno);
                                 }
-                                if (rc < len)
-                                        fprintf(stderr, "short read: %u/%u\n",
-                                                rc, len);
+                               if (rc < len) {
+                                       fprintf(stderr, "short read: %u/%u\n",
+                                               rc, len);
+                                       if (rc == 0)
+                                               exit(ENODATA);
+                               }
                                 len -= rc;
                                 if (verbose >= 2)
                                         printf("%.*s\n", rc, buf_align);
                                 len -= rc;
                                 if (verbose >= 2)
                                         printf("%.*s\n", rc, buf_align);
index cfe736d..7fddfe1 100644 (file)
@@ -5301,7 +5301,7 @@ test_101d() {
         { skip "Need free space ${size}M, have $space" && return; }
 
     echo Creating ${size}M test file $file
         { skip "Need free space ${size}M, have $space" && return; }
 
     echo Creating ${size}M test file $file
-    dd if=/dev/zero of=$file bs=1M count=$size
+    dd if=/dev/zero of=$file bs=1M count=$size || error "dd failed"
     echo Cancel LRU locks on lustre client to flush the client cache
     cancel_lru_locks osc
 
     echo Cancel LRU locks on lustre client to flush the client cache
     cancel_lru_locks osc
 
index 8ada48d..de35da9 100644 (file)
@@ -946,23 +946,23 @@ test_36() { #bug 16417
 
        while [ $i -le 10 ]; do
                lctl mark "start test"
 
        while [ $i -le 10 ]; do
                lctl mark "start test"
-               local before=$($LFS df | awk '{if ($1 ~/^filesystem/) \
-                                              {print $5; exit} }')
-               dd if=/dev/zero of=$DIR1/$tdir/file000 bs=1M count=$SIZE
-               sync          # sync data from client's cache
-               sync_all_data # sync data from server's cache (delayed
-                             # allocation)
+               local before=$($LFS df | awk '{ if ($1 ~/^filesystem/) \
+                                             print $5; exit} }')
+               dd if=/dev/zero of=$DIR1/$tdir/$tfile bs=1M count=$SIZE ||
+                       error "dd $DIR1/$tdir/$tfile ${SIZE}MB failed"
+               sync          # sync data from client cache
+               sync_all_data # sync data from server cache (delayed allocation)
                sleep 1
                sleep 1
-               local after_dd=$($LFS df | awk '{if ($1 ~/^filesystem/) \
-                                                {print $5; exit} }')
-               multiop_bg_pause $DIR2/$tdir/file000 O_r${SIZE_B}c || return 3
+               local after_dd=$($LFS df | awk '{ if ($1 ~/^filesystem/) \
+                                               print $5; exit} }')
+               multiop_bg_pause $DIR2/$tdir/$tfile O_r${SIZE_B}c || return 3
                read_pid=$!
                read_pid=$!
-               rm -f $DIR1/$tdir/file000
+               rm -f $DIR1/$tdir/$tfile
                kill -USR1 $read_pid
                wait $read_pid
                wait_delete_completed
                kill -USR1 $read_pid
                wait $read_pid
                wait_delete_completed
-               local after=$($LFS df | awk '{if ($1 ~/^filesystem/) \
-                                             {print $5; exit} }')
+               local after=$($LFS df | awk '{ if ($1 ~/^filesystem/) \
+                                            print $5; exit} }')
                echo "*** cycle($i) *** before($before) after_dd($after_dd)" \
                        "after($after)"
                # this free space! not used
                echo "*** cycle($i) *** before($before) after_dd($after_dd)" \
                        "after($after)"
                # this free space! not used