[Libsysio-commit] cplant: libsysio/tests test_all.pl test_copy.pl test_getcwd.pl test_list.pl test_p
Brought to you by:
lward
|
From: Sonja T. <so...@us...> - 2003-08-22 02:24:03
|
Update of /cvsroot/libsysio/libsysio/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv9632/libsysio/tests
Modified Files:
Tag: cplant
test_all.pl test_copy.pl test_getcwd.pl test_list.pl
test_path.pl test_stats.pl test_stdfd.pl
Log Message:
Bug fixes to test_driver.c and modified tests to not rely on given directory
structure
Index: test_all.pl
===================================================================
RCS file: /cvsroot/libsysio/libsysio/tests/test_all.pl,v
retrieving revision 1.3
retrieving revision 1.3.4.1
diff -u -w -b -B -p -r1.3 -r1.3.4.1
--- test_all.pl 18 Aug 2003 15:52:20 -0000 1.3
+++ test_all.pl 21 Aug 2003 17:00:16 -0000 1.3.4.1
@@ -14,27 +14,34 @@ if ((@ARGV > 0) && ($ARGV[0] eq "-alpha"
} else {
my $alpha_env = $ENV{"IS_ALPHA"};
# If there is no command line arg, check the environment vars
- if ($alpha_env eq "yes") {
+ if (defined($alpha_env) && ($alpha_env eq "yes")) {
$alpha_arg = "-alpha";
}
}
-# Will use this directory...
-system("mkdir -p ./tmp_dir");
-
my $failures = 0;
my $success = 0;
# Get cwd..
my $cwd = $ENV{PWD};
-# Get the sysio dir
-my $sysdir = $cwd;
-$sysdir =~ s/\/\w+$//;
+# Get tests directory
+my $testdir = $0;
+$testdir =~ s/\/\w+.pl$//;
+
my $res;
+# Will use this directory...
+system("mkdir -p $cwd/tmp_dir");
+
+# Create a couple of files and subdirectories for use in the tests
+system("mkdir -p $cwd/tmp_dir/test1");
+system("mkdir -p $cwd/tmp_dir/test2");
+
+system("cp $testdir/helper.pm $cwd/tmp_dir/test1");
+
if (($alpha_arg eq "") || ($is_broke == 0)) {
# Test getdirentries
- $res = `./test_list.pl $alpha_arg $sysdir`;
+ $res = `perl -I$testdir $testdir/test_list.pl $alpha_arg $cwd/tmp_dir`;
chop($res);
if ($res ne "list test successful") {
print "Basic getdirentries test failed with message: $res\n";
@@ -46,8 +53,8 @@ if (($alpha_arg eq "") || ($is_broke ==
}
# Test path
-my @resarr = `./test_path.pl $alpha_arg $sysdir $cwd $cwd/tmp_dir`;
-$res = $sysdir.": d\n";
+my @resarr = `perl -I$testdir $testdir/test_path.pl $alpha_arg $testdir $cwd $cwd/tmp_dir`;
+$res = $testdir.": d\n";
if ($resarr[0] ne $res) {
print "path test returned $resarr[0] instead of $res\n";
$failures++;
@@ -70,7 +77,7 @@ if ($resarr[0] ne $res) {
if (($alpha_arg eq "") || ($is_broke == 0)) {
# Test mount
- $res = `./test_list.pl $alpha_arg -m native:$sysdir $cwd/tmp_dir`;
+ $res = `perl -I$testdir $testdir/test_list.pl $alpha_arg -m native:$testdir $cwd/tmp_dir/test2`;
chop($res);
if ($res ne "list test successful") {
print "Mount test failed with message: $res\n";
@@ -81,7 +88,7 @@ if (($alpha_arg eq "") || ($is_broke ==
}
# Test getcwd
- $res = `./test_getcwd.pl $alpha_arg $sysdir`;
+ $res = `perl -I$testdir $testdir/test_getcwd.pl $alpha_arg $cwd/tmp_dir/test1`;
chop($res);
if ($res ne "getcwd test successful") {
print "getcwd test failed with message: $res\n";
@@ -93,7 +100,7 @@ if (($alpha_arg eq "") || ($is_broke ==
}
# Test copy
-$res = `./test_copy.pl $alpha_arg $sysdir/README $cwd/tmp_dir/README`;
+$res = `perl -I$testdir $testdir/test_copy.pl $alpha_arg $cwd/tmp_dir/test1/helper.pm $cwd/tmp_dir/helper.pm`;
chop($res);
if ($res ne "copy test successful") {
print "copy test failed with message: $res\n";
@@ -104,7 +111,7 @@ if ($res ne "copy test successful") {
}
# Test stats
-$res = `./test_stats.pl $alpha_arg $cwd/tmp_dir/README`;
+$res = `perl -I$testdir $testdir/test_stats.pl $alpha_arg $cwd/tmp_dir/helper.pm`;
chop($res);
if ($res ne "stat test successful") {
print "stat test failed with message: $res\n";
@@ -115,7 +122,7 @@ if ($res ne "stat test successful") {
}
# Test stdfd
-$res = `./test_stdfd.pl $alpha_arg foo_dir`;
+$res = `perl -I$testdir $testdir/test_stdfd.pl $alpha_arg foo_dir`;
chop($res);
if ($res ne "test_stdfd successful") {
print "stdfd test failed with message: $res\n";
@@ -128,6 +135,6 @@ if ($res ne "test_stdfd successful") {
print "$failures tests failed and $success tests succeeded\n";
# cleanup
-system(`rm -rf tmp_dir`);
+system(`rm -rf $cwd/tmp_dir`);
exit $failures;
Index: test_copy.pl
===================================================================
RCS file: /cvsroot/libsysio/libsysio/tests/test_copy.pl,v
retrieving revision 1.2
retrieving revision 1.2.6.1
diff -u -w -b -B -p -r1.2 -r1.2.6.1
--- test_copy.pl 14 Aug 2003 21:16:33 -0000 1.2
+++ test_copy.pl 21 Aug 2003 17:00:17 -0000 1.2.6.1
@@ -20,12 +20,15 @@ sub process_cmd
{
my ($src, $dest, $is_alpha) = @_;
+# Get tests directory
+my $testdir = $0;
+$testdir =~ s/\/\w+.pl$//;
eval {
if ($is_alpha == 0) {
- open2(\*OUTFILE, \*CMDFILE, "./test_driver --np");
+ open2(\*OUTFILE, \*CMDFILE, "$testdir/test_driver --np");
} else {
- open2(\*OUTFILE, \*CMDFILE, "yod -quiet -sz 1 ./test_driver --np");
+ open2(\*OUTFILE, \*CMDFILE, "yod -quiet -sz 1 $testdir/test_driver --np");
}
};
Index: test_getcwd.pl
===================================================================
RCS file: /cvsroot/libsysio/libsysio/tests/test_getcwd.pl,v
retrieving revision 1.2
retrieving revision 1.2.6.1
diff -u -w -b -B -p -r1.2 -r1.2.6.1
--- test_getcwd.pl 14 Aug 2003 21:16:33 -0000 1.2
+++ test_getcwd.pl 21 Aug 2003 17:00:17 -0000 1.2.6.1
@@ -43,12 +43,16 @@ sub process_cmd
{
my ($dir, $is_alpha) = @_;
+# Get tests directory
+my $testdir = $0;
+$testdir =~ s/\/\w+.pl$//;
+
eval {
if ($is_alpha == 0) {
- open2(\*OUTFILE, \*CMDFILE, "./test_driver --np");
+ open2(\*OUTFILE, \*CMDFILE, "$testdir/test_driver --np");
} else {
open2(\*OUTFILE, \*CMDFILE,
- "yod -batch -quiet -sz 1 ./test_driver --np");
+ "yod -batch -quiet -sz 1 $testdir/test_driver --np");
}
};
Index: test_list.pl
===================================================================
RCS file: /cvsroot/libsysio/libsysio/tests/test_list.pl,v
retrieving revision 1.2
retrieving revision 1.2.6.1
diff -u -w -b -B -p -r1.2 -r1.2.6.1
--- test_list.pl 14 Aug 2003 21:16:33 -0000 1.2
+++ test_list.pl 21 Aug 2003 17:00:17 -0000 1.2.6.1
@@ -125,11 +125,15 @@ sub process_cmd
my $size = 8192;
my $done_files = 0;
+# Get tests directory
+my $testdir = $0;
+$testdir =~ s/\/\w+.pl$//;
+
eval {
if ($is_alpha == 1) {
- open2(\*OUTFILE, \*CMDFILE, "yod -quiet -sz 1 ./test_driver --np");
+ open2(\*OUTFILE, \*CMDFILE, "yod -quiet -sz 1 $testdir/test_driver --np");
} else {
- open2(\*OUTFILE, \*CMDFILE, "./test_driver --np");
+ open2(\*OUTFILE, \*CMDFILE, "$testdir/test_driver --np");
}
};
Index: test_path.pl
===================================================================
RCS file: /cvsroot/libsysio/libsysio/tests/test_path.pl,v
retrieving revision 1.2.6.1
retrieving revision 1.2.6.2
diff -u -w -b -B -p -r1.2.6.1 -r1.2.6.2
--- test_path.pl 20 Aug 2003 21:05:49 -0000 1.2.6.1
+++ test_path.pl 21 Aug 2003 17:00:18 -0000 1.2.6.2
@@ -84,12 +84,16 @@ sub process_cmd
my $path;
+ # Get tests directory
+ my $testdir = $0;
+ $testdir =~ s/\/\w+.pl$//;
+
eval {
if ($isalpha == 0) {
- open2(\*OUTFILE, \*CMDFILE, "./test_driver --np");
+ open2(\*OUTFILE, \*CMDFILE, "$testdir/test_driver --np");
} else {
open2(\*OUTFILE, \*CMDFILE,
- "yod -batch -quiet -sz 1 ./test_driver --np");
+ "yod -batch -quiet -sz 1 $testdir/test_driver --np");
}
};
Index: test_stats.pl
===================================================================
RCS file: /cvsroot/libsysio/libsysio/tests/test_stats.pl,v
retrieving revision 1.2
retrieving revision 1.2.6.1
diff -u -w -b -B -p -r1.2 -r1.2.6.1
--- test_stats.pl 14 Aug 2003 21:16:33 -0000 1.2
+++ test_stats.pl 21 Aug 2003 17:00:18 -0000 1.2.6.1
@@ -92,12 +92,16 @@ sub process_cmd
{
my ($file, $is_alpha) = @_;
+# Get tests directory
+my $testdir = $0;
+$testdir =~ s/\/\w+.pl$//;
+
eval {
if ($is_alpha == 0) {
- open2(\*OUTFILE, \*CMDFILE, "./test_driver --np");
+ open2(\*OUTFILE, \*CMDFILE, "$testdir/test_driver --np");
} else {
open2(\*OUTFILE, \*CMDFILE,
- "yod -batch -quiet -sz 1 ./test_driver --np");
+ "yod -batch -quiet -sz 1 $testdir/test_driver --np");
}
};
@@ -163,25 +167,33 @@ sub process_cmd
$cmdstr = '$buf2 = ALLOC ( $size2 = CALL sizeof statvfs )'."\n";
helper::send_cmd($cmdfh, $outfh, "alloc", $cmdstr);
+ # Clear out the buffer
+ $cmdstr = 'CALL clear $buf2'."\n";
+ helper::send_cmd($cmdfh, $outfh, "CLEAR", $cmdstr);
+
$cmdstr = 'CALL statvfs '."$file ".'$buf2'."\n";
helper::send_cmd($cmdfh, $outfh, "statvfs", $cmdstr);
helper::verify_cmd($cmdfh, $outfh, "statvfs");
# Print out the statvfs buffer
- $cmdstr = 'PRINT $buf2 0 40 INT 44 8 LONG'."\n";
+ $cmdstr = 'PRINT $buf2 0 16 LONG 16 32 INT 48 16 LONG'."\n";
helper::send_cmd($cmdfh, $outfh, "PRINT", $cmdstr);
my $res = <$outfh>;
chop($res);
my @vfsstats1 = split(' ', $res);
+ # Clear out the buffer
+ $cmdstr = 'CALL clear $buf2'."\n";
+ helper::send_cmd($cmdfh, $outfh, "CLEAR", $cmdstr);
+
# Now do fstatvfs
$cmdstr = 'CALL fstatvfs $fd $buf2'."\n";
helper::send_cmd($cmdfh, $outfh, "fstatvfs", $cmdstr);
helper::verify_cmd($cmdfh, $outfh, "fstatvfs");
# Print out the statvfs buffer
- $cmdstr = 'PRINT $buf2 0 40 INT 44 8 LONG'."\n";
+ $cmdstr = 'PRINT $buf2 0 16 LONG 16 32 INT 48 16 LONG'."\n";
helper::send_cmd($cmdfh, $outfh, "PRINT", $cmdstr);
$res = <$outfh>;
@@ -196,7 +208,7 @@ sub process_cmd
my $i=0;
foreach my $stat1 (@vfsstats1) {
if ($stat1 ne $vfsstats2[$i++]) {
- my $str = sprintf("vfsstats field %d are not equal (%x != %x)\n",
+ my $str = sprintf("vfsstats field %d are not equal (%s != %s)\n",
$i-1, $stat1, $vfsstats2[$i-1]);
helper::print_and_exit($cmdfh, $outfh, 1, $str);
}
Index: test_stdfd.pl
===================================================================
RCS file: /cvsroot/libsysio/libsysio/tests/test_stdfd.pl,v
retrieving revision 1.2
retrieving revision 1.2.6.1
diff -u -w -b -B -p -r1.2 -r1.2.6.1
--- test_stdfd.pl 14 Aug 2003 21:16:33 -0000 1.2
+++ test_stdfd.pl 21 Aug 2003 17:00:18 -0000 1.2.6.1
@@ -105,11 +105,15 @@ sub process_cmd
{
my ($dirname, $do_print, $is_alpha) = @_;
+# Get tests directory
+my $testdir = $0;
+$testdir =~ s/\/\w+.pl$//;
+
eval {
if ($is_alpha == 1) {
- open2(\*OUTFILE, \*CMDFILE, "yod -sz 1 -quiet -batch ./test_driver --np");
+ open2(\*OUTFILE, \*CMDFILE, "yod -sz 1 -quiet -batch $testdir/test_driver --np");
} else {
- open2(\*OUTFILE, \*CMDFILE, "./test_driver --np");
+ open2(\*OUTFILE, \*CMDFILE, "$testdir/test_driver --np");
}
};
|