11 LUSTRE=${LUSTRE:-$(dirname $0)/..}
12 . $LUSTRE/tests/test-framework.sh
16 # bug number for skipped test:
17 ALWAYS_EXCEPT="$PJDFSTEST_EXCEPT "
18 # bug number for skipped test: LU-12922 LU-1158
19 ALWAYS_EXCEPT+=" chown_00 utimensat_08"
22 PJDFSTEST_DIR=${PJDFSTEST_DIR:-"/usr/share/pjdfstest"}
23 PJDFSTEST_BIN=${PJDFSTEST_BIN:-"/bin/pjdfstest"}
24 EXT4_LOG=${EXT4_LOG:-"$TMP/pjdfstest-ext4"}
25 LUSTRE_LOG=${LUSTRE_LOG:-"$TMP/pjdfstest-lustre"}
27 check_and_setup_lustre
29 if [[ ! -f $PJDFSTEST_DIR/pjdfstest ]]; then
30 # copy the bin to the suite dir
31 if ! cp -af $PJDFSTEST_BIN $PJDFSTEST_DIR; then
32 error "Copy pjdfstest binary failed"
43 which prove > /dev/null || skip_env "must have prove installed"
45 cmd="prove -f $pjdfstest &> $report"
47 pushd $mntpnt > /dev/null
60 log "Run $pjdfstest against ext4 filesystem"
61 run_pjdfstest $EXT4_MNTPT $pjdfstest $EXT4_LOG
63 log "Run $pjdfstest against lustre filesystem"
64 mkdir_on_mdt0 $MOUNT/pjdfstest
65 run_pjdfstest $MOUNT/pjdfstest $pjdfstest $LUSTRE_LOG
73 mkdir -p $mntpt || error "mkdir -p $mntpt failed"
74 stack_trap "rm -rf $mntpt"
75 dd if=/dev/zero of=$loop_file bs=1M count=$size
76 stack_trap "rm -f $loop_file"
77 mkfs.ext4 $loop_file > /dev/null ||
78 error "mkfs.ext4 $loop_file failed"
80 mount -t ext4 -o loop,usrquota,grpquota $loop_file $mntpt ||
81 error "mount -o loop,usrquota,grpquota $loop_file $mntpt failed"
82 stack_trap "$UMOUNT $mntpt"
86 local ext4_summary=$TMP/pjdfstest-ext4-summary
87 local lustre_summary=$TMP/pjdfstest-lustre-summary
88 local summary="Test Summary Report"
89 local summary_end="Files"
90 local diff=$TMP/pjdfstest-diff
93 # filter out the summary and delete the duration part to compare
94 sed -n '/'"$summary"'/,/'"$summary_end"'/p' "$EXT4_LOG" |
95 sed '$d'> $ext4_summary
96 sed -n '/'"$summary"'/,/'"$summary_end"'/p' "$LUSTRE_LOG" |
97 sed '$d' > $lustre_summary
98 grep -vf $ext4_summary $lustre_summary > $diff
102 cat $EXT4_LOG || error_noexit "Cannot open file"
104 cat $LUSTRE_LOG || error_noexit "Cannot open file"
106 rm -f $TMP/pjdfstest-* ||
107 error_noexit "Cannot remove pjdfstest tmp files"
111 # All tests will be run on Lustre and an ext4 file system. Set up
112 # an ext4 file system
113 EXT4_MNTPT=/mnt/pjdfstest.ext4
114 LOOP_FILE=$TMP/loop_file
115 setup_ext4 $LOOP_FILE $EXT4_MNTPT
117 # Create users and groups required by the tests
118 mds=$(facet_host mds1)
120 USR=(pjd_usr1 pjd_usr2 pjd_usr3)
121 USRID=(65535 65533 65532)
122 GRP=(pjd_grp1 pjd_grp2 pjd_grp3)
123 GRPID=(65535 65533 65531)
126 for grp_id in ${GRPID[@]}; do
127 echo "setup up GRPID $grp_id for group ${GRP[$idx]} on $mds"
128 do_rpc_nodes $mds add_group $grp_id ${GRP[$idx]}
129 stack_trap "do_rpc_nodes $mds groupdel ${GRP[$idx]}"
134 for user_id in ${USRID[@]}; do
135 echo "setup up USRID $user_id for user ${USR[$idx]}"
136 do_rpc_nodes $mds add_user $user_id ${USR[$idx]} \
137 ${GRPID[$idx]} $DIR/${USR[$idx]}
138 stack_trap "do_rpc_nodes $mds userdel ${USR[$idx]}"
143 PJDFSTEST_DIR=${PJDFSTEST_DIR:-"/usr/share/pjdfstest"}
144 # enable globstar so ** can get all dir recursively
146 for testname in $PJDFSTEST_DIR/**/*.t; do
147 test_dir=$(dirname $testname)
148 test_grp=$(basename $test_dir)
149 sub_t="${test_grp}_$(basename $testname .t)"
150 # execute the "desc=" line and set it the environment for our use
151 eval $(grep "^desc=" $testname)
155 run_lustre_ext4 $testname
156 compare_report || error "$testname against lustre failed"
158 run_test $sub_t "$desc"
164 check_and_cleanup_lustre
167 } > $TMP/run_pjdfstest.sh
168 bash $TMP/run_pjdfstest.sh