From 2fd108171fb08563d2e0ddc09789620d402b0014 Mon Sep 17 00:00:00 2001 From: Jinshan Xiong Date: Fri, 9 Sep 2016 18:50:37 -0700 Subject: [PATCH] LU-8600 tests: ignore error if running in vm for sanity 399 Performance in vm is not reliable. Define a new function error_not_in_vm() to handle this common case. Test-Parameters: trivial Signed-off-by: Jinshan Xiong Change-Id: I792ec7531564cbc2d80504e77fb3273b79c7ab96 Reviewed-on: http://review.whamcloud.com/22427 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/tests/sanity.sh | 28 ++++++---------------------- lustre/tests/test-framework.sh | 12 ++++++++++++ 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 7ed6ef9..14ce65f 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -13868,18 +13868,9 @@ test_247e() { run_test 247e "mount .. as fileset" test_248() { - local my_error=error - local fast_read_sav=$($LCTL get_param -n llite.*.fast_read 2>/dev/null) [ -z "$fast_read_sav" ] && skip "no fast read support" && return - # This test case is time sensitive and Maloo uses KVM to run autotest. - # Therefore the complete time of I/O task is unreliable and depends on - # the workload on the host machine when the task is running. - local virt=$(running_in_vm) - [ -n "$virt" ] && echo "running in VM '$virt', ignore error" && - my_error="error_ignore env=$virt" - # create a large file for fast read verification dd if=/dev/zero of=$DIR/$tfile bs=1M count=128 > /dev/null 2>&1 @@ -13901,7 +13892,8 @@ test_248() { # verify that fast read is 4 times faster for cache read [ $(bc <<< "4 * $t_fast < $t_slow") -eq 1 ] || - $my_error "fast read was not 4 times faster: $t_fast vs $t_slow" + error_not_in_vm "fast read was not 4 times faster: " \ + "$t_fast vs $t_slow" echo "Test 2: verify the performance between big and small read" $LCTL set_param -n llite.*.fast_read=1 @@ -13918,7 +13910,7 @@ test_248() { # verify that big IO is not 4 times faster than small IO [ $(bc <<< "4 * $t_1k >= $t_1m") -eq 1 ] || - $my_error "bigger IO is way too fast: $t_1k vs $t_1m" + error_not_in_vm "bigger IO is way too fast: $t_1k vs $t_1m" $LCTL set_param -n llite.*.fast_read=$fast_read_sav rm -f $DIR/$tfile @@ -14098,14 +14090,6 @@ ladvise_willread_performance() local repeat=10 local average_cache=0 local average_ladvise=0 - local my_error=error - - # This test case is time sensitive and Maloo uses KVM to run autotest. - # Therefore the complete time of I/O task is unreliable and depends on - # the workload on the host machine when the task is running. - local virt=$(running_in_vm) - [ -n "$virt" ] && echo "running in VM '$virt', ignore error" && - my_error="error_ignore env=$virt" for ((i = 1; i <= $repeat; i++)); do echo "Iter $i/$repeat: reading without willread hint" @@ -14156,8 +14140,8 @@ ladvise_willread_performance() local lowest_speedup=$((average_cache / 2)) [ $average_ladvise -gt $lowest_speedup ] || - $my_error "Speedup with willread is less than "\ - "$lowest_speedup%, got $average_ladvise%" + error_not_in_vm "Speedup with willread is less than " \ + "$lowest_speedup%, got $average_ladvise%" echo "Speedup with willread ladvise: $average_ladvise%" echo "Speedup with cache: $average_cache%" } @@ -15236,7 +15220,7 @@ test_399() { # LU-7655 for OST fake write echo "fake write $duration_fake vs. normal write $duration in seconds" [ $(bc <<< "$duration_fake < $duration") -eq 1 ] || - error "fake write is slower" + error_not_in_vm "fake write is slower" $LCTL set_param -n debug="$saved_debug" rm -f $DIR/$tfile diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 3221f47..8561897 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -4841,6 +4841,18 @@ error_and_remount() { exit 1 } +# Throw an error if it's not running in vm - usually for performance +# verification +error_not_in_vm() { + local virt=$(running_in_vm) + if [[ -n "$virt" ]]; then + echo "running in VM '$virt', ignore error" + error_ignore env=$virt "$@" + else + error "$@" + fi +} + skip_env () { $FAIL_ON_SKIP_ENV && error false $@ || skip $@ } -- 1.8.3.1