From 5d0201db65d366d8905a28d103a2a9b511c22ca7 Mon Sep 17 00:00:00 2001 From: yangsheng Date: Wed, 4 Apr 2012 01:32:37 +0800 Subject: [PATCH] LU-1193 tests: test script fixes for incompatibility test script incompatibility when running server as 2.1 and client as 2.2 - conf-sanity: 61 - recovery-small: 100, 101, 102, 103, 104, 105 - santiy: 133a, 133d, 160, 225a, 225b Signed-off-by: yang sheng Change-Id: I97dea88cdebb2f229aa6d2852a653619145e59a2 Reviewed-on: http://review.whamcloud.com/2441 Reviewed-by: Yu Jian Reviewed-by: Wei Liu Tested-by: Hudson Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/tests/conf-sanity.sh | 3 +++ lustre/tests/liblustre.sh | 3 ++- lustre/tests/recovery-small.sh | 17 +++++++++++++++++ lustre/tests/replay-dual.sh | 2 +- lustre/tests/replay-single-lmv.sh | 2 +- lustre/tests/replay-single.sh | 2 +- lustre/tests/sanity.sh | 12 ++++++++++++ lustre/tests/test-framework.sh | 38 +++++++++++++------------------------- 8 files changed, 50 insertions(+), 29 deletions(-) diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index 313d16e..d937c31 100644 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -2768,6 +2768,9 @@ run_test 60 "check mkfs.lustre --mkfsoptions -E -O options setting" test_61() { # LU-80 local reformat=false + [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.1.53) ] || + { skip "Need MDS version at least 2.1.53"; return 0; } + if ! large_xattr_enabled; then reformat=true local mds_dev=$(mdsdevname ${SINGLEMDS//mds/}) diff --git a/lustre/tests/liblustre.sh b/lustre/tests/liblustre.sh index 0ad8c35..cb0c7b3 100644 --- a/lustre/tests/liblustre.sh +++ b/lustre/tests/liblustre.sh @@ -21,7 +21,8 @@ export LIBLUSTRE_TIMEOUT=`lctl get_param -n timeout` test_1() { if ! check_versions; then - skip "liblustre version mismatch: cli $CLIVER, mds $MDSVER, ost $OSTVER" + skip "liblustre version mismatch: cli $(lustre_version_code client), \ + mds $(lustre_version_code $SINGLEMDS), ost $(lustre_version_code ost1)" elif ! [ "$NETTYPE" = "tcp" -o "$NETTYPE" = "ptl" ]; then skip "NETTYPE=$NETTYPE unsupported for liblustre" elif [ ! -x $LIBLUSTRETESTS/sanity ]; then diff --git a/lustre/tests/recovery-small.sh b/lustre/tests/recovery-small.sh index 6e3bd76..7ef48f4 100755 --- a/lustre/tests/recovery-small.sh +++ b/lustre/tests/recovery-small.sh @@ -1205,6 +1205,9 @@ target_instance_match() test_100() { + do_facet mgs $LCTL list_param mgs.*.ir_timeout || + { skip "MGS without IR support"; return 0; } + # disable IR set_ir_status disabled @@ -1225,6 +1228,9 @@ run_test 100 "IR: Make sure normal recovery still works w/o IR" test_101() { + do_facet mgs $LCTL list_param mgs.*.ir_timeout || + { skip "MGS without IR support"; return 0; } + set_ir_status full local OST1_IMP=$(get_osc_import_name client ost1) @@ -1243,6 +1249,9 @@ run_test 101 "IR: Make sure IR works w/o normal recovery" test_102() { + do_facet mgs $LCTL list_param mgs.*.ir_timeout || + { skip "MGS without IR support"; return 0; } + local clients=${CLIENTS:-$HOSTNAME} local old_version local new_version @@ -1289,6 +1298,9 @@ run_test 102 "IR: New client gets updated nidtbl after MGS restart" test_103() { + do_facet mgs $LCTL list_param mgs.*.ir_timeout || + { skip "MGS without IR support"; return 0; } + combined_mgs_mds && skip "mgs and mds on the same target" && return 0 # workaround solution to generate config log on the mds @@ -1327,6 +1339,9 @@ run_test 103 "IR: MDS can start w/o MGS and get updated nidtbl later" test_104() { + do_facet mgs $LCTL list_param mgs.*.ir_timeout || + { skip "MGS without IR support"; return 0; } + set_ir_status full stop ost1 @@ -1342,6 +1357,8 @@ run_test 104 "IR: ost can disable IR voluntarily" test_105() { [ -z "$RCLIENTS" ] && skip "Needs multiple clients" && return 0 + do_facet mgs $LCTL list_param mgs.*.ir_timeout || + { skip "MGS without IR support"; return 0; } set_ir_status full diff --git a/lustre/tests/replay-dual.sh b/lustre/tests/replay-dual.sh index e2eaa1b..1d3f1c3 100755 --- a/lustre/tests/replay-dual.sh +++ b/lustre/tests/replay-dual.sh @@ -36,7 +36,7 @@ rm -rf $DIR/[df][0-9]* [ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE # LU-482 Avert LVM and VM inability to flush caches in pre .33 kernels -if [ $LINUX_VERSION_CODE -lt $(kernel_version 2 6 33) ]; then +if [ $LINUX_VERSION_CODE -lt $(version_code 2.6.33) ]; then sync do_facet $SINGLEMDS sync fi diff --git a/lustre/tests/replay-single-lmv.sh b/lustre/tests/replay-single-lmv.sh index 1a50085..d66190d 100755 --- a/lustre/tests/replay-single-lmv.sh +++ b/lustre/tests/replay-single-lmv.sh @@ -40,7 +40,7 @@ fi mkdir -p $DIR # LU-482 Avert LVM and VM inability to flush caches in pre .33 kernels -if [ $LINUX_VERSION_CODE -lt $(kernel_version 2 6 33) ]; then +if [ $LINUX_VERSION_CODE -lt $(version_code 2.6.33) ]; then sync do_facet $SINGLEMDS sync fi diff --git a/lustre/tests/replay-single.sh b/lustre/tests/replay-single.sh index 857a22a..1d09159 100755 --- a/lustre/tests/replay-single.sh +++ b/lustre/tests/replay-single.sh @@ -36,7 +36,7 @@ assert_DIR rm -rf $DIR/[df][0-9]* # LU-482 Avert LVM and VM inability to flush caches in pre .33 kernels -if [ $LINUX_VERSION_CODE -lt $(kernel_version 2 6 33) ]; then +if [ $LINUX_VERSION_CODE -lt $(version_code 2.6.33) ]; then sync do_facet $SINGLEMDS sync fi diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index f8d3123..258f439 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -7301,6 +7301,9 @@ check_stats() { test_133a() { remote_ost_nodsh && skip "remote OST with nodsh" && return remote_mds_nodsh && skip "remote MDS with nodsh" && return + + do_facet $SINGLEMDS $LCTL list_param mdt.*.rename_stats || + { skip "MDS doesn't support rename stats"; return; } local testdir=$DIR/${tdir}/stats_testdir mkdir -p $DIR/${tdir} @@ -7447,6 +7450,9 @@ get_rename_size() { test_133d() { remote_ost_nodsh && skip "remote OST with nodsh" && return remote_mds_nodsh && skip "remote MDS with nodsh" && return + do_facet $SINGLEMDS $LCTL list_param mdt.*.rename_stats || + { skip "MDS doesn't support rename stats"; return; } + local testdir1=$DIR/${tdir}/stats_testdir1 local testdir2=$DIR/${tdir}/stats_testdir2 @@ -7997,6 +8003,8 @@ changelog_chmask() test_160() { remote_mds_nodsh && skip "remote MDS with nodsh" && return + [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.0) ] || + { skip "Need MDS version at least 2.2.0"; return; } USER=$(do_facet $SINGLEMDS $LCTL --device $MDT0 changelog_register -n) echo "Registered as changelog user $USER" do_facet $SINGLEMDS $LCTL get_param -n mdd.$MDT0.changelog_users | \ @@ -9071,6 +9079,8 @@ test_225a () { if [ -z ${MDSSURVEY} ]; then skip_env "mds-survey not found" && return fi + [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.51) ] || + { skip "Need MDS version at least 2.2.51"; return; } local mds=$(facet_host $SINGLEMDS) local target=$(do_nodes $mds 'lctl dl' | \ @@ -9093,6 +9103,8 @@ test_225b () { if [ -z ${MDSSURVEY} ]; then skip_env "mds-survey not found" && return fi + [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.51) ] || + { skip "Need MDS version at least 2.2.51"; return; } if [ $($LCTL dl | grep -c osc) -eq 0 ]; then skip_env "Need to mount OST to test" && return diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 1ba7de5..c21e281 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -263,12 +263,15 @@ init_test_env() { rm -f $TMP/*active } -kernel_version() { +version_code() { + # split arguments like "1.8.6-wc3" into "1", "8", "6", "wc3" + eval set -- $(tr "[:punct:]" " " <<< $*) + echo -n $((($1 << 16) | ($2 << 8) | $3)) } export LINUX_VERSION=$(uname -r | sed -e "s/[-.]/ /3" -e "s/ .*//") -export LINUX_VERSION_CODE=$(kernel_version ${LINUX_VERSION//\./ }) +export LINUX_VERSION_CODE=$(version_code ${LINUX_VERSION//\./ }) case `uname -r` in 2.4.*) EXT=".o"; USE_QUOTA=no; [ ! "$CLIENTONLY" ] && FSTYPE=ext3;; @@ -2451,12 +2454,6 @@ osc_ensure_active () { } init_param_vars () { - if ! remote_ost_nodsh && ! remote_mds_nodsh; then - export MDSVER=$(do_facet $SINGLEMDS "lctl get_param version" | cut -d. -f1,2) - export OSTVER=$(do_facet ost1 "lctl get_param version" | cut -d. -f1,2) - export CLIVER=$(lctl get_param version | cut -d. -f 1,2) - fi - remote_mds_nodsh || TIMEOUT=$(do_facet $SINGLEMDS "lctl get_param -n timeout") @@ -3706,7 +3703,8 @@ is_patchless () } check_versions () { - [ "$MDSVER" = "$CLIVER" -a "$OSTVER" = "$CLIVER" ] + [ "$(lustre_version_code client)" = "$(lustre_version_code $SINGLEMDS)" -a \ + "$(lustre_version_code client)" = "$(lustre_version_code ost1)" ] } get_node_count() { @@ -3992,19 +3990,12 @@ get_clientosc_proc_path() { get_lustre_version () { local facet=${1:-"$SINGLEMDS"} - do_facet $facet $LCTL get_param -n version | awk '/^lustre:/ {print $2}' -} - -get_mds_version_major () { - local facet=${1:-"$SINGLEMDS"} - local version=$(get_lustre_version $facet) - echo $version | awk -F. '{print $1}' + do_facet $facet $LCTL get_param -n version | awk '/^lustre:/ {print $2}' } -get_mds_version_minor () { +lustre_version_code() { local facet=${1:-"$SINGLEMDS"} - local version=$(get_lustre_version $facet) - echo $version | awk -F. '{print $2}' + version_code $(get_lustre_version $1) } # If the 2.0 MDS was mounted on 1.8 device, then the OSC and LOV names @@ -4013,10 +4004,8 @@ get_mds_version_minor () { # mdt osc: fsname-OSTXXXX-osc mds_on_old_device() { local mds=${1:-"$SINGLEMDS"} - local major=$(get_mds_version_major $mds) - local minor=$(get_mds_version_minor $mds) - if [ $major -ge 2 ] || [ $major -eq 1 -a $minor -gt 8 ]; then + if [ $(lustre_version_code $mds) -gt $(version_code 1.9.0) ]; then do_facet $mds "lctl list_param osc.$FSNAME-OST*-osc \ > /dev/null 2>&1" && return 0 fi @@ -4031,9 +4020,8 @@ get_mdtosc_proc_path() { local mdt_label=$(convert_facet2label $mds_facet) local mdt_index=$(echo $mdt_label | sed -e 's/^.*-//') - local major=$(get_mds_version_major $mds_facet) - local minor=$(get_mds_version_minor $mds_facet) - if [ $major -le 1 -a $minor -le 8 ] || mds_on_old_device $mds_facet; then + if [ $(lustre_version_code $mds_facet) -le $(version_code 1.8.0) ] || + mds_on_old_device $mds_facet; then echo "${ost_label}-osc" else echo "${ost_label}-osc-${mdt_index}" -- 1.8.3.1