Veerendra,
I am hoping that you are preparing to resend me an updated Patch after
incorporating review comments from sergei.
Regards--
Subrata
On Thu, 2008-06-12 at 08:32 -0500, Serge E. Hallyn wrote:
> Quoting Veerendra Chandrappa ([EMAIL PROTECTED]):
> >
> >
> > Hi
> >
> > The ro-bind-test.sh script verifies the filesystems for ro-bind mount
> > feature.
> > It checks for the normal-mount, bind-mount and ReadOnly-mount filesystems.
> > This script executes filesystem tests take from the
> > $LTPROOT/runtest/fs-ro-tests on different mount points.
> > It can be used to verify the filesystems ext3, ext2, jfs, reiserfs etc
> > You can specify the filesystem type and number of iterations the tests to
> > be carried out.
> > In the future we can append more test's to the cmd-file to verify the
> > ro-bind .
>
> I don't object to getting the framework in now and worrying about the
> complete set of tests to run later, but as Dave as pointed out, the list
> of tests is gibberish to most of us non-ltp-experts. A file explaining
> the rationale behind each test and detailing ideas for things which
> still need to be tested (as Dave pointed out, perhaps ioctls and xattrs)
> would be nice to add.
>
> > Steps to execute:
> > 1. Compile and install the LTP.
> > 2. Apply the patch robind.patch and cmdfile.patch.
> > 2. Execute $LTPROOT/testscripts/ro-bind-test.sh -n2 -f jfs &
> > 3.Check the logs at /tmp/fs$$/[pass,fail].log
> >
> > I have verified the script for different filesystems and attaching the
> > result log-files for your reference.
> >
> > (See attached file: robind.patch)(See attached file: cmdfile.patch)(See
> > attached file: pass.log)(See attached file: errs.log)
> >
> > Signed off : Veerendra C <[EMAIL PROTECTED]>
> > Regards, Veerendra C
> > ________________________________________________________
> > Linux Technology Center, India Software Labs, Bangalore, Ph: 080-4177 6428
>
>
>
>
> diff -uprN ltp-full-20080531/testscripts.orig/ro-bind-test.sh
> ltp-full-20080531/testscripts/ro-bind-test.sh
> --- ltp-full-20080531/testscripts.orig/ro-bind-test.sh 1970-01-01
> 05:30:00.000000000 +0530
> +++ ltp-full-20080531/testscripts/ro-bind-test.sh 2008-06-12
> 14:37:38.000000000 +0530
> @@ -0,0 +1,247 @@
> +#!/bin/bash
> +#
> +# Copyright (c) International Business Machines Corp., 2008
> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 2 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
> +# the GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write to the Free Software
> +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> +#
> +#*******************************************************************************
> +# TEST:
> +# NAME: ro_bind_test.sh
> +# FUNCTIONALITY: File system tests for normal_mount, bind_mount and
> RO_mount
> +#
> +# DESCRIPTION: Performs filesystems tests for RO mount.
> +# For filesystem's like ext2, ext3, reiserfs, jfs & xfs.
> +# This test creates an image file and mount it as ReadOnly.
> +# Then it executes the tests from flat-file
> {LTPROOT}/runtest/fs-ro-tests
> +# Check the logs /tmp/fs$$/errs.log and /tmp/fs$$/pass.log for
> pass/fail.
> +#===============================================================================
> +#
> +# CHANGE HISTORY:
> +# DATE AUTHOR's REASON
> +# 09/06/2008 Veerendra Chandrappa For Container, testing of RO-Bind
> mount
> +# Dave Hansen
> +#
> +#*******************************************************************************
> +usage()
> +{
> + cat << EOF
> + usage: $0
> +
> + This script executes filesystem tests on mount points.
> + Verifies the fs of normal-mount, bind-mount and ReadOnly-mount
> + By default checks for the 'ext3' filesystem.
> +
> + OPTIONS
> + -h display this message and exit
> + -n number of iterations for tests to execute
> + -f [ext3, ext2, jfs, xfs, reiserfs, ramfs]
> +EOF
> +}
> +
> +
> +#==============================================================================
> +# FUNCTION NAME: cleanup
> +#
> +# FUNCTION DESCRIPTION: Unmounts dir, Removes dir's, files created by the
> tests.
> +#
> +# PARAMETERS: The $fs_image .
> +#
> +# RETURNS: None.
> +#==============================================================================
> +function cleanup
> +{
> + umount ${TMPDIR}/dir3-ro
> + umount ${TMPDIR}/dir2-bound
> + umount ${TMPDIR}/dir1
>
> I would feel much more comfortable that the results were meaningful if
> there were separate runs for dir3-ro and dir4-bound-ro, where dir3-ro
> were a strict mount -o ro of the fs. As it is, every test registered
> 'success' for dir3-ro, but I don't know if that means that it succeeded
> in writing to the fs, hence 'success' would actually be 'failure'.
>
> + # Deleting the image file
> + if [ ! -z $1 ]; then {
> + rm -rf $1 || true
> + }
> + fi
> +}
> +
> +#===============================================================================
> +# FUNCTION NAME: setup
> +#
> +# FUNCTION DESCRIPTION: Does the initailization
> +#
> +# PARAMETERS: File_systems (if any )
> +#
> +# RETURNS: None.
> +#===============================================================================
> +function setup
> +{
> + trap cleanup ERR
> + trap cleanup INT
> + DIRS="dir1 dir2-bound dir3-ro"
> + TMPDIR=/tmp/fs$$
> + mkdir ${TMPDIR}
> + FAILLOG="$TMPDIR/errs.log"
> + PASSLOG="$TMPDIR/pass.log"
> +
> + for i in $DIRS; do
> + rm -rf ${TMPDIR}/$i || true
> + mkdir -p ${TMPDIR}/$i
> + done;
> +
> + # Populating the default FS as ext3, if FS is not given
> + if [ -z "$1" ]; then
> + FSTYPES="ext3"
> + else
> + FSTYPES="$fs"
> + fi
> +
> + # set the LTPROOT directory
> + cd `dirname $0`
> + echo "${PWD}" | grep testscripts > /dev/null 2>&1
> + if [ $? -eq 0 ]; then
> + cd ..
> + export LTPROOT="${PWD}"
> + fi
> +
> + FS_Tests="${LTPROOT}/runtest/fs-ro-tests"
> + cd ${TMPDIR}
> +}
> +
> +#=============================================================================
> +# FUNCTION NAME: testdir
> +#
> +# FUNCTION DESCRIPTION: The core function where it runs the tests
> +#
> +# PARAMETERS: dir, file_systems, iterations, Read_only flag = [true|false]
> +#
> +# RETURNS: None.
> +#=============================================================================
> +function testdir
> +{
> + dir=$1
> + fs=$2
> + times=$3
> + RO=$4
> + pushd $dir
> + testnums=`wc -l $FS_Tests | cut -f1 -d" "`
> + status=0
> + export TDIRECTORY={$PWD}
> +
> + echo "---------------------------------------------------" >> $FAILLOG ;
> + echo "Running RO-FileSystem Tests for $dir $fs filesystem" >> $FAILLOG ;
> + echo "---------------------------------------------------" >> $FAILLOG ;
> +
> + echo "---------------------------------------------------" >> $PASSLOG ;
> + echo "Running RO-FileSystem Tests for $dir $fs filesystem" >> $PASSLOG ;
> + echo "---------------------------------------------------" >> $PASSLOG ;
> +
> + for iter in `seq 1 $times` ; do
> + if [ $RO == false ] ; then # Testing Read-Write
> dir
> + for tests in `seq $testnums` ; do
> + cmd=`cat $FS_Tests | head -$tests | tail -1`
> + eval $cmd > /dev/null 2>&1 /dev/null
> + if [ $? ]; then
> + echo "$tests. '$cmd' PASS" >> $PASSLOG
> + else
> + echo "$tests. '$cmd' FAIL " >> $FAILLOG
> + status=1
> + fi
> + done
> +
> + else # Testing Read-Only
> dir
> + for tests in `seq $testnums` ; do
> + cmd=`cat $FS_Tests | head -$tests | tail -1`
> + eval $cmd > /dev/null 2>&1 /dev/null
> + if [ $? ]; then
> + echo "$tests. '$cmd' PASS " >> $PASSLOG
> + else
> + echo "$tests. '$cmd' FAIL" >> $FAILLOG
> + status=1
> + fi
> + done
>
> Maybe I'm missing something because of the interesting formatting, but
> aren't the read-write and read-only cases above identical?
>
> thanks,
> -serge
>
> + fi
> + # Remove all the temp-files created.
> + eval rm -rf ${TMPDIR}/${dir}/* > /dev/null 2>&1 /dev/null || true
> + done
> + if [ $status == 1 ] ; then
> + echo "RO-FileSystem Tests FAILED for $dir $fs filesystem" >> $FAILLOG
> + echo >> $FAILLOG
> + else
> + echo "RO-FileSystem Tests PASSed for $dir $fs filesystem" >> $PASSLOG
> + echo >> $PASSLOG
> + fi
> + unset TDIRECTORY
> + popd
> +}
> +
> +#=============================================================================
> +# MAIN
> +# See the description, purpose, and design of this test in this test's
> prolog.
> +#=============================================================================
> +iter=1
> +fs=
> +while getopts hn:f: OPTION; do
> + case $OPTION in
> + h)
> + usage
> + exit 1
> + ;;
> + n)
> + iter=$OPTARG
> + ;;
> +
> + f)
> + fs="$OPTARG $fs"
> + ;;
> +
> + ?)
> + usage
> + exit 1
> + ;;
> + esac
> +done
> +# Does the initial setups
> +setup $fs
> +
> +# Executes the tests for differnt FS's
> +# Creates an image file of 500 MB and mounts it.
> +for fstype in $FSTYPES; do
> + image=$fstype.img
> + dd if=/dev/zero of=$image bs=$((1<<20)) count=500
> +
> + OPTS="-F"
> + if [ "$fstype" == "reiserfs" ]; then
> + OPTS="-f --journal-size 513 -q"
> + elif [ "$fstype" == "jfs" ]; then
> + OPTS="-f"
> + elif [ "$fstype" == "xfs" ]; then
> + OPTS=""
> + fi
> +
> + if [ "$fstype" != "ramfs" ]; then
> + mkfs.$fstype $OPTS $image || echo "Linux ($fstype) format failed!"
> + fi
> +
> + mount -t $fstype -o loop $image dir1
> + mount --bind dir1 dir2-bound || exit
> + mount --bind dir1 dir3-ro || exit
> + mount -o remount,ro dir3-ro || exit
> +
> + testdir dir1 $fstype $iter false
> + testdir dir2-bound $fstype $iter false
> + testdir dir3-ro $fstype $iter true
> + cleanup $image
> +done
> +
> + for i in $DIRS; do
> + rm -rf ./$i || true
> + done;
> +
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Ltp-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ltp-list
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list