Skip to content

Commit

Permalink
runltp: add -z, -Z options and change device symbol in runtest files
Browse files Browse the repository at this point in the history
Add two options -z and -Z for runltp, to allow user specify big block
device for some tests, such as fs_ext4(ext4 new features tests).

We abandon the old way of assigning specific device in runltp like that
"sed -i 's|DEVICE|$DEVICE|'  ${TMP}/alltests". Now we use shell
variables directly in runtest files.

runltp will export four shell variables to indicate devices.
    LTP_DEV:     small block device(the original DEVICE).
    LTP_BIG_DEV: big block device. if user doesn't specify it,
                 LTP_BIG_DEV will be empty
    LTP_DEV_FS_TYPE: default ext2
    LTP_BIG_DEV_FS_TYPE: default ext2

Signed-off-by: Xiaoguang Wang <[email protected]>
Signed-off-by: Cyril Hrubis <[email protected]>
  • Loading branch information
wangxiaoguang authored and metan-ucw committed Jan 30, 2014
1 parent 6d78baf commit 5b42a1e
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 52 deletions.
58 changes: 30 additions & 28 deletions runltp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ setup()
export TMPBASE="/tmp"
export PATH="${PATH}:${LTPROOT}/testcases/bin"

export LTP_DEV=""
export LTP_BIG_DEV=""
export LTP_DEV_FS_TYPE="ext2"
export LTP_BIG_DEV_FS_TYPE="ext2"

[ -d "$LTPROOT/testcases/bin" ] ||
{
echo "FATAL: LTP not installed correctly"
Expand Down Expand Up @@ -109,8 +114,8 @@ usage()
[ -D NUM_PROCS,NUM_FILES,NUM_BYTES,CLEAN_FLAG ] -e [ -f CMDFILES(,...) ] [ -g HTMLFILE]
[ -i NUM_PROCS ] [ -l LOGFILE ] [ -m NUM_PROCS,CHUNKS,BYTES,HANGUP_FLAG ]
-N -n [ -o OUTPUTFILE ] -p -q [ -r LTPROOT ] [ -s PATTERN ] [ -t DURATION ]
-v [ -w CMDFILEADDR ] [ -x INSTANCES ] [ -b DEVICE ] [-B DEVICE_FS_TYPE]
[ -F LOOPS,PERCENTAGE ]
-v [ -w CMDFILEADDR ] [ -x INSTANCES ] [ -b DEVICE ] [-B LTP_DEV_FS_TYPE]
[ -F LOOPS,PERCENTAGE ] [ -z BIG_DEVICE ] [-Z LTP_BIG_DEV_FS_TYPE]
-a EMAIL_TO EMAIL all your Reports to this E-mail Address
-c NUM_PROCS Run LTP under additional background CPU load
Expand Down Expand Up @@ -162,7 +167,11 @@ usage()
-x INSTANCES Run multiple instances of this testsuite.
-b DEVICE Some tests require an unmounted block device
to run correctly.
-B DEVICE_FS_TYPE The file system of test block devices.
-B LTP_DEV_FS_TYPE The file system of test block devices.
-z BIG_DEVICE Some tests require a big unmounted block device
to run correctly.
-Z LTP_BIG_DEV_FS_TYPE The file system of the big device
example: ${0##*/} -c 2 -i 2 -m 2,4,10240,1 -D 2,10,10240,1 -p -q -l /tmp/result-log.$$ -o /tmp/result-output.$$ -C /tmp/result-failed.$$ -d ${PWD}
Expand Down Expand Up @@ -206,12 +215,11 @@ main()
local TAG_RESTRICT_STRING=""
local PAN_COMMAND=""
local DEFAULT_FILE_NAME_GENERATION_TIME=`date +"%Y_%b_%d-%Hh_%Mm_%Ss"`
local DEVICE_FS_TYPE="ext2"
local scenfile=

version_date=$(cat "$LTPROOT/Version")

while getopts a:c:C:d:D:f:F:ehi:K:g:l:m:M:Nno:pqr:s:S:t:T:w:x:b:B: arg
while getopts a:c:C:d:D:f:F:ehi:K:g:l:m:M:Nno:pqr:s:S:t:T:w:x:b:B:z:Z: arg
do case $arg in
a) EMAIL_TO=$OPTARG
ALT_EMAIL_OUT=1;;
Expand Down Expand Up @@ -423,7 +431,9 @@ main()
sleep 10
INSTANCES="-x $OPTARG";;
b) DEVICE=$OPTARG;;
B) DEVICE_FS_TYPE=$OPTARG;;
B) LTP_DEV_FS_TYPE=$OPTARG;;
z) BIG_DEVICE=$OPTARG;;
Z) LTP_BIG_DEV_FS_TYPE=$OPTARG;;
\?) usage;;
esac
done
Expand Down Expand Up @@ -677,36 +687,28 @@ main()
}
}

if [ -n "$DEVICE" ]; then
sed -i "s|DEVICE|$DEVICE|" ${TMP}/alltests
RC=$?
else
if [ -z "$DEVICE" ]; then
create_block
if [ $? -eq 0 ]; then
sed -i "s|DEVICE|$DEVICE|" ${TMP}/alltests
RC=$?
else
if [ $? -ne 0 ]; then
echo "no block device was specified on commandline."
echo "Block device could not be created using loopback device"
echo "Tests which require block device are disabled."
echo "You can specify it with option -b"
sed -i "/DEVICE/d" ${TMP}/alltests
RC=$?
else
LTP_DEV=$DEVICE
fi
else
LTP_DEV=$DEVICE
fi

if [ $RC -ne 0 ]; then
echo "FATAL: error during processing alltests file by sed"
exit 1
fi

if [ -n "$DEVICE" ]; then
sed -i "s|DEVICE_FS_TYPE|$DEVICE_FS_TYPE|" ${TMP}/alltests
fi

if [ $? -ne 0 ]; then
echo "FATAL: error during processing alltests file by sed"
exit 1
# here even if the user don't specify a big block device, we
# also don't create the big block device.
if [ -z "$BIG_DEVICE" ]; then
echo "no big block device was specified on commandline."
echo "Tests which require a big block device are disabled."
echo "You can specify it with option -z"
else
LTP_BIG_DEV=$BIG_DEVICE
fi

if [ $RUN_REPEATED -gt 1 ]; then # You need to specify at least more than 1 sequential run, else it runs default
Expand Down
8 changes: 4 additions & 4 deletions runtest/ltplite
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ access02 access02
access03 access03
access04 access04
access05 access05
access06 access06 -D DEVICE -T DEVICE_FS_TYPE
access06 access06 -D $LTP_DEV -T $LTP_DEV_FS_TYPE

acct01 acct01 -D DEVICE -T DEVICE_FS_TYPE
acct01 acct01 -D $LTP_DEV -T $LTP_DEV_FS_TYPE

adjtimex01 adjtimex01
adjtimex02 adjtimex02
Expand Down Expand Up @@ -111,7 +111,7 @@ chmod07 chmod07
chown01 chown01
chown02 chown02
chown03 export change_owner=$LTPROOT/testcases/bin/change_owner;chown03
chown04 cp -p $LTPROOT/testcases/bin/change_owner $TMPDIR;chown04 -D DEVICE -T DEVICE_FS_TYPE
chown04 cp -p $LTPROOT/testcases/bin/change_owner $TMPDIR;chown04 -D $LTP_DEV -T $LTP_DEV_FS_TYPE
chown05 chown05

chroot01 chroot01
Expand Down Expand Up @@ -184,7 +184,7 @@ fchmod02 fchmod02
fchmod03 fchmod03
fchmod04 fchmod04
fchmod05 cp -p $LTPROOT/testcases/bin/change_owner $TMPDIR;fchmod05
fchmod06 cp -p $LTPROOT/testcases/bin/change_owner $TMPDIR;fchmod06 -D DEVICE -T DEVICE_FS_TYPE
fchmod06 cp -p $LTPROOT/testcases/bin/change_owner $TMPDIR;fchmod06 -D $LTP_DEV -T $LTP_DEV_FS_TYPE
fchmod07 fchmod07

fchown01 fchown01
Expand Down
8 changes: 4 additions & 4 deletions runtest/stress.part3
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ access02 access02
access03 access03
access04 access04
access05 access05
access06 access06 -D DEVICE -T DEVICE_FS_TYPE
access06 access06 -D $LTP_DEV -T $LTP_DEV_FS_TYPE

acct01 acct01 -D DEVICE -T DEVICE_FS_TYPE
acct01 acct01 -D $LTP_DEV -T $LTP_DEV_FS_TYPE

adjtimex01 adjtimex01
adjtimex02 adjtimex02
Expand Down Expand Up @@ -53,7 +53,7 @@ chmod07 chmod07
chown01 chown01
chown02 chown02
chown03 export change_owner=$LTPROOT/testcases/bin/change_owner;chown03
chown04 cp -p $LTPROOT/testcases/bin/change_owner $TMPDIR;chown04 -D DEVICE -T DEVICE_FS_TYPE
chown04 cp -p $LTPROOT/testcases/bin/change_owner $TMPDIR;chown04 -D $LTP_DEV -T $LTP_DEV_FS_TYPE
chown05 chown05

chroot01 chroot01
Expand Down Expand Up @@ -125,7 +125,7 @@ fchmod02 fchmod02
fchmod03 fchmod03
fchmod04 fchmod04
fchmod05 cp -p $LTPROOT/testcases/bin/change_owner $TMPDIR;fchmod05
fchmod06 cp -p $LTPROOT/testcases/bin/change_owner $TMPDIR;fchmod06 -D DEVICE -T DEVICE_FS_TYPE
fchmod06 cp -p $LTPROOT/testcases/bin/change_owner $TMPDIR;fchmod06 -D $LTP_DEV -T $LTP_DEV_FS_TYPE
fchmod07 fchmod07

fchown01 fchown01
Expand Down
32 changes: 16 additions & 16 deletions runtest/syscalls
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ access02 access02
access03 access03
access04 access04
access05 access05
access06 access06 -D DEVICE -T DEVICE_FS_TYPE
access06 access06 -D $LTP_DEV -T $LTP_DEV_FS_TYPE

acct01 acct01 -D DEVICE -T DEVICE_FS_TYPE
acct01 acct01 -D $LTP_DEV -T $LTP_DEV_FS_TYPE

add_key01 add_key01
add_key02 add_key02
Expand Down Expand Up @@ -55,7 +55,7 @@ chmod02 chmod02
chmod03 chmod03
chmod04 chmod04
chmod05 chmod05
chmod06 chmod06 -D DEVICE -T DEVICE_FS_TYPE
chmod06 chmod06 -D $LTP_DEV -T $LTP_DEV_FS_TYPE
chmod07 chmod07

chown01 chown01
Expand All @@ -64,8 +64,8 @@ chown02 chown02
chown02_16 chown02_16
chown03 chown03
chown03_16 chown03_16
chown04 chown04 -D DEVICE -T DEVICE_FS_TYPE
chown04_16 chown04_16 -D DEVICE -T DEVICE_FS_TYPE
chown04 chown04 -D $LTP_DEV -T $LTP_DEV_FS_TYPE
chown04_16 chown04_16 -D $LTP_DEV -T $LTP_DEV_FS_TYPE
chown05 chown05
chown05_16 chown05_16

Expand Down Expand Up @@ -174,7 +174,7 @@ fchmod02 fchmod02
fchmod03 fchmod03
fchmod04 fchmod04
fchmod05 fchmod05
fchmod06 fchmod06 -D DEVICE -T DEVICE_FS_TYPE
fchmod06 fchmod06 -D $LTP_DEV -T $LTP_DEV_FS_TYPE
fchmod07 fchmod07

#fchmodat test cases
Expand Down Expand Up @@ -437,7 +437,7 @@ inotify_init1_02 inotify_init1_02

inotify01 inotify01
inotify02 inotify02
inotify03 inotify03 -D DEVICE -T DEVICE_FS_TYPE
inotify03 inotify03 -D $LTP_DEV -T $LTP_DEV_FS_TYPE
inotify04 inotify04

fanotify01 fanotify01
Expand Down Expand Up @@ -582,12 +582,12 @@ modify_ldt02 modify_ldt02
# to run correctly. Please see individual test
# code for more information.
#
mount01 mount01 -D DEVICE -T DEVICE_FS_TYPE
mount02 mount02 -D DEVICE -T DEVICE_FS_TYPE
mount03 mount03 -D DEVICE -T DEVICE_FS_TYPE
mount04 mount04 -D DEVICE -T DEVICE_FS_TYPE
mount01 mount01 -D $LTP_DEV -T $LTP_DEV_FS_TYPE
mount02 mount02 -D $LTP_DEV -T $LTP_DEV_FS_TYPE
mount03 mount03 -D $LTP_DEV -T $LTP_DEV_FS_TYPE
mount04 mount04 -D $LTP_DEV -T $LTP_DEV_FS_TYPE
mount05 mount05
mount06 mount06 -D DEVICE -T DEVICE_FS_TYPE
mount06 mount06 -D $LTP_DEV -T $LTP_DEV_FS_TYPE

move_pages01 move_pages.sh 01
move_pages02 move_pages.sh 02
Expand Down Expand Up @@ -777,7 +777,7 @@ pwrite03_64 pwrite03_64
pwrite04_64 pwrite04_64

quotactl01 quotactl01
quotactl02 quotactl02 -D DEVICE
quotactl02 quotactl02 -D $LTP_DEV

read01 read01
read02 read02
Expand Down Expand Up @@ -1270,9 +1270,9 @@ unshare02 unshare02
# to run correctly. Please see individual test
# code for more information.
#
umount01 umount01 -D DEVICE -T DEVICE_FS_TYPE
umount02 umount02 -D DEVICE -T DEVICE_FS_TYPE
umount03 umount03 -D DEVICE -T DEVICE_FS_TYPE
umount01 umount01 -D $LTP_DEV -T $LTP_DEV_FS_TYPE
umount02 umount02 -D $LTP_DEV -T $LTP_DEV_FS_TYPE
umount03 umount03 -D $LTP_DEV -T $LTP_DEV_FS_TYPE

ustat01 ustat01
ustat02 ustat02
Expand Down

0 comments on commit 5b42a1e

Please sign in to comment.