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 12{ 13 echo "Run test with bs=${1} ..." 14 15 mkfs -t fat ${TEST_DEV} TESTVOL 16 17 mkdir -p ${TEST_MP} 18 mount -t fat ${TEST_DEV} ${TEST_MP} 19 20 if [ ! -f /bin/fstorture ]; then 21 echo "Can not find test binary in ${PWD}" 22 exit 1 23 fi 24 25 cp /bin/fstorture ${TEST_MP}/fstorture 26 27 mkdir ${TEST_MP}/root0 ${TEST_MP}/root1 28 cd ${TEST_MP} && ./fstorture root0 root1 1 -c 1000 nosoftlinks 29 30 cd ${MY_PATH} 31 32 sleep 5 33 34 unmount ${TEST_MP} 35 if [ "$?" -ne "0" ]; then 36 echo "Can not unmount..." 37 exit 1 38 fi 39 40 fsck.fat -f -n ${TEST_DEV} 41 if [ "$?" -ne "0" ]; then 42 echo "fsck.fat fail" 43 exit 1 44 fi 45} 46 47run_fsx() # ${1} => block size ${2} => features list 48{ 49 echo "Run run_fsx_combined_parallel with bs=${1}" 50 51 mkfs -t fat ${TEST_DEV} TESTVOL 52 53 mkdir -p ${TEST_MP} 54 mount -t fat ${TEST_DEV} ${TEST_MP} 55 56 if [ ! -f /bin/fsx ]; then 57 echo "Can not find test binary in ${PWD}" 58 exit 1 59 fi 60 61 cp /bin/fsx ${TEST_MP}/fsx 62 63 cd ${TEST_MP} 64 65 NUM_OPS=2000 66 SEED=0 67 ./fsx -S ${SEED} -N ${NUM_OPS} ./TEST_FILE0 & 68 ./fsx -S ${SEED} -l 5234123 -o 5156343 -N ${NUM_OPS} ./TEST_FILE1 & 69 ./fsx -S ${SEED} -l 2311244 -o 2311200 -N ${NUM_OPS} ./TEST_FILE2 & 70 ./fsx -S ${SEED} -l 8773121 -o 863672 -N ${NUM_OPS} ./TEST_FILE3 & 71 ./fsx -S ${SEED} -l 234521 -o 234521 -N ${NUM_OPS} ./TEST_FILE4 & 72 ./fsx -S ${SEED} -l 454321 -o 33 -N ${NUM_OPS} ./TEST_FILE5 & 73 ./fsx -S ${SEED} -l 7234125 -o 7876728 -N ${NUM_OPS} ./TEST_FILE6 & 74 ./fsx -S ${SEED} -l 5646463 -o 4626734 -N ${NUM_OPS} ./TEST_FILE7 & 75 76 for job in `jobs -p` 77 do 78 wait $job 79 done 80 81 cd ${MY_PATH} 82 83 sleep 5 84 85 unmount ${TEST_MP} 86 if [ "$?" -ne "0" ]; then 87 echo "Can not unmount..." 88 exit 1 89 fi 90 91 fsck.fat -f -n ${TEST_DEV} 92 if [ "$?" -ne "0" ]; then 93 echo "fsck.fat fail" 94 exit 1 95 fi 96} 97 98# main() 99pkgman install -y cmd:fstorture cmd:fsx cmd:fsck.fat cmd:mkfs.fat 100 101FEATURES="" 102run_fsx "1024" "$FEATURES" 103run_fstorture "1024" "$FEATURES" 104 105run_fsx "2048" "$FEATURES" 106run_fstorture "2048" "$FEATURES" 107 108run_fsx "4096" "$FEATURES" 109run_fstorture "4096" "$FEATURES" 110 111echo PASSED 112 113