7 # bug number for skipped test:
8 ALWAYS_EXCEPT="$POSIX_EXCEPT"
9 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
11 [ "$ALWAYS_EXCEPT$EXCEPT" ] &&
12 echo "Skipping tests: $ALWAYS_EXCEPT $EXCEPT"
14 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
15 . $LUSTRE/tests/test-framework.sh
17 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
20 POSIX_DIR=${POSIX_DIR:-"$LUSTRE/tests/posix"}
21 POSIX_SRC=${POSIX_SRC:-"/usr/src/posix"}
22 BASELINE_FS=${BASELINE_FS:-"ext4"}
24 # SLES does not support read-write access to an ext4 file system by default
25 [[ -e /etc/SuSE-release ]] && BASELINE_FS=ext3
27 if [[ $(facet_fstype $SINGLEMDS) = zfs ]]; then
29 ! which $ZFS $ZPOOL >/dev/null 2>&1 &&
30 skip_env "need $ZFS and $ZPOOL commands" && exit 0
32 POSIX_ZPOOL=$FSNAME-posix
33 POSIX_ZFS=$POSIX_ZPOOL/${POSIX_ZPOOL##$FSNAME-}
36 check_and_setup_lustre
44 # if we only have 1 arg, we will search for dev
46 dev=$(losetup -a | grep "$mnt" | cut -d: -f1)
47 [[ -n $dev ]] && losetup -d $dev
48 else # we need all args
49 [[ -z $mnt ]] || [[ -z $dev ]] || [[ -z $file ]] &&
50 error "Can't cleanup loop device"
52 losetup -d $dev && rm -rf $mnt
56 [[ $BASELINE_FS != zfs ]] || destroy_zpool client $POSIX_ZPOOL
65 echo "Make a loop file system with $file on $dev"
66 dd if=/dev/zero of=$file bs=1024k count=500 > /dev/null
67 if ! losetup $dev $file; then
69 echo "can't set up $dev for $file"
73 if [[ $BASELINE_FS = zfs ]]; then
74 create_zpool client $POSIX_ZPOOL $dev || return ${PIPESTATUS[0]}
75 create_zfs client $POSIX_ZFS || return ${PIPESTATUS[0]}
78 elif ! eval mkfs.$BASELINE_FS $dev; then
80 echo "mkfs.$BASELINE_FS on $dev failed"
84 if ! mount -t $BASELINE_FS $dev $mnt; then
86 echo "mount $BASELINE_FS failed"
94 local allnodes="$(comma_list $(nodes_list))"
95 local tfile="$TMP/$BASELINE_FS-file"
96 local mntpnt=$POSIX_SRC/$BASELINE_FS
101 # We start at loop1 because posix build uses loop0
102 [ -b /dev/loop/1 ] && loopbase=/dev/loop/
103 [ -b /dev/loop1 ] && loopbase=/dev/loop
104 if [ -z "$loopbase" ]; then
105 # there is no /dev/loop by default on EL7, LU-6707.
106 load_module loop max_loop=8 || error "load loop module failed"
110 for i in $(seq 1 7); do
111 losetup $loopbase$i > /dev/null 2>&1 && continue || true
116 [ -z "$loopdev" ] && error "Can not find loop device"
118 if ! setup_loop_dev $mntpnt $loopdev $tfile; then
119 cleanup_loop_dev "$mntpnt" "$loopdev" "$tfile"
120 error "Setup loop device failed"
123 # copy the source over to ext mount point
124 if ! cp -af ${POSIX_SRC}/*.* $mntpnt; then
125 cleanup_loop_dev "$mntpnt" "$loopdev" "$tfile"
126 error "Copy POSIX test suite failed"
128 export POSIX_SRC=$mntpnt
129 . $POSIX_DIR/posix.cfg
131 setup_posix_users $allnodes
132 if ! setup_posix; then
133 delete_posix_users $allnodes
134 cleanup_loop_dev "$POSIX_SRC"
135 cleanup_loop_dev "$mntpnt" "$loopdev" "$tfile"
136 error "Setup POSIX test suite failed"
139 log "Run POSIX test against lustre filesystem"
140 run_posix $MOUNT $MGSNID $FSNAME compare ||
141 error_noexit "Run POSIX testsuite on $MOUNT failed"
143 [[ -d "$MOUNT/TESTROOT" ]] && rm -fr $MOUNT/TESTROOT
144 delete_posix_users $allnodes
145 cleanup_loop_dev "$POSIX_SRC"
146 cleanup_loop_dev "$mntpnt" "$loopdev" "$tfile"
148 run_test 1 "install, build, run posix on $BASELINE_FS and lustre, then compare"
151 check_and_cleanup_lustre