From: Cyril H. <su...@li...> - 2013-04-16 02:21:34
|
The branch, master, has been updated via 0a78f236117172701a248e3e1570c26a8b41d2d8 (commit) from c023535ade2b6ae89745cf0d361cd1108b0fd796 (commit) - Log ----------------------------------------------------------------- commit 0a78f236117172701a248e3e1570c26a8b41d2d8 Author: Ramesh YR <ram...@li...> Date: Tue Apr 16 09:31:28 2013 +0800 runltp: syscalls/mount0* and inotify03 tests are getting skipped from runltp's execution Some of the tests which require a block device for their execution are skipped when runltp is run without any block device being specified on commandline.Most of such tests are from syscalls group and as a work around to make these tests run even when no block device is specified,I have made use of loopback device to create a block device with ext4 filesystem. So,runltp is modified to create a block device and set the values for DEVICE and DEVICE_FS_TYPE accordingly. Following are the skipped tests: inotify03 inotify03 -D DEVICE -T DEVICE_FS_TYPE 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 umount01 umount01 -D DEVICE -T DEVICE_FS_TYPE umount02 umount02 -D DEVICE -T DEVICE_FS_TYPE umount03 umount03 -D DEVICE -T DEVICE_FS_TYPE Signed-off-by: Ramesh YR <ram...@li...> Signed-off-by: Wanlong Gao <gao...@cn...> ----------------------------------------------------------------------- Summary of changes: runltp | 53 ++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 48 insertions(+), 5 deletions(-) diff --git a/runltp b/runltp index 04cc690..a8bf404 100755 --- a/runltp +++ b/runltp @@ -681,14 +681,24 @@ main() if [ -n "$DEVICE" ]; then sed -i "s|DEVICE|$DEVICE|" ${TMP}/alltests + RC=$? else - echo "remove test cases which require the block device." - echo "You can specify it with option -b" - sed -i "/DEVICE/d" ${TMP}/alltests + create_block + if [ $? -eq 0 ]; then + sed -i "s|DEVICE|$DEVICE|" ${TMP}/alltests + RC=$? + else + 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=$? + fi fi - if [ $? -ne 0 ]; then - echo "FATAL: error during prcessing alltests file by sed" + if [ $RC -ne 0 ]; then + echo "FATAL: error during processing alltests file by sed" exit 1 fi @@ -971,8 +981,41 @@ main() exit $VALUE } +create_block() +{ + #create a block device with ext4 filesystem. + dd if=/dev/zero of=${TMP}/test.img bs=1kB count=10240 &>/dev/null + if [ $? -ne 0 ]; then + echo "Failed to create loopback device image, please check disk space and re-run" + return 1 + else + ##search for an unused loop dev + LOOP_DEV=$(losetup -f) + if [ $? -ne 0 ]; then + echo "no unused loop device is found" + return 1 + else + ##attach the created file to loop dev. + losetup $LOOP_DEV ${TMP}/test.img &>/dev/null + if [ $? -ne 0 ]; then + echo "losetup failed to create block device" + return 1 + else + mkfs.ext4 $LOOP_DEV &>/dev/null + [ $? -ne 0 ] && (echo "creating a ext4 block device failed" && return 1) + #set the values in alltests which require block device. + DEVICE=$LOOP_DEV + DEVICE_FS_TYPE="ext4" + return 0 + fi + fi + fi +} + cleanup() { + [ "$LOOP_DEV" ] && losetup -d $LOOP_DEV + [ -e "${TEMP}/test.img" ] && rm -f ${TEMP}/test.img rm -rf ${TMP} } hooks/post-receive -- ltp |