public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] convert linktest.pl to linktest.sh
@ 2009-10-13  5:22 Garrett Cooper
  2009-10-13  5:30 ` Mike Frysinger
  0 siblings, 1 reply; 6+ messages in thread
From: Garrett Cooper @ 2009-10-13  5:22 UTC (permalink / raw)
  To: LTP list

[-- Attachment #1: Type: text/plain, Size: 6903 bytes --]

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.

Signed-off-by: Garrett Cooper <yanegomi@gmail.com>

diff -Naur --exclude '*CVS*' ../ltp.bk/runtest/fs ./runtest/fs
--- ../ltp.bk/runtest/fs        2009-10-12 22:09:12.000000000 -0700
+++ ./runtest/fs        2009-10-12 22:06:10.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.pl 1000 1000
+linker01 linktest.sh 1000 1000
 openfile01 openfile -f10 -t10
 inode01 inode01
 inode02 inode02
diff -Naur --exclude '*CVS*' ../ltp.bk/runtest/stress.part1
./runtest/stress.part1
--- ../ltp.bk/runtest/stress.part1      2009-10-12 22:09:12.000000000 -0700
+++ ./runtest/stress.part1      2009-10-12 22:06:15.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.pl
+linker01 linktest.sh
 openfile01 openfile -f10 -t10
 inode01 inode01
 inode02 inode02
diff -Naur --exclude '*CVS*'
../ltp.bk/testcases/kernel/fs/linktest/linktest.pl
./testcases/kernel/fs/linktest/linktest.pl
--- ../ltp.bk/testcases/kernel/fs/linktest/linktest.pl  2009-10-12
22:18:49.000000000 -0700
+++ ./testcases/kernel/fs/linktest/linktest.pl  1969-12-31
16:00:00.000000000 -0800
@@ -1,89 +0,0 @@
-#!/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 (martinjn@us.ibm.com)
-#  HISTORY     :
-#     (05/07/01)v.99  Needed a quick script to test a hardlink
limitation that was found.
-#     (28/07/08) Veerendra C <vechandr@in.ibm.com>
-#                     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;
--- ../ltp.bk/testcases/kernel/fs/linktest/linktest.sh  1969-12-31
16:00:00.000000000 -0800
+++ ./testcases/kernel/fs/linktest/linktest.sh  2009-10-12
22:15:26.000000000 -0700
@@ -0,0 +1,75 @@
+#!/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 (yanegomi@gmail.com)
+#  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; shift
+       ln_opts=$1; shift
+       limit=$1; shift
+
+       lerrors=0
+
+       i=0
+
+       cd ${pfix}link; \
+       while [ $i -lt $limit ]; do \
+               if ! ln ${ln_opts} "$PWD/${pfix}file" ${pfix}file${i}; then
+                       (( lerrors++ ))
+               fi
+               (( i++ ))
+       done
+       cd ..
+
+       if [ $lerrors -eq 0 ]; then
+               RTYPE=TPASS
+       else
+               RTYPE=TFAIL
+       fi
+
+       tst_res $RTYPE "" "$prefix_msg Link Errors: $lerrors"
+
+       (( TST_COUNT++ ))
+
+}
+
+do_link s "-s" ${1} "Symbolic"
+do_link h   "" ${2} "Hard"
+
+rm -Rf hlink slink
diff -Naur --exclude '*CVS*'
../ltp.bk/testcases/kernel/fs/linktest/Makefile
./testcases/kernel/fs/linktest/Makefile
--- ../ltp.bk/testcases/kernel/fs/linktest/Makefile     2009-10-12
22:09:13.000000000 -0700
+++ ./testcases/kernel/fs/linktest/Makefile     2009-10-12
22:05:06.000000000 -0700
@@ -24,6 +24,6 @@

 include $(top_srcdir)/include/mk/env_pre.mk

-INSTALL_TARGETS                        := linktest.pl
+INSTALL_TARGETS                        := linktest.sh

 include $(top_srcdir)/include/mk/generic_leaf_target.mk

[-- Attachment #2: linker-pl.to-linker-sh.diff --]
[-- Type: text/x-patch, Size: 6446 bytes --]

diff -Naur --exclude '*CVS*' ../ltp.bk/runtest/fs ./runtest/fs
--- ../ltp.bk/runtest/fs	2009-10-12 22:09:12.000000000 -0700
+++ ./runtest/fs	2009-10-12 22:06:10.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.pl 1000 1000
+linker01 linktest.sh 1000 1000
 openfile01 openfile -f10 -t10
 inode01 inode01
 inode02 inode02
diff -Naur --exclude '*CVS*' ../ltp.bk/runtest/stress.part1 ./runtest/stress.part1
--- ../ltp.bk/runtest/stress.part1	2009-10-12 22:09:12.000000000 -0700
+++ ./runtest/stress.part1	2009-10-12 22:06:15.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.pl
+linker01 linktest.sh
 openfile01 openfile -f10 -t10
 inode01 inode01
 inode02 inode02
diff -Naur --exclude '*CVS*' ../ltp.bk/testcases/kernel/fs/linktest/linktest.pl ./testcases/kernel/fs/linktest/linktest.pl
--- ../ltp.bk/testcases/kernel/fs/linktest/linktest.pl	2009-10-12 22:18:49.000000000 -0700
+++ ./testcases/kernel/fs/linktest/linktest.pl	1969-12-31 16:00:00.000000000 -0800
@@ -1,89 +0,0 @@
-#!/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 (martinjn@us.ibm.com)
-#  HISTORY     : 
-#     (05/07/01)v.99  Needed a quick script to test a hardlink limitation that was found. 
-#     (28/07/08) Veerendra C <vechandr@in.ibm.com>   
-#                     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 -Naur --exclude '*CVS*' ../ltp.bk/testcases/kernel/fs/linktest/linktest.sh ./testcases/kernel/fs/linktest/linktest.sh
--- ../ltp.bk/testcases/kernel/fs/linktest/linktest.sh	1969-12-31 16:00:00.000000000 -0800
+++ ./testcases/kernel/fs/linktest/linktest.sh	2009-10-12 22:15:26.000000000 -0700
@@ -0,0 +1,75 @@
+#!/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 (yanegomi@gmail.com)
+#  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; shift
+	ln_opts=$1; shift
+	limit=$1; shift
+
+	lerrors=0
+
+	i=0
+
+	cd ${pfix}link; \
+	while [ $i -lt $limit ]; do \
+		if ! ln ${ln_opts} "$PWD/${pfix}file" ${pfix}file${i}; then
+			(( lerrors++ ))
+		fi
+		(( i++ ))
+	done
+	cd ..
+
+	if [ $lerrors -eq 0 ]; then
+		RTYPE=TPASS
+	else
+		RTYPE=TFAIL
+	fi
+
+	tst_res $RTYPE "" "$prefix_msg Link Errors: $lerrors"
+
+	(( TST_COUNT++ ))
+
+}
+
+do_link s "-s" ${1} "Symbolic"
+do_link h   "" ${2} "Hard"
+
+rm -Rf hlink slink
diff -Naur --exclude '*CVS*' ../ltp.bk/testcases/kernel/fs/linktest/Makefile ./testcases/kernel/fs/linktest/Makefile
--- ../ltp.bk/testcases/kernel/fs/linktest/Makefile	2009-10-12 22:09:13.000000000 -0700
+++ ./testcases/kernel/fs/linktest/Makefile	2009-10-12 22:05:06.000000000 -0700
@@ -24,6 +24,6 @@
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-INSTALL_TARGETS			:= linktest.pl
+INSTALL_TARGETS			:= linktest.sh
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk

[-- Attachment #3: Type: text/plain, Size: 399 bytes --]

------------------------------------------------------------------------------
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

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH] convert linktest.pl to linktest.sh
  2009-10-13  5:22 [LTP] [PATCH] convert linktest.pl to linktest.sh Garrett Cooper
@ 2009-10-13  5:30 ` Mike Frysinger
  2009-10-13  5:40   ` Garrett Cooper
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2009-10-13  5:30 UTC (permalink / raw)
  To: ltp-list


[-- Attachment #1.1: Type: Text/Plain, Size: 457 bytes --]

On Tuesday 13 October 2009 01:22:02 Garrett Cooper wrote:
> +do_link() {
> +       pfix=$1; shift
> +       ln_opts=$1; shift
> +       limit=$1; shift

any point in shifting ?  be simpler to just use $1 $2 $3

> +       cd ${pfix}link; \
> +       while [ $i -lt $limit ]; do \

why the line continuation ?

> +                       (( lerrors++ ))
> +               (( i++ ))
> +       (( TST_COUNT++ ))

i think you want:
	: $(( TST_COUNT += 1 ))
-mike

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 399 bytes --]

------------------------------------------------------------------------------
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

[-- Attachment #3: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH] convert linktest.pl to linktest.sh
  2009-10-13  5:30 ` Mike Frysinger
@ 2009-10-13  5:40   ` Garrett Cooper
  2009-10-13  5:43     ` Mike Frysinger
  0 siblings, 1 reply; 6+ messages in thread
From: Garrett Cooper @ 2009-10-13  5:40 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: ltp-list

On Mon, Oct 12, 2009 at 10:30 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Tuesday 13 October 2009 01:22:02 Garrett Cooper wrote:
>> +do_link() {
>> +       pfix=$1; shift
>> +       ln_opts=$1; shift
>> +       limit=$1; shift
>
> any point in shifting ?  be simpler to just use $1 $2 $3

No point really -- I'll change that.

>> +       cd ${pfix}link; \
>> +       while [ $i -lt $limit ]; do \
>
> why the line continuation ?

I deleted that stupidity.

>> +                       (( lerrors++ ))
>> +               (( i++ ))
>> +       (( TST_COUNT++ ))
>
> i think you want:
>        : $(( TST_COUNT += 1 ))

Ok, dumb question again -- $(( TST_COUNT += 1 )) is the POSIX
compliant method? (( TST_COUNT++ )) works too... (I keep on forgetting
what's POSIX compliant on this item...).

I also fixed a variable not being defined too, which resulted in a cosmetic bug:

        pfix=$1; shift
        ln_opts=$1; shift
        limit=$1; shift
+       prefix_msg=$1; shift

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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH] convert linktest.pl to linktest.sh
  2009-10-13  5:40   ` Garrett Cooper
@ 2009-10-13  5:43     ` Mike Frysinger
  2009-10-14 19:31       ` Garrett Cooper
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2009-10-13  5:43 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: ltp-list


[-- Attachment #1.1: Type: Text/Plain, Size: 715 bytes --]

On Tuesday 13 October 2009 01:40:44 Garrett Cooper wrote:
> On Mon, Oct 12, 2009 at 10:30 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> > On Tuesday 13 October 2009 01:22:02 Garrett Cooper wrote:
> >> +                       (( lerrors++ ))
> >> +               (( i++ ))
> >> +       (( TST_COUNT++ ))
> >
> > i think you want:
> >        : $(( TST_COUNT += 1 ))
> 
> Ok, dumb question again -- $(( TST_COUNT += 1 )) is the POSIX
> compliant method? (( TST_COUNT++ )) works too... (I keep on forgetting
> what's POSIX compliant on this item...).

the form i show is POSIX compliant.  afaik, the variant you're using is not as 
it lacks a dedicated command and the ++ operator is optional.
-mike

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 399 bytes --]

------------------------------------------------------------------------------
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

[-- Attachment #3: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH] convert linktest.pl to linktest.sh
  2009-10-13  5:43     ` Mike Frysinger
@ 2009-10-14 19:31       ` Garrett Cooper
  2009-10-14 19:32         ` Garrett Cooper
  0 siblings, 1 reply; 6+ messages in thread
From: Garrett Cooper @ 2009-10-14 19:31 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: ltp-list

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 <yanegomi@gmail.com>

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 (martinjn@us.ibm.com)
+#  HISTORY     :
+#     (05/07/01)v.99  Needed a quick script to test a hardlink
limitation that was found.
+#     (28/07/08) Veerendra C <vechandr@in.ibm.com>
+#                     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 (yanegomi@gmail.com)
-#  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

------------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH] convert linktest.pl to linktest.sh
  2009-10-14 19:31       ` Garrett Cooper
@ 2009-10-14 19:32         ` Garrett Cooper
  0 siblings, 0 replies; 6+ messages in thread
From: Garrett Cooper @ 2009-10-14 19:32 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: ltp-list

On Wed, Oct 14, 2009 at 12:31 PM, Garrett Cooper <yanegomi@gmail.com> 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 <yanegomi@gmail.com>
>
> 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 (martinjn@us.ibm.com)
> +#  HISTORY     :
> +#     (05/07/01)v.99  Needed a quick script to test a hardlink
> limitation that was found.
> +#     (28/07/08) Veerendra C <vechandr@in.ibm.com>
> +#                     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 (yanegomi@gmail.com)
> -#  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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-10-14 19:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-13  5:22 [LTP] [PATCH] convert linktest.pl to linktest.sh Garrett Cooper
2009-10-13  5:30 ` Mike Frysinger
2009-10-13  5:40   ` Garrett Cooper
2009-10-13  5:43     ` Mike Frysinger
2009-10-14 19:31       ` Garrett Cooper
2009-10-14 19:32         ` Garrett Cooper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox