[Ocfs2-test-devel] [PATCH 05/11] ocfs2-test: Added Run_corruption function.

Marcos E. Matsunaga Marcos.Matsunaga at oracle.com
Sat Jun 12 06:47:36 PDT 2010


Tristan,

I don't remember who gave me this to test. I made a few changes to it,
but still need a little more.. Good catch. I'll make the changes.

Regards,

Marcos Eduardo Matsunaga

Oracle USA
Linux Engineering

“The statements and opinions expressed here are my own and do not
necessarily represent those of Oracle Corporation.”


On 06/03/2010 10:53 PM, tristan wrote:
> Marcos Matsunaga wrote:
>> - Added execution to the config.sh script.
>>
>> Signed-off-by: Marcos Matsunaga <Marcos.Matsunaga at oracle.com>
>> ---
>>  programs/fill_verify_holes/Makefile   |    2 +
>>  programs/fill_verify_holes/burn-in.sh |   59
>> ++++++++++++++++++++++++++++++++-
>>  2 files changed, 60 insertions(+), 1 deletions(-)
>>
>> diff --git a/programs/fill_verify_holes/Makefile
>> b/programs/fill_verify_holes/Makefile
>> index d0d53ae..9771542 100644
>> --- a/programs/fill_verify_holes/Makefile
>> +++ b/programs/fill_verify_holes/Makefile
>> @@ -8,6 +8,8 @@ CFLAGS = -O2 -Wall -g $(OCFS2_CFLAGS)
>>  
>>  SOURCES = fill_holes.c punch_holes.c verify_holes.c fill_holes.h
>> reservations.h
>>  
>> +SUBDIR = fill_holes_data
>> +
>
> Oh,
>
> Here I guess you want to install subdir 'fill_holes_data' into desired
> postion(DESTDIR/workfiles/), right?
>
> So please use SUBDIRS, makefile rules didn't recognize SUBDIR:)
>
> SUBDIRS = fill_holes_data
>
> What's more, you're also required to make a new directory called
> 'fill_holes_data' under 'programs/fill_verify_holes', and place a
> makefile inside:
> --------------------------------------------------------------
> TOPDIR = ../../..
>
> include $(TOPDIR)/Preamble.make
>
> DATADIR = fill_holes_data
>
> include $(TOPDIR)/Postamble.make
> --------------------------------------------------------------
>
> That's all what you really want, I bet:)
>
>>  DIST_FILES = $(SOURCES)
>>  
>>  BIN_EXTRA = burn-in.sh old_burn-in.sh fill_verify_holes.sh
>> diff --git a/programs/fill_verify_holes/burn-in.sh
>> b/programs/fill_verify_holes/burn-in.sh
>> index 1ee2b02..0ae25e7 100755
>> --- a/programs/fill_verify_holes/burn-in.sh
>> +++ b/programs/fill_verify_holes/burn-in.sh
>> @@ -9,15 +9,28 @@ SUDO="`which sudo` -u root"
>>  DEBUGFS_BIN="`which sudo` -u root `which debugfs.ocfs2`"
>>  MKFS_BIN="`which sudo` -u root `which mkfs.ocfs2`"
>>  TUNEFS_BIN="`which sudo` -u root `which tunefs.ocfs2`"
>> +MOUNTED_BIN="`which sudo` -u root `which mounted.ocfs2`"
>>  GREP=`which grep`
>> +CHOWN=`which chown`
>>  DF=`which df`
>> +WC=`which wc`
>>  ECHO="`which echo` -e"
>>  AWK=`which awk`
>>  
>> +USERID=`/usr/bin/whoami`
>>  BINPATH="."
>>  LOGPATH="."
>>  MMAPOPT=
>> -UNWOPT=
>> +if [ `dirname ${0}` == '.' ]; then
>> +    if [ -f config.sh ]; then
>> +        . ./config.sh;
>> +    fi;
>> +else
>> +    if [ -f `dirname ${0}`/config.sh ]; then
>> +        . `dirname ${0}`/config.sh
>> +    fi;
>> +fi;
>
> why need to judge [ `dirname ${0}` == '.' ] ?
>
> I saw no difference if you directly use:
>
> +    if [ -f `dirname ${0}`/config.sh ]; then
> +        . `dirname ${0}`/config.sh
> +    fi;
>
>
>> +NWOPT=
>>  
>>  log_run() {
>>      echo "Run: $@"
>> @@ -66,6 +79,48 @@ run100() {
>>      done
>>  }
>>  
>> +Run_corruption() {
>> +    CORRUPTLOG=${O2TDIR}/workfiles/fill_holes_data/nosparsebug.dat
>> +    FILESIZE=$[11*1024*1024*1024];
>> +    FILENAME=${DIRECTORY}/fill_holes.txt;
>> +    FS_FEATURES='--fs-features=nosparse,nounwritten'
>> +    LOCAL_FEATURE=''
>> +    if [ ${LOCALFLAG} -eq 1 ]; then
>> +        LOCAL_FEATURE='-M local';
>> +    fi;
>> +    echo -e "Testing corruption";
>> +    mounted=`mount|grep ${MOUNTPOINT}|${WC} -l`;
>> +    if [ ${mounted} -eq 1 ]; then
>> +        echo -e "umounting partition";
>> +        sudo umount ${MOUNTPOINT};
>> +    fi;
>> +    mounted=`mount|grep ${MOUNTPOINT}|${WC} -l`;
>> +    if [ ${mounted} -ne 0 ]; then
>> +        echo -e "Device ${DEVICE} is mounted by some other node.";
>> +        echo -e "Can't proceed with this test. Aborting.";
>> +        exit 1;
>> +    fi;
>> +    echo "Formatting partition with nosparse,nounwritten options.";
>> +    echo "y"|${MKFS_BIN} -b ${BLOCKSIZE} -C ${CLUSTERSIZE} -L
>> ${LABEL} \
>> +    -N ${SLOTS} ${LOCAL_FEATURE} ${FS_FEATURES} ${DEVICE};
>> +    if [ $? -ne 0 ]; then
>> +        echo -e "mkfs.ocfs2 failed $?";
>
> Shouldn't we quit the test if mkfs failed?
>
>> +    fi;
>> +    echo "mounting device with label ${LABEL} on ${MOUNTPOINT}";
>> +    sudo mount LABEL=${LABEL} ${MOUNTPOINT};
>> +    sudo mkdir -p ${DIRECTORY}
>> +    ${SUDO} ${CHOWN} --recursive ${USERID} ${MOUNTPOINT}
>> +
>> +    mounted=`mount|grep ${MOUNTPOINT}|${WC} -l`;
>> +    if [ ${mounted} -eq 0 ]; then
>> +        echo -e "Device ${DEVICE} was not properly mounted.";
>> +        echo -e "Can't proceed with this test. Aborting.";
>> +        exit 1;
>> +    fi;
>> +    ${BINDIR}/fill_holes  -r ${CORRUPTLOG} ${FILENAME} ${FILESIZE};
>> +    ${BINDIR}/verify_holes ${CORRUPTLOG} ${FILENAME};
>> +}
>> +
>>  #
>>  # GetDevInfo
>>  #
>> @@ -88,6 +143,7 @@ LABEL=`${DEBUGFS_BIN} -R stats ${DEVICE} | grep
>> Label:|\
>>  if [ "X${LABEL}" == "X" ]; then
>>      LABEL="testlabel";
>>  fi;
>> +LOCALFLAG=`${DEBUGFS_BIN} -R stats ${DEVICE} | grep 'local' |${WC} -l`
>
> I guess you want to judge if 'local features' was set on superblock.
>
> But please don't make the decision by arbitrarily counting the number
> of lines where 'local' was seen, in case we may add other output for
> debugfs.ocfs which contains 'local' string, following way could be
> more graceful and exact:
>
> ${DEBUGFS_BIN} -R "stats" ${DEVICE}|grep "Feature Incompat"|grep -q
> 'local'
> LOCALFLAG=$?
>
> thing was different a little bit, here 'LOCALFLAG == 0' denotes that
> we've set local features on SB.
>
>
>>  UUID=`${DEBUGFS_BIN} -R stats ${DEVICE} | grep UUID|\
>>      ${AWK} -F" " '{print $2}'`;
>>  SLOTS=`${DEBUGFS_BIN} -R stats ${DEVICE} | grep Slots:|\
>> @@ -122,3 +178,4 @@ fi
>>  
>>  GetDevInfo;
>>  run100 ${ITER} ${SIZE} +Run_corruption
> Btw, I trusted you on the logics of newly added testcase:)
>
>
> Tristan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://oss.oracle.com/pipermail/ocfs2-test-devel/attachments/20100612/9c2e78a8/attachment.html 


More information about the Ocfs2-test-devel mailing list