On 03/27/2013 03:58 PM, [email protected] wrote:
> Hi!
>>> The runtest files are processed before they are executed. See -b DEVICE and
>>> -B DEVICE_FS_TYPE runltp parameters.
>>>
>>> The current runltp script is more of the hack than solution. I've send a
>>> RFC email with a description of planned successor to the LTP mailing
>>> list not that long ago (but I haven't started writing the code yet).
>>
>> Thanks Cyril !
>>
>> I got it from runltp --usage, then I tried to execute the tests by passing
>> -b DEVICE and -B DEVICE_FS_TYPE to runltp but it failed with the below
>> error,
>>
>> ---
>> sed: can't read : No such file or directory
>> FATAL: error during processing alltests file by sed
>> ---
>>
>> I went through the runltp script to see the cause for this error and
>> found that
>> the below substitution by sed leading to the error.
>>
>> >> sed -i "" -e "s|DEVICE_FS_TYPE|$DEVICE_FS_TYPE|" ${TMP}/alltests
>>
>> Here, I don't see any reason why the -e is used with sed as we are not
>> performing
>> sed operation on multiple expressions.
>>
>> I just removed -e option and ran the tests, tests were successfully
>> executed.
>>
>> <patch snippet>
>> --- runltp_org 2013-03-27 14:40:12.029836439 +0530
>> +++ runltp 2013-03-27 14:39:59.322856566 +0530
>> @@ -719,7 +719,7 @@ main()
>> fi
>>
>> if [ -n "$DEVICE" ]; then
>> - sed -i "" -e "s|DEVICE_FS_TYPE|$DEVICE_FS_TYPE|" ${TMP}/alltests
>> + sed -i "s|DEVICE_FS_TYPE|$DEVICE_FS_TYPE|" ${TMP}/alltests
>> fi
>>
>> if [ $? -ne 0 ]; then
>>
>>
>>
>> Please le me know if the removal of -e is a better solution for the
>> issue or is it really
>> required for any other advantages.
>
> This has been fixed in 0b6c356437acfa2b4cf131a80a52a8407d096fac (about
> ten months ago).
>
> If you runned into this bug you are not using latest release. You really
> should use the latest release otherwise you will find more bugs that
> were fixed meanwhile.
>
Hi,
I would like to share a work around which I have tried to make the tests
to run
by default when -b and -B arguments are not specified.Please share your
thoughts
on this and also let me know if there is any disadvantage in using a
loop device
as I have made use of it in my changes. Also, suggest me an alternate
way to use
this work around if the changes in runltp is not a better idea.
Here is the work around that I tried,
+++ runltp 2013-04-02 16:42:47.836836402 +0530
@@ -681,17 +681,43 @@ 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 a block device with ext4 filesystem.
+ dd if=/dev/zero of=${TMP}/test.img bs=1 count=10MB &>/dev/null
+ if [ $? -ne 0 ]; then
+ echo "Please check for disk space and re-run"
+ exit 1
+ else
+ ##search for an unused loop dev
+ LOOP_DEV=$(losetup -f)
+ if [ $? -ne 0 ]; then
+ echo "no unused loop device is found"
+ exit 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"
+ exit 1
+ else
+ ##format the block dev with ext4 filesystem.
+ mkfs.ext4 $LOOP_DEV &>/dev/null
+ #set the values in alltests which require block device.
+ DEVICE=$LOOP_DEV
+ DEVICE_FS_TYPE="ext4"
+ sed -i "s|DEVICE|$DEVICE|" ${TMP}/alltests
+ RC=$?
+ fi
+ fi
+ fi
fi
- if [ $? -ne 0 ]; then
+ if [ $RC -ne 0 ]; then
echo "FATAL: error during prcessing alltests file by sed"
exit 1
fi
-
+
if [ -n "$DEVICE" ]; then
mnt_pnt=`mktemp -d "${TMP}/mnt_pnt.XXXXXX"`
if [ -n "$DEVICE_FS_TYPE" ]; then
@@ -973,6 +999,8 @@ main()
cleanup()
{
+ [ -e "${TMP}/test.img" ] && rm -f ${TMP}/test.img
+ [ "$LOOP_DEV" ] && losetup -d $LOOP_DEV
rm -rf ${TMP}
}
Regards,
Ramesh
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list