From 3b54a23aa0191b5a3ef9d469d49a49eda66cd703 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Sat, 13 Oct 2012 15:04:44 -0600 Subject: [PATCH] LU-1538 tests: fix test cases when OST is full 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 Change-Id: Ic4d5ec90d77b1a9302d3e8f128f292b3765611d7 Reviewed-on: http://review.whamcloud.com/4265 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Li Wei Reviewed-by: Yu Jian Reviewed-by: Oleg Drokin --- lustre/tests/multiop.c | 9 ++++++--- lustre/tests/sanity.sh | 2 +- lustre/tests/sanityn.sh | 24 ++++++++++++------------ 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/lustre/tests/multiop.c b/lustre/tests/multiop.c index 6c6a70a..9ed0522 100644 --- a/lustre/tests/multiop.c +++ b/lustre/tests/multiop.c @@ -369,9 +369,12 @@ int main(int argc, char **argv) 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); diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index cfe736d..7fddfe1 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -5301,7 +5301,7 @@ test_101d() { { 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 diff --git a/lustre/tests/sanityn.sh b/lustre/tests/sanityn.sh index 8ada48d..de35da9 100644 --- a/lustre/tests/sanityn.sh +++ b/lustre/tests/sanityn.sh @@ -946,23 +946,23 @@ test_36() { #bug 16417 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 - 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=$! - rm -f $DIR1/$tdir/file000 + rm -f $DIR1/$tdir/$tfile 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 -- 1.8.3.1