X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2Fposix.sh;h=58ef6a3b797292404e9689e0b073e55bdbe90fb3;hb=d6a3e06cb0f0db57a2637d029b1ff3bfd1de3d7d;hp=396e93081a2df1f602a10f562219d0c125f38900;hpb=27ca018034b03a4b5ab71dce66f2863c5b50287b;p=fs%2Flustre-release.git diff --git a/lustre/tests/posix.sh b/lustre/tests/posix.sh index 396e930..58ef6a3 100755 --- a/lustre/tests/posix.sh +++ b/lustre/tests/posix.sh @@ -1,15 +1,15 @@ #!/bin/bash -#set -vx set -e -LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)} +ONLY=${ONLY:-"$*"} + +LUSTRE=${LUSTRE:-$(dirname $0)/..} . $LUSTRE/tests/test-framework.sh init_test_env $@ -. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh} init_logging +ALWAYS_EXCEPT="$POSIX_EXCEPT" build_test_filter -check_and_setup_lustre POSIX_DIR=${POSIX_DIR:-"$LUSTRE/tests/posix"} POSIX_SRC=${POSIX_SRC:-"/usr/src/posix"} @@ -18,6 +18,17 @@ BASELINE_FS=${BASELINE_FS:-"ext4"} # SLES does not support read-write access to an ext4 file system by default [[ -e /etc/SuSE-release ]] && BASELINE_FS=ext3 +if [[ "$mds1_FSTYPE" = zfs ]]; then + BASELINE_FS=zfs + ! which $ZFS $ZPOOL >/dev/null 2>&1 && + skip_env "need $ZFS and $ZPOOL commands" + + POSIX_ZPOOL=$FSNAME-posix + POSIX_ZFS=$POSIX_ZPOOL/${POSIX_ZPOOL##$FSNAME-} +fi + +check_and_setup_lustre + cleanup_loop_dev() { local mnt=$1 local dev=$2 @@ -34,6 +45,8 @@ cleanup_loop_dev() { losetup -d $dev && rm -rf $mnt rm -f $file fi + + [[ $BASELINE_FS != zfs ]] || destroy_zpool client $POSIX_ZPOOL } setup_loop_dev() { @@ -49,7 +62,13 @@ setup_loop_dev() { echo "can't set up $dev for $file" return $rc fi - if ! eval mkfs.$BASELINE_FS $dev; then + + if [[ $BASELINE_FS = zfs ]]; then + create_zpool client $POSIX_ZPOOL $dev || return ${PIPESTATUS[0]} + create_zfs client $POSIX_ZFS || return ${PIPESTATUS[0]} + dev=$POSIX_ZFS + + elif ! eval mkfs.$BASELINE_FS $dev; then rc=$? echo "mkfs.$BASELINE_FS on $dev failed" return $rc @@ -72,48 +91,52 @@ test_1() { local loopdev local rc=0 - # We start at loop1 because posix build uses loop0 - [ -b /dev/loop/1 ] && loopbase=/dev/loop/ - [ -b /dev/loop1 ] && loopbase=/dev/loop - [ -z "$loopbase" ] && error "/dev/loop/1 and /dev/loop1 gone?" + # We start at loop1 because posix build uses loop0 + [ -b /dev/loop/1 ] && loopbase=/dev/loop/ + [ -b /dev/loop1 ] && loopbase=/dev/loop + if [ -z "$loopbase" ]; then + # there is no /dev/loop by default on EL7, LU-6707. + load_module loop max_loop=8 || error "load loop module failed" + loopbase=/dev/loop + fi - for i in `seq 1 7`; do - losetup $loopbase$i > /dev/null 2>&1 && continue || true - loopdev=$loopbase$i - break - done + for i in $(seq 1 7); do + losetup $loopbase$i > /dev/null 2>&1 && continue || true + loopdev=$loopbase$i + break + done - [ -z "$loopdev" ] && error "Can not find loop device" + [ -z "$loopdev" ] && error "Can not find loop device" - if ! setup_loop_dev $mntpnt $loopdev $tfile; then - cleanup_loop_dev "$mntpnt" "$loopdev" "$tfile" - error "Setup loop device failed" - fi + if ! setup_loop_dev $mntpnt $loopdev $tfile; then + cleanup_loop_dev "$mntpnt" "$loopdev" "$tfile" + error "Setup loop device failed" + fi - # copy the source over to ext mount point - if ! cp -af ${POSIX_SRC}/*.* $mntpnt; then - cleanup_loop_dev "$mntpnt" "$loopdev" "$tfile" - error "Copy POSIX test suite failed" - fi - export POSIX_SRC=$mntpnt - . $POSIX_DIR/posix.cfg - - setup_posix_users $allnodes - if ! setup_posix; then - delete_posix_users $allnodes - cleanup_loop_dev "$POSIX_SRC" - cleanup_loop_dev "$mntpnt" "$loopdev" "$tfile" - error "Setup POSIX test suite failed" - fi + # copy the source over to ext mount point + if ! cp -af ${POSIX_SRC}/*.* $mntpnt; then + cleanup_loop_dev "$mntpnt" "$loopdev" "$tfile" + error "Copy POSIX test suite failed" + fi + export POSIX_SRC=$mntpnt + . $POSIX_DIR/posix.cfg + + setup_posix_users $allnodes + if ! setup_posix; then + delete_posix_users $allnodes + cleanup_loop_dev "$POSIX_SRC" + cleanup_loop_dev "$mntpnt" "$loopdev" "$tfile" + error "Setup POSIX test suite failed" + fi - log "Run POSIX test against lustre filesystem" - run_posix $MOUNT compare || \ - error_noexit "Run POSIX testsuite on $MOUNT failed" + log "Run POSIX test against lustre filesystem" + run_posix $MOUNT $MGSNID $FSNAME compare || + error_noexit "Run POSIX testsuite on $MOUNT failed" - [[ -d "$MOUNT/TESTROOT" ]] && rm -fr $MOUNT/TESTROOT - delete_posix_users $allnodes - cleanup_loop_dev "$POSIX_SRC" - cleanup_loop_dev "$mntpnt" "$loopdev" "$tfile" + [[ -d "$MOUNT/TESTROOT" ]] && rm -fr $MOUNT/TESTROOT + delete_posix_users $allnodes + cleanup_loop_dev "$POSIX_SRC" + cleanup_loop_dev "$mntpnt" "$loopdev" "$tfile" } run_test 1 "install, build, run posix on $BASELINE_FS and lustre, then compare"