1#!/bin/sh 2 3# This test require specially hacked fsx and fstorture binaries from here: 4# https://github.com/thedrgreenthumb/fstools 5 6TEST_DEV="/dev/disk/ata/1/master/raw" 7TEST_MP="/mount" 8 9MY_PATH=${PWD} 10 11run_fstorture() # ${1} => block size ${2} => features list 12{ 13 echo "Run test with bs=${1} and features ${2} ..." 14 15 mkfs.ext3 -b ${1} ${2} -F ${TEST_DEV} 16 dumpe2fs ${TEST_DEV} | grep 'Filesystem features' 17 18 mkdir -p ${TEST_MP} 19 mount -t ext2 ${TEST_DEV} ${TEST_MP} 20 21 if [ ! -f /bin/fstorture ]; then 22 echo "Can not find test binary in ${PWD}" 23 exit 1 24 fi 25 26 cp /bin/fstorture ${TEST_MP}/fstorture 27 28 mkdir ${TEST_MP}/root0 ${TEST_MP}/root1 29 cd ${TEST_MP} && ./fstorture root0 root1 1 -c 1000 nosoftlinks 30 31 cd ${MY_PATH} 32 33 sleep 5 34 35 unmount ${TEST_MP} 36 if [ "$?" -ne "0" ]; then 37 echo "Can not unmount..." 38 exit 1 39 fi 40 41 e2fsck -f -n ${TEST_DEV} 42 if [ "$?" -ne "0" ]; then 43 echo "e2fsck fail" 44 exit 1 45 fi 46} 47 48run_fsx() # ${1} => block size ${2} => features list 49{ 50 echo "Run run_fsx_combined_parallel with bs=${1} and features ${2} ..." 51 52 mkfs.ext3 -b ${1} ${2} -F ${TEST_DEV} 53 dumpe2fs ${TEST_DEV} | grep 'Filesystem features' 54 55 mkdir -p ${TEST_MP} 56 mount -t ext2 ${TEST_DEV} ${TEST_MP} 57 58 if [ ! -f /bin/fsx ]; then 59 echo "Can not find test binary in ${PWD}" 60 exit 1 61 fi 62 63 cp /bin/fsx ${TEST_MP}/fsx 64 65 cd ${TEST_MP} 66 67 NUM_OPS=2000 68 SEED=0 69 ./fsx -S ${SEED} -N ${NUM_OPS} ./TEST_FILE0 & 70 ./fsx -S ${SEED} -l 5234123 -o 5156343 -N ${NUM_OPS} ./TEST_FILE1 & 71 ./fsx -S ${SEED} -l 2311244 -o 2311200 -N ${NUM_OPS} ./TEST_FILE2 & 72 ./fsx -S ${SEED} -l 8773121 -o 863672 -N ${NUM_OPS} ./TEST_FILE3 & 73 ./fsx -S ${SEED} -l 234521 -o 234521 -N ${NUM_OPS} ./TEST_FILE4 & 74 ./fsx -S ${SEED} -l 454321 -o 33 -N ${NUM_OPS} ./TEST_FILE5 & 75 ./fsx -S ${SEED} -l 7234125 -o 7876728 -N ${NUM_OPS} ./TEST_FILE6 & 76 ./fsx -S ${SEED} -l 5646463 -o 4626734 -N ${NUM_OPS} ./TEST_FILE7 & 77 78 for job in `jobs -p` 79 do 80 wait $job 81 done 82 83 cd ${MY_PATH} 84 85 sleep 5 86 87 unmount ${TEST_MP} 88 if [ "$?" -ne "0" ]; then 89 echo "Can not unmount..." 90 exit 1 91 fi 92 93 e2fsck -f -n ${TEST_DEV} 94 if [ "$?" -ne "0" ]; then 95 echo "e2fsck fail" 96 exit 1 97 fi 98} 99 100# main() 101pkgman install -y cmd:fstorture cmd:fsx cmd:e2fsck 102 103FEATURES="-O huge_file -O dir_nlink -O extent" 104run_fsx "1024" "$FEATURES" 105run_fstorture "1024" "$FEATURES" 106 107run_fsx "2048" "$FEATURES" 108run_fstorture "2048" "$FEATURES" 109 110run_fsx "4096" "$FEATURES" 111run_fstorture "4096" "$FEATURES" 112 113#run_fsx "64k" "-O huge_file -O dir_nlink -O extent" 114#run_fstorture "64k" "-O huge_file -O dir_nlink -O extent" 115 116FEATURES="$FEATURES -O 64bit" 117 118run_fsx "1024" "$FEATURES" 119run_fstorture "1024" "$FEATURES" 120 121run_fsx "2048" "$FEATURES" 122run_fstorture "2048" "$FEATURES" 123 124run_fsx "4096" "$FEATURES" 125run_fstorture "4096" "$FEATURES" 126 127FEATURES="$FEATURES -O metadata_csum" 128 129run_fsx "1024" "$FEATURES" 130run_fstorture "1024" "$FEATURES" 131 132run_fsx "2048" "$FEATURES" 133run_fstorture "2048" "$FEATURES" 134 135run_fsx "4096" "$FEATURES" 136run_fstorture "4096" "$FEATURES" 137 138echo PASSED 139 140