5 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
6 . $LUSTRE/tests/test-framework.sh
8 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
12 check_and_setup_lustre
14 POSIX_DIR=${POSIX_DIR:-"$LUSTRE/tests/posix"}
15 POSIX_SRC=${POSIX_SRC:-"/usr/src/posix"}
16 BASELINE_FS=${BASELINE_FS:-"ext4"}
18 # SLES does not support read-write access to an ext4 file system by default
19 [[ -e /etc/SuSE-release ]] && BASELINE_FS=ext3
26 # if we only have 1 arg, we will search for dev
28 dev=$(losetup -a | grep "$mnt" | cut -d: -f1)
29 [[ -n $dev ]] && losetup -d $dev
30 else # we need all args
31 [[ -z $mnt ]] || [[ -z $dev ]] || [[ -z $file ]] &&
32 error "Can't cleanup loop device"
34 losetup -d $dev && rm -rf $mnt
45 echo "Make a loop file system with $file on $dev"
46 dd if=/dev/zero of=$file bs=1024k count=500 > /dev/null
47 if ! losetup $dev $file; then
49 echo "can't set up $dev for $file"
52 if ! eval mkfs.$BASELINE_FS $dev; then
54 echo "mkfs.$BASELINE_FS on $dev failed"
58 if ! mount -t $BASELINE_FS $dev $mnt; then
60 echo "mount $BASELINE_FS failed"
68 local allnodes="$(comma_list $(nodes_list))"
69 local tfile="$TMP/$BASELINE_FS-file"
70 local mntpnt=$POSIX_SRC/$BASELINE_FS
75 # We start at loop1 because posix build uses loop0
76 [ -b /dev/loop/1 ] && loopbase=/dev/loop/
77 [ -b /dev/loop1 ] && loopbase=/dev/loop
78 [ -z "$loopbase" ] && error "/dev/loop/1 and /dev/loop1 gone?"
80 for i in `seq 1 7`; do
81 losetup $loopbase$i > /dev/null 2>&1 && continue || true
86 [ -z "$loopdev" ] && error "Can not find loop device"
88 if ! setup_loop_dev $mntpnt $loopdev $tfile; then
89 cleanup_loop_dev "$mntpnt" "$loopdev" "$tfile"
90 error "Setup loop device failed"
93 # copy the source over to ext mount point
94 if ! cp -af ${POSIX_SRC}/*.* $mntpnt; then
95 cleanup_loop_dev "$mntpnt" "$loopdev" "$tfile"
96 error "Copy POSIX test suite failed"
98 export POSIX_SRC=$mntpnt
99 . $POSIX_DIR/posix.cfg
101 setup_posix_users $allnodes
102 if ! setup_posix; then
103 delete_posix_users $allnodes
104 cleanup_loop_dev "$POSIX_SRC"
105 cleanup_loop_dev "$mntpnt" "$loopdev" "$tfile"
106 error "Setup POSIX test suite failed"
109 log "Run POSIX test against lustre filesystem"
110 run_posix $MOUNT compare || \
111 error_noexit "Run POSIX testsuite on $MOUNT failed"
113 [[ -d "$MOUNT/TESTROOT" ]] && rm -fr $MOUNT/TESTROOT
114 delete_posix_users $allnodes
115 cleanup_loop_dev "$POSIX_SRC"
116 cleanup_loop_dev "$mntpnt" "$loopdev" "$tfile"
118 run_test 1 "install, build, run posix on $BASELINE_FS and lustre, then compare"
121 check_and_cleanup_lustre