public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: chrubis@suse.cz
To: Ramesh <rameshyr@linux.vnet.ibm.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] syscalls/mount0* and inotify03 tests are getting skipped from runltp
Date: Thu, 4 Apr 2013 13:59:18 +0200	[thread overview]
Message-ID: <20130404115918.GA7321@rei.suse.cz> (raw)
In-Reply-To: <515C5D28.3050604@linux.vnet.ibm.com>

Hi!
>   ltp-full-20130109/runltp |   48 
> ++++++++++++++++++++++++++++++++++++++++++---
>   1 files changed, 44 insertions(+), 4 deletions(-)
> 
> diff --git a/ltp-full-20130109/runltp b/ltp-full-20130109/runltp
> index 04cc690..f0f0c95 100755
> --- a/ltp-full-20130109/runltp
> +++ b/ltp-full-20130109/runltp
> @@ -681,13 +681,20 @@ 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 "remove test cases which require the block device."
> +        echo "You can specify it with option -b"
> +        sed -i "/DEVICE/d"  ${TMP}/alltests

We should update the message here a little to let the user know that

1) no device was speficied on command line

2) the loopback device could not be created

3) tests that needs the device are disabled

> +        RC=$?
>       fi
> 
> -    if [ $? -ne 0 ]; then
> +    if [ $RC -ne 0 ]; then
>               echo "FATAL: error during prcessing alltests file by sed"
                                           ^
              Could you please also fix this typo

>               exit 1
>       fi
> @@ -971,8 +978,41 @@ main()
>       exit $VALUE
>   }
> 
> +create_block()
> +{
> +    #create a block device with ext4 filesystem.
> +    dd if=/dev/zero of=${TMP}/test.img bs=10 count=10MB &>/dev/null

Still not right, this will create roughly 100MB file (the count and
the block size get multiplied). The correct one for 10MB would be:

dd if=/dev/zero of=${TMP}/test.img bs=1kB count=10240

(the 1kB blocks are about the optimal size for write and we request
 10240 of them)

> +    if [ $? -ne 0 ]; then
> +        echo "Please check for disk space and re-run"

Please be more verbose here about what has gone wrong. Something like:

"Failed to create loopback device image, plese 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
> +                ##format the block dev with ext3 filesystem.
> +                mkfs.ext4 $LOOP_DEV &>/dev/null

The comment here disagrees with the actual code, i.e. ext3 vs ext4.

I would just remove it as it's pretty clear what the line does without
it.

And you should check the return value from the mkfs just in case.

> +                #set the values in alltests which require block device.
> +                DEVICE=$LOOP_DEV
> +                DEVICE_FS_TYPE="ext4"
> +                return 0
> +            fi
> +        fi
> +    fi
> +}
> +
>   cleanup()
>   {
> +    [ -e "${TEMP}/test.img" ] && rm -f ${TEMP}/test.img
> +    [ "$LOOP_DEV" ] && losetup -d $LOOP_DEV
>       rm -rf ${TMP}
>   }

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

      parent reply	other threads:[~2013-04-04 11:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-26 17:55 [LTP] syscalls/mount0* and inotify03 tests are getting skipped from runltp Ramesh
2013-03-26 19:47 ` chrubis
     [not found]   ` <51529266.2080906@linux.vnet.ibm.com>
2013-03-27 10:28     ` chrubis
     [not found]       ` <515C133C.6030803@linux.vnet.ibm.com>
2013-04-03 11:47         ` chrubis
     [not found]           ` <515C5D28.3050604@linux.vnet.ibm.com>
2013-04-04 11:59             ` chrubis [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130404115918.GA7321@rei.suse.cz \
    --to=chrubis@suse.cz \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=rameshyr@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox