X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fmake_ext4fs.git;a=blobdiff_plain;f=test_ext4fixup;fp=test_ext4fixup;h=0000000000000000000000000000000000000000;hp=a920a59da05d039159590d68b2070e0e6078e225;hb=fe3bfde910b6f5e753c69e19816bc78b23746434;hpb=2964e1c7361424c30405b348fe545f7bb3fc290c diff --git a/test_ext4fixup b/test_ext4fixup deleted file mode 100755 index a920a59..0000000 --- a/test_ext4fixup +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash - -typeset -i I ITERATIONS PHASE LOC COUNT MAXCOUNT - -ME=`basename $0` - -if [ "$#" -ne 3 ] -then - echo "$ME: Usage: $ME " >&2 - exit 1; -fi - -ITERATIONS="$1" -MAXCOUNT="$2" -ORIG_FS_IMAGE="$3" -FIXED_FS_IMAGE="/tmp/fixedfsimage.$$" -NEW_FS_IMAGE="/tmp/newfsimage.$$" - -if [ ! -f "$ORIG_FS_IMAGE" ] -then - echo "$ME: Filesystem image $NEW_FS_IMAGE does not exist" >&2 - exit 1 -fi - -trap "rm -f $NEW_FS_IMAGE $FIXED_FS_IMAGE" 0 1 2 3 15 - -rm -f "$NEW_FS_IMAGE" "$FIXED_FS_IMAGE" - -# Create the fixed image to compare against -cp "$ORIG_FS_IMAGE" "$FIXED_FS_IMAGE" -ext4fixup "$FIXED_FS_IMAGE" - -if [ "$?" -ne 0 ] -then - echo "$ME: ext4fixup failed!\n" - exit 1 -fi - -I=0 -while [ "$I" -lt "$ITERATIONS" ] -do - # There is also a phase 4, which is writing out the updated superblocks and - # block group descriptors. Test the with a separate script. - let PHASE="$RANDOM"%3 # 0 to 2 - let PHASE++ # 1 to 3 - let LOC="$RANDOM"%2 # 0 to 1 - let LOC++ # 1 to 2 - let COUNT="$RANDOM"%"$MAXCOUNT" - - # Make a copy of the original image to fixup - cp "$ORIG_FS_IMAGE" "$NEW_FS_IMAGE" - - # Run the fixup tool, but die partway through to see if we can recover - ext4fixup -d "$PHASE,$LOC,$COUNT" "$NEW_FS_IMAGE" 2>/dev/null - - # run it again without -d to have it finish the job - ext4fixup "$NEW_FS_IMAGE" - - if cmp "$FIXED_FS_IMAGE" "$NEW_FS_IMAGE" - then - : - else - echo "$ME: test failed with parameters $PHASE, $LOC, $COUNT" - exit 1 - fi - - rm -f "$NEW_FS_IMAGE" - - let I++ -done -