Hi,

On 07/23/2014 09:34 AM, Zeng Linggang wrote:
> $? is not the expected value.
> Add test_ret to store the expected value of $?, fix it.
> 
>                 TMPDIR=mnt_point; fallocate0${i} | grep -q "CONF"
> +               test_ret=$?
>                 TMPDIR=$temp_tmpdir
> 
> -               if [ $? -ne $ret ]; then
> +               if [ $test_ret -ne $ret ]; then

Thanks for pointing this.
I also found a bug in tst_tmpdir.c, please see my next mail.
Now I think "grep -q CONF" is not enough, if fallocate[1-3] prints TBROK...
I would prefer this below fix, thanks!

--- 
a/testcases/kernel/fs/ext4-new-features/ext4-persist-prealloc/ext4_persist_prealloc_test.sh
+++ 
b/testcases/kernel/fs/ext4-new-features/ext4-persist-prealloc/ext4_persist_prealloc_test.sh
@@ -44,8 +44,6 @@ ext4_test_persist_prealloc()
                return
        fi
 
-       ret=1
-
        for ((i = 1; i <= 3; i++))
        {
                if ! command -v fallocate0${i} > /dev/null 2>&1; then
@@ -57,10 +55,11 @@ ext4_test_persist_prealloc()
                fi
 
                temp_tmpdir=$TMPDIR
-               TMPDIR=mnt_point; fallocate0${i} | grep -q "CONF"
+               TMPDIR=mnt_point; fallocate0${i} > /dev/null 2>&1
+               ret=$?
                TMPDIR=$temp_tmpdir
 
-               if [ $? -ne $ret ]; then
+               if [ $ret -ne 0 ]; then
                        tst_resm TFAIL "fallocate's return value is not 
expected"
                        umount mnt_point
                        return

Regards,
Xiaoguang Wnag
> 
> Signed-off-by: Zeng Linggang <zenglg...@cn.fujitsu.com>
> ---
>  .../ext4-persist-prealloc/ext4_persist_prealloc_test.sh            | 7 
> ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git 
> a/testcases/kernel/fs/ext4-new-features/ext4-persist-prealloc/ext4_persist_prealloc_test.sh
>  
> b/testcases/kernel/fs/ext4-new-features/ext4-persist-prealloc/ext4_persist_prealloc_test.sh
> index a6e3a2a..f066f9a 100755
> --- 
> a/testcases/kernel/fs/ext4-new-features/ext4-persist-prealloc/ext4_persist_prealloc_test.sh
> +++ 
> b/testcases/kernel/fs/ext4-new-features/ext4-persist-prealloc/ext4_persist_prealloc_test.sh
> @@ -15,8 +15,8 @@
>  ## 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA    ##
> +## along with this program;  if not, write to the Free Software Foundation,  
>  ##
> +## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA          
>  ##
>  ##                                                                           
>  ##
>  ## Author: Li Zefan <l...@cn.fujitsu.com>                                    
>  ##
>  ##         Miao Xie <mi...@cn.fujitsu.com>                                   
>  ##
> @@ -58,9 +58,10 @@ ext4_test_persist_prealloc()
>  
>               temp_tmpdir=$TMPDIR
>               TMPDIR=mnt_point; fallocate0${i} | grep -q "CONF"
> +             test_ret=$?
>               TMPDIR=$temp_tmpdir
>  
> -             if [ $? -ne $ret ]; then
> +             if [ $test_ret -ne $ret ]; then
>                       tst_resm TFAIL "fallocate's return value is not 
> expected"
>                       umount mnt_point
>                       return
> 


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to