On Wed, Oct 14, 2009 at 12:31 PM, Garrett Cooper <[email protected]> wrote:
> This proposed change makes linktest.pl into linktest.sh, to avoid
> missing coverage with symlinks and hardlinks due to a lacking perl
> dependency on the target host.
>
> This change has been outstanding for some time in our private copy of
> LTP and needed to get checked into CVS.
>
> //edit[1]: Incorporate comments made by Mike F.
>
> Signed-off-by: Garrett Cooper <[email protected]>
>
> diff --exclude '*CVS*' -NaurP ./runtest/fs ../ltp.bk/runtest/fs
> --- ./runtest/fs        2009-10-12 22:06:10.000000000 -0700
> +++ ../ltp.bk/runtest/fs        2009-10-12 22:09:12.000000000 -0700
> @@ -40,7 +40,7 @@
>  iogen01 export LTPROOT; rwtest.sh -N iogen01 -i 120s -s read,write
> -Da -Dv -n 2 500b:doio.f1.$$ 1000b:doio.f2.$$
>
>  fs_inod01 fs_inod $TMP 10 10 10
> -linker01 linktest.sh 1000 1000
> +linker01 linktest.pl 1000 1000
>  openfile01 openfile -f10 -t10
>  inode01 inode01
>  inode02 inode02
> diff --exclude '*CVS*' -NaurP ./runtest/stress.part1
> ../ltp.bk/runtest/stress.part1
> --- ./runtest/stress.part1      2009-10-12 22:06:15.000000000 -0700
> +++ ../ltp.bk/runtest/stress.part1      2009-10-12 22:09:12.000000000 -0700
> @@ -156,7 +156,7 @@
>  iogen01 export LTPROOT; rwtest.sh -N iogen01 -i 120s -s read,write
> -Da -Dv -n 2 500b:doio.f1.$$ 1000b:doio.f2.$$
>
>  fs_inod01 fs_inod $TMP 10 10 1
> -linker01 linktest.sh
> +linker01 linktest.pl
>  openfile01 openfile -f10 -t10
>  inode01 inode01
>  inode02 inode02
> diff --exclude '*CVS*' -NaurP
> ./testcases/kernel/fs/linktest/linktest.pl
> ../ltp.bk/testcases/kernel/fs/linktest/linktest.pl
> --- ./testcases/kernel/fs/linktest/linktest.pl  1969-12-31
> 16:00:00.000000000 -0800
> +++ ../ltp.bk/testcases/kernel/fs/linktest/linktest.pl  2009-10-12
> 22:18:49.000000000 -0700
> @@ -0,0 +1,89 @@
> +#!/usr/bin/perl
> +
> +#   Copyright (c) International Business Machines  Corp., 2000
> +#
> +#   This program is free software;  you can redistribute it and/or modify
> +#   it under the terms of the GNU General Public License as published by
> +#   the Free Software Foundation; either version 2 of the License, or
> +#   (at your option) any later version.
> +#
> +#   This program is distributed in the hope that it will be useful,
> +#   but WITHOUT ANY WARRANTY;  without even the implied warranty of
> +#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
> +#   the GNU General Public License 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> +
> +
> +#
> +#  FILE(s)     : linktest.pl README
> +#  DESCRIPTION : Regression test for max links per file
> +#  USE         : linktest.pl <number of symlinks> <number of hardlinks>
> +#  AUTHOR      : Jeff Martin ([email protected])
> +#  HISTORY     :
> +#     (05/07/01)v.99  Needed a quick script to test a hardlink
> limitation that was found.
> +#     (28/07/08) Veerendra C <[email protected]>
> +#                     Modified to return proper return code on
> failure/success.
> +#                     Also modified to return errors if unable to
> create dir/files
> +
> +$ret = 0;
> +if ( system("mkdir hlink") ) {
> +     $ret = -1 ;
> +}
> +
> +if ( system("mkdir slink") ) {
> +     $ret = -1 ;
> +}
> +
> +if ( system("touch hlink/hfile") ) {
> +     $ret = -1 ;
> +}
> +
> +if ( system("touch slink/sfile") ) {
> +     $ret = -1 ;
> +}
> +
> +if ( $ret == -1 ) {
> +    printf ("Error %d: Not able to create dir/file's\n " , $ret);
> +    exit -1;
> +}
> +
> +$scount=shift @ARGV;
> +chdir "slink";
> +for($x=0;$x<$scount;$x++) {
> +   $result=symlink("sfile","sfile$x");
> +   if(!$result) {
> +      $serrors++;
> +      }
> +   }
> +chdir "..";
> +$hcount=shift @ARGV;
> +for($x=0;$x<$hcount;$x++) {
> +   $result=link("hlink/hfile","hlink/hfile$x");
> +   if(!$result) {
> +      $herrors++;
> +      }
> +   }
> +
> +if($herrors) {
> +    printf ("linker01 : FAIL Hard Link Errors = %d\n", $herrors);
> +    $ret = -1
> +}
> +else {
> +    printf ("linker01 : HardLink Test PASS\n" )
> +}
> +if($serrors) {
> +    printf ("linker01 : FAIL Soft Link Errors = %d\n", $serrors);
> +    $ret = -1
> +}
> +else {
> +    printf ("linker01 : SoftLink Test PASS\n" );
> +}
> +
> +unlink <hlink/hfile*>;
> +unlink <slink/sfile*>;
> +rmdir hlink;
> +rmdir slink;
> +exit $ret;
> diff --exclude '*CVS*' -NaurP
> ./testcases/kernel/fs/linktest/linktest.sh
> ../ltp.bk/testcases/kernel/fs/linktest/linktest.sh
> --- ./testcases/kernel/fs/linktest/linktest.sh  2009-10-14
> 12:27:10.000000000 -0700
> +++ ../ltp.bk/testcases/kernel/fs/linktest/linktest.sh  1969-12-31
> 16:00:00.000000000 -0800
> @@ -1,76 +0,0 @@
> -#!/bin/sh
> -
> -#   Copyright (c) International Business Machines  Corp., 2000
> -#
> -#   This program is free software;  you can redistribute it and/or modify
> -#   it under the terms of the GNU General Public License as published by
> -#   the Free Software Foundation; either version 2 of the License, or
> -#   (at your option) any later version.
> -#
> -#   This program is distributed in the hope that it will be useful,
> -#   but WITHOUT ANY WARRANTY;  without even the implied warranty of
> -#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
> -#   the GNU General Public License 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> -
> -
> -#
> -#  FILE(s)     : linktest.sh README
> -#  DESCRIPTION : Regression test for max links per file
> -#  USE         : linktest.sh <number of symlinks> <number of hardlinks>
> -#  AUTHOR      : Garrett Cooper ([email protected])
> -#  HISTORY     :
> -#      A rewrite of testcases/kernel/fs/linktest.pl
> -
> -# XXX: Change to a temp dir via mktemp -d.
> -cd "${0%/*}"
> -
> -export TCID=linker01
> -export TST_TOTAL=2
> -export TST_COUNT=1
> -
> -if [ $# -ne 2 ]; then
> -       tst_res TBROK "" "Usage: $0 {softlink count} {hardlink count}"
> -       exit -1
> -fi
> -
> -mkdir hlink slink && touch hlink/hfile slink/sfile
> -
> -do_link() {
> -       pfix=$1
> -       ln_opts=$2
> -       limit=$3
> -       prefix_msg=$4
> -
> -       lerrors=0
> -
> -       i=0
> -
> -       cd ${pfix}link
> -       while [ $i -lt $limit ]; do
> -               if ! ln ${ln_opts} "$PWD/${pfix}file" ${pfix}file${i}; then
> -                       : $(( lerrors += 1 ))
> -               fi
> -               : $(( i+= 1 ))
> -       done
> -       cd ..
> -
> -       if [ $lerrors -eq 0 ]; then
> -               RTYPE=TPASS
> -       else
> -               RTYPE=TFAIL
> -       fi
> -
> -       tst_res $RTYPE "" "$prefix_msg Link Errors: $lerrors"
> -
> -       : $(( TST_COUNT += 1 ))
> -
> -}
> -
> -do_link s "-s" ${1} "Symbolic"
> -do_link h   "" ${2} "Hard"
> -
> -rm -Rf hlink slink
> diff --exclude '*CVS*' -NaurP ./testcases/kernel/fs/linktest/Makefile
> ../ltp.bk/testcases/kernel/fs/linktest/Makefile
> --- ./testcases/kernel/fs/linktest/Makefile     2009-10-12 22:05:06.000000000 
> -0700
> +++ ../ltp.bk/testcases/kernel/fs/linktest/Makefile     2009-10-12
> 22:09:13.000000000 -0700
> @@ -24,6 +24,6 @@
>
>  include $(top_srcdir)/include/mk/env_pre.mk
>
> -INSTALL_TARGETS                        := linktest.sh
> +INSTALL_TARGETS                        := linktest.pl
>
>  include $(top_srcdir)/include/mk/generic_leaf_target.mk

Sorry -- the patch was reversed... the version checked into CVS just
now is correct of course :)...
Thanks,
-Garrett

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to