Subrata Modak wrote:
testscripts/test_robind.sh
so that it returns/exits non-zero even if one test fails. Presently it
is not doing that. Since, there is no other way for PAN to know if the
test(s) failed/passed until the running scripts returns that value, so
your script should do that. Anyways, i have checked the new patch into
CVS. And you can send the modifications to me in another patch.
Thanks for contributing this patch.
Regards--
Subrata
Subrata,
Now this script returns proper exit code , in the event of
failure/success. I have verified this.
Thanks for pointing out .
Regards
Veerendra C
Index: ltp-full-20080731/runtest/fs_readonly
===================================================================
--- /dev/null
+++ ltp-full-20080731/runtest/fs_readonly
@@ -0,0 +1 @@
+ROBind $LTPROOT/testscripts/test_robind.sh
Index: ltp-full-20080731/testscripts/Readme_ROBind
===================================================================
--- /dev/null
+++ ltp-full-20080731/testscripts/Readme_ROBind
@@ -0,0 +1,107 @@
+The ReadOnly Bind mount tests, uses the filesystems tests from
+the {LTPROOT}/testcases/kernel/fs .
+
+EXECUTING TESTS
+==================
+The tests can be executed through runltp like:
+
+./runltp -f fs_readonly
+
+Following tests are executed when the above is invoked:
+
+IOGEN & DOIO
+ |
+ ----- iogen
+ |
+ ----- doio
+ |
+ ----- rwtest
+ |
+ ----- growfiles
+FS_INOD
+LINKTEST
+OPENFILE
+INODE
+STREAM
+FTEST
+LFTEST
+WRITETEST.
+
+IOGEN & DOIO
+=============
+
+ This is a pair of programs that does basic I/O operations on a set of files.
+The file offset, I/O length, I/O operation, and what open(2) flags are
+selected randomly from a pre-defined or commandline given set. All data
+written can be verified (this is the usual method).
+
+RWTest
+-----
+rwtest is a shell script that is a wrapper of iogen and doio.
+
+Growfiles
+--------
+Growfiles will create and truncate files in gradual steps using write and lseek.
+The system calls are checked for proper returns.
+
+FS_INOD
+============
+
+File system stress - inode allocation/deallocation.
+Rapidly creates and deletes files through multiple processes running in the
+background.
+
+
+LINKTEST
+===========
+
+Linktest.pl is a simple test that attempts to create a given number of hard
+links and symbolic links to a single file.
+
+
+OPENFILE
+===========
+
+Create files and open simultaneously.
+
+INODE
+==================
+
+Does the File system managment and I/O functions work.
+This Construct a directory tree, create files in it, and verify
+that this was done as expected. It uses the syscalls mkdir, stat, open
+
+
+STREAM
+============
+
+Performs different tests on the stream syscalls.
+This uses the syscalls freopen, fopen, mknod, ftell, fwrite, fread, ferror,
+feof, clearerr and fileno.
+
+FTEST
+=========
+Tests the file I/O, Inodes.
+Uses the syscalls
+ * lseek, read, write, truncate, ftruncate, fsync, sync, fstat
+ * open, close, unlink, chdir, readv, writev, lseek64, llseek
+
+LFTEST
+==========
+
+Uses the lseek64.
+This writes one buffer at a time and lseeks from the beginning of the file to the
+end of the last write position
+
+
+WRITETEST
+=============
+
+This test verifies that writes to disk occur without corruption.
+Once done , the file is re-opened, the random number generator
+is re-seeded, and the file is verified.
+
+IOCTL
+========
+( Note: Writing the tests to include tests on the ioctl system calls.)
+
Index: ltp-full-20080731/testscripts/fs_ro_tests
===================================================================
--- /dev/null
+++ ltp-full-20080731/testscripts/fs_ro_tests
@@ -0,0 +1,56 @@
+growfiles -W gf01 -b -e 1 -u -i 0 -L 5 -w -C 1 -l -I r -T 10 glseek20 glseek20.2
+growfiles -W gf02 -b -e 1 -L 10 -i 100 -I p -S 2 -u -f gf03_
+growfiles -W gf03 -b -e 1 -g 1 -i 1 -S 150 -u -f gf05_
+growfiles -W gf04 -b -e 1 -g 4090 -i 500 -t 39000 -u -f gf06_
+growfiles -W gf05 -b -e 1 -g 5000 -i 500 -t 49900 -T10 -c9 -I p -u -f gf07_
+growfiles -W gf06 -b -e 1 -u -r 1-5000 -R 0--1 -i 0 -L 3 -C 1 g_rand10 g_rand10.2
+growfiles -W gf07 -b -e 1 -u -r 1-5000 -R 0--2 -i 0 -L 3 -C 1 -I p g_rand13 g_rand13.2
+growfiles -W gf08 -b -e 1 -u -r 1-5000 -R 0--2 -i 0 -L 3 -C 1 g_rand11 g_rand11.2
+growfiles -W gf09 -b -e 1 -u -r 1-5000 -R 0--1 -i 0 -L 3 -C 1 -I p g_rand12 g_rand12.2
+growfiles -W gf10 -b -e 1 -u -r 1-5000 -i 0 -L 3 -C 1 -I l g_lio14 g_lio14.2
+growfiles -W gf11 -b -e 1 -u -r 1-5000 -i 0 -L 3 -C 1 -I L g_lio15 g_lio15.2
+mkfifo gffifo17; growfiles -b -W gf12 -e 1 -u -i 0 -L 3 gffifo17
+mkfifo gffifo18; growfiles -b -W gf13 -e 1 -u -i 0 -L 3 -I r -r 1-4096 gffifo18
+growfiles -W gf14 -b -e 1 -u -i 0 -L 2 -w -l -C 1 -T 10 glseek19 glseek19.2
+growfiles -W gf15 -b -e 1 -u -r 1-49600 -I r -u -i 0 -L 3 Lgfile1
+growfiles -W gf16 -b -e 1 -i 0 -L 3 -u -g 4090 -T 100 -t 408990 -l -C 10 -c 1000 -S 10 -f Lgf02_
+growfiles -W gf17 -b -e 1 -i 0 -L 3 -u -g 5000 -T 100 -t 499990 -l -C 10 -c 1000 -S 10 -f Lgf03_
+growfiles -W gf18 -b -e 1 -i 0 -L 3 -w -u -r 10-5000 -I r -l -S 2 -f Lgf04_
+growfiles -W gf19 -b -e 1 -g 5000 -i 500 -t 49900 -T10 -c9 -I p -o O_RDWR,O_CREAT,O_TRUNC -u -f gf08i_
+growfiles -W gf20 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 1-256000:512 -R 512-256000 -T 4 gfbigio-$$
+growfiles -W gf21 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 -T 10 -t 20480 gf-bld-$$
+growfiles -W gf22 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 -T 10 -t 20480 gf-bldf-$$
+growfiles -W gf23 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 512-64000:1024 -R 1-384000 -T 4 gf-inf-$$
+growfiles -W gf24 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 gf-jbld-$$
+growfiles -W gf25 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 1024000-2048000:2048 -R 4095-2048000 -T 1 gf-large-gs-$$
+growfiles -W gf26 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 128-32768:128 -R 512-64000 -T 4 gfsmallio-$$
+growfiles -W gf27 -b -D 0 -w -g 8b -C 1 -b -i 1000 -u gfsparse-1-$$
+growfiles -W gf28 -b -D 0 -w -g 16b -C 1 -b -i 1000 -u gfsparse-2-$$
+growfiles -W gf29 -b -D 0 -r 1-4096 -R 0-33554432 -i 0 -L 60 -C 1 -u gfsparse-3-$$
+growfiles -W gf30 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -o O_RDWR,O_CREAT,O_SYNC -g 20480 -T 10 -t 20480 gf-sync-$$
+rwtest -N rwtest01 -c -q -i 60s -f sync 10%25000:rw-sync-$$
+rwtest -N rwtest02 -c -q -i 60s -f buffered 10%25000:rw-buffered-$$
+rwtest -N rwtest03 -c -q -i 60s -n 2 -f buffered -s mmread,mmwrite -m random -Dv 10%25000:mm-buff-$$
+rwtest -N rwtest04 -c -q -i 60s -n 2 -f sync -s mmread,mmwrite -m random -Dv 10%25000:mm-sync-$$
+rwtest -N rwtest05 -c -q -i 50 -T 64b 500b:rwtest01%f
+rwtest -N iogen01 -i 120s -s read,write -Da -Dv -n 2 500b:doio.f1.$$ 1000b:doio.f2.$$
+fs_inod . 10 10 1
+linktest.pl
+openfile -f10 -t10
+inode01
+inode02
+stream01
+stream02
+stream03
+stream04
+stream05
+ftest01
+ftest02
+ftest03
+ftest04
+ftest05
+ftest06
+ftest07
+ftest08
+lftest 80
+writetest
Index: ltp-full-20080731/testscripts/test_robind.sh
===================================================================
--- /dev/null
+++ ltp-full-20080731/testscripts/test_robind.sh
@@ -0,0 +1,264 @@
+#!/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
+#
+#*******************************************************************************
+# Readme_ROBind has more details on the tests running for ROBIND.
+# TEST:
+# NAME: test_robind.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
+# a) mounts on dir1,
+# b) mount --bind dir2
+# c) mount -o remount,ro
+# It verifies the tests on a) and b) works correctly.
+# For the c) option it checks that the tests are not able to write into dir.
+# Then it executes the tests from flat-file {LTPROOT}/testscripts/fs_ro_tests
+# Check the logs /tmp/fs$$/errs.log and /tmp/fs$$/pass.log for pass/failures.
+#===============================================================================
+#
+# CHANGE HISTORY:
+# DATE AUTHOR REASON
+# 09/06/2008 Veerendra Chandrappa For Container, testing of RO-Bind mount
+# Dave Hansen
+# This script is based on the Dave Hansen script for testing the robind.
+#*******************************************************************************
+
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=${TCID:-test_robind.sh}
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+usage()
+{
+ cat << EOF
+ usage: $0 [ext3,ext2,jfs,xfs,reiserfs,ramfs]
+
+ This script verifies ReadOnly-filesystem, by mounting imagefile and
+ executing the filesystem tests.
+
+ OPTIONS
+ -h display this message and exit
+EOF
+}
+
+DIRS="dir1 dir2-bound dir3-ro"
+TMPDIR=/tmp/fs$$
+trap cleanup ERR
+trap cleanup INT
+
+#==============================================================================
+# 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 2> /dev/null > /dev/null
+ umount ${TMPDIR}/dir2-bound 2> /dev/null 1> /dev/null
+ umount ${TMPDIR}/dir1 2> /dev/null 1> /dev/null
+ 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
+{
+ 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 "$*" ]; then
+ FSTYPES="ext3"
+ else
+ FSTYPES="$*"
+ fi
+
+ # set the LTPROOT directory
+ cd `dirname $0`
+ echo "${PWD}" | grep testscripts > /dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ cd ..
+ export LTPROOT="${PWD}"
+ export PATH="${PATH}:${LTPROOT}/testcases/bin"
+ fi
+
+ FS_Tests="${LTPROOT}/testscripts/fs_ro_tests"
+ cd ${TMPDIR}
+}
+
+#=============================================================================
+# FUNCTION NAME: testdir
+#
+# FUNCTION DESCRIPTION: The core function where it runs the tests
+#
+# PARAMETERS: dir_name, file_systems, Read_only flag = [true|false]
+#
+# RETURNS: None.
+#=============================================================================
+function testdir
+{
+ dir=$1
+ fs=$2
+ RO=$3
+ pushd $dir
+ testnums=`wc -l $FS_Tests | cut -f1 -d" "`
+ status=0
+
+ 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 ;
+
+ export TDIRECTORY=$PWD ;
+ echo TDIR is $TDIRECTORY;
+ if [ $RO == false ] ; then # Testing Read-Write dir
+ for tests in `seq $testnums` ; do
+ cmd=`cat $FS_Tests | head -$tests | tail -1`
+# eval $cmd 2>&1 /dev/null
+ eval $cmd 2> /dev/null 1> /dev/null
+ if [ $? -eq 0 ]; then
+ echo "$tests. '$cmd' PASS" >> $PASSLOG
+ else
+ echo "$tests. '$cmd' FAIL " >> $FAILLOG
+ echo "TDIR is $TDIRECTORY" >> $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 2> /dev/null 1> /dev/null
+ if [ $? -ne 0 ]; then
+ echo "$tests. '$cmd' PASS " >> $PASSLOG
+ else
+ echo "$tests. '$cmd' FAIL" >> $FAILLOG
+ status=1
+ fi
+ done
+ fi
+ if [ $status == 1 ] ; then
+ echo "RO-FileSystem Tests FAILED for $dir $fs filesystem" >> $FAILLOG
+ echo >> $FAILLOG
+ retcode=$status
+ else
+ echo "RO-FileSystem Tests PASSed for $dir $fs filesystem" >> $PASSLOG
+ echo >> $PASSLOG
+ fi
+ # Remove all the temp-files created.
+ eval rm -rf ${TMPDIR}/${dir}/* > /dev/null 2>&1 /dev/null || true
+ unset TDIRECTORY
+ popd
+}
+
+#=============================================================================
+# MAIN
+# See the description, purpose, and design of this test under TEST
+# in this test's prolog.
+#=============================================================================
+while getopts h: OPTION; do
+ case $OPTION in
+ h)
+ usage
+ exit 1
+ ;;
+ ?)
+ usage
+ exit 1
+ ;;
+ esac
+done
+# Does the initial setups
+oldpwd=${PWD}
+setup $*
+
+# 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 2> /dev/null 1> /dev/null
+ if [ $? -ne 0 ] ; then
+ tst_resm, TFAIL "Unable to create image "
+ tst_resm, TFAIL "Free Disk space of 512MB is required in /tmp fs"
+ tst_resm, TFAIL "Please free it and rerun thank you.."
+ rm -f $image
+ exit -1
+ fi
+
+ 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 2> /dev/null 1> /dev/null
+ fi
+
+ mount -t $fstype -o loop $image dir1
+ mount --bind dir1 dir2-bound || exit -1
+ mount --bind dir1 dir3-ro || exit -1
+ mount -o remount,ro dir3-ro || exit -1
+
+ testdir dir1 $fstype false
+ testdir dir2-bound $fstype false
+ testdir dir3-ro $fstype true
+ cleanup $image
+done
+
+ for i in $DIRS; do
+ rm -rf ./$i || true
+ done;
+ cd $oldpwd || true
+ exit $retcode
+
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list