From: Veerendra C. <vec...@in...> - 2008-07-28 11:35:47
|
Subrata, The new patch addresses the other error conditions. Like if its not able to create any dir/files in a ReadOnly dir. Also this patch returns the proper return code on success/failure . I have tested this script on ReadWrite dir and ReadOnly dir . #/tmp/fs25444/ReadWrite # linktest.pl linker01 : HardLink Test PASS linker01 : SoftLink Test PASS # /tmp/fs25444/RW # cd ../ReadOnly #/tmp/fs25444/ReadOnly # linktest.pl mkdir: cannot create directory `hlink': Read-only file system mkdir: cannot create directory `slink': Read-only file system touch: cannot touch `hlink/hfile': No such file or directory touch: cannot touch `slink/sfile': No such file or directory Error -1: Not able to create dir/file's (See attached file: newlink.patch) Regards, Veerendra C ________________________________________________________ Linux Technology Center, India Software Labs, Bangalore, Ph: 080-4177 6428 Subrata Modak <su...@li... et.ibm.com> To Veerendra 06/14/2008 01:38 Chandrappa/India/IBM@IBMIN PM cc ltp-list <ltp...@li...> Please respond to Subject su...@li...e Re: [LTP] patch for linktest.pl t.ibm.com Some comments on this Patch below: On Wed, 2008-06-11 at 14:28 +0530, Veerendra Chandrappa wrote: > > > Hi > > This patch fixes the linktest.pl. > This patch will address correctly when it encounters failure while running > on ReadOnly dir. > Also it returns the correct status for Success/Failure at the end of test. > > > Signed off : Veerendra C <vec...@in...> > > (See attached file: link.patch) > > Regards, Veerendra C --- /root/old/ltp-full-20080531/testcases/kernel/fs/linktest/linktest.pl 2007-07-22 02:13:34.000000000 +0530 +++ /root/ltp-full-20080531/testcases/kernel/fs/linktest/linktest.pl 2008-06-10 17:50:17.000000000 +0530 @@ -25,14 +25,20 @@ # HISTORY : # (05/07/01)v.99 Needed a quick script to test a hardlink limitation that was found. +$status=0; -`mkdir hlink`; -`mkdir slink`; -`touch hlink/hfile`; -`touch slink/sfile`; +$ret = system("mkdir hlink"); +$ret = system("mkdir slink"); +$ret = system("touch hlink/hfile"); +$ret = system("touch slink/sfile"); What happens if the initial 3 $ret fails, but the last one succeeds ? You will still proceed to pass. All the returns needs to be handled separately. Regards-- Subrata +if ($ret){ + 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) { @@ -52,5 +58,19 @@ unlink <slink/sfile*>; rmdir hlink; rmdir slink; -printf ("%-8s %4d %s : %s:%d\n", "linker01", 0, $herrors == 0 ? "PASS" : "FAIL", "Hard Link Errors ", $herrors); -printf ("%-8s %4d %s : %s:%d\n", "linker01", 0, $serrors == 0 ? "PASS" : "FAIL", "Symbolic Link Errors", $serrors); +if($herrors) { + printf ("linker01 : FAIL Hard Link Errors = %d\n", $herrors); + $status = -1 +} +else { + printf ("linker01 : HardLink Test PASS\n" ) +} +if($serrors) { + printf ("linker01 : FAIL Soft Link Errors = %d\n", $serrors); + $status = -1 +} +else { + printf ("linker01 : SoftLink Test PASS\n" ) +} + +exit $status |