upload check, better ability to specify test cases on the command line
This commit is contained in:
parent
55b7c1c364
commit
43e1e1cd1a
@ -186,7 +186,7 @@ sub comparefiles {
|
|||||||
# silly win-crap
|
# silly win-crap
|
||||||
binmode S;
|
binmode S;
|
||||||
binmode D;
|
binmode D;
|
||||||
|
|
||||||
my $m = 20;
|
my $m = 20;
|
||||||
my ($snum, $dnum, $s, $d);
|
my ($snum, $dnum, $s, $d);
|
||||||
do {
|
do {
|
||||||
@ -196,7 +196,7 @@ sub comparefiles {
|
|||||||
($s ne $d)) {
|
($s ne $d)) {
|
||||||
print "$source and $dest differ\n";
|
print "$source and $dest differ\n";
|
||||||
$res=1;
|
$res=1;
|
||||||
last;
|
$snum=0;
|
||||||
}
|
}
|
||||||
} while($snum);
|
} while($snum);
|
||||||
close(S);
|
close(S);
|
||||||
@ -330,6 +330,21 @@ sub singletest {
|
|||||||
# this is the valid protocol file we should generate
|
# this is the valid protocol file we should generate
|
||||||
my $PROT="$TESTDIR/prot$NUMBER.txt";
|
my $PROT="$TESTDIR/prot$NUMBER.txt";
|
||||||
|
|
||||||
|
# redirected stdout/stderr here
|
||||||
|
$STDOUT="$LOGDIR/stdout$NUMBER";
|
||||||
|
$STDERR="$LOGDIR/stderr$NUMBER";
|
||||||
|
|
||||||
|
# if this file exists, we verify that the stdout contained this:
|
||||||
|
my $VALIDOUT="$TESTDIR/stdout$NUMBER.txt";
|
||||||
|
|
||||||
|
# if this file exists, we verify upload
|
||||||
|
my $UPLOAD="$TESTDIR/upload$NUMBER.txt";
|
||||||
|
|
||||||
|
if(! -r $CURLCMD) {
|
||||||
|
# this is not a test
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
# name of the test
|
# name of the test
|
||||||
open(N, "<$TESTDIR/name$NUMBER.txt") ||
|
open(N, "<$TESTDIR/name$NUMBER.txt") ||
|
||||||
print "** Couldn't read name on test $NUMBER\n";
|
print "** Couldn't read name on test $NUMBER\n";
|
||||||
@ -337,13 +352,6 @@ sub singletest {
|
|||||||
close(N);
|
close(N);
|
||||||
$DESC =~ s/[\r\n]//g;
|
$DESC =~ s/[\r\n]//g;
|
||||||
|
|
||||||
# redirected stdout/stderr here
|
|
||||||
$STDOUT="$LOGDIR/stdout$NUMBER";
|
|
||||||
$STDERR="$LOGDIR/stderr$NUMBER";
|
|
||||||
|
|
||||||
# if this file exist, we verify that the stdout contained this:
|
|
||||||
my $VALIDOUT="$TESTDIR/stdout$NUMBER.txt";
|
|
||||||
|
|
||||||
print "test $NUMBER...";
|
print "test $NUMBER...";
|
||||||
if(!$short) {
|
if(!$short) {
|
||||||
print "[$DESC]\n";
|
print "[$DESC]\n";
|
||||||
@ -432,19 +440,30 @@ sub singletest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (! -r $REPLY) {
|
if (! -r $REPLY && -r $CURLOUT) {
|
||||||
print "** Missing reply data file for test $NUMBER",
|
print "** Missing reply data file for test $NUMBER",
|
||||||
", should be similar to $CURLOUT\n";
|
", should be similar to $CURLOUT\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# verify the received data
|
if( -r $CURLOUT ) {
|
||||||
$res = compare($CURLOUT, $REPLY, "data");
|
# verify the received data
|
||||||
|
$res = compare($CURLOUT, $REPLY, "data");
|
||||||
|
if ($res) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(-r $UPLOAD) {
|
||||||
|
# verify uploaded data
|
||||||
|
$res = compare("$LOGDIR/upload.$NUMBER", $UPLOAD, "upload");
|
||||||
if ($res) {
|
if ($res) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (! -r $PROT) {
|
if (! -r $PROT) {
|
||||||
print "** Missing protocol file for test $NUMBER",
|
print "** Missing protocol file for test $NUMBER",
|
||||||
", should be similar to $SERVERIN\n";
|
", should be similar to $SERVERIN\n";
|
||||||
@ -507,6 +526,7 @@ sub singletest {
|
|||||||
# Check options to this test program
|
# Check options to this test program
|
||||||
#
|
#
|
||||||
|
|
||||||
|
my @testthis;
|
||||||
do {
|
do {
|
||||||
if ($ARGV[0] eq "-v") {
|
if ($ARGV[0] eq "-v") {
|
||||||
# verbose output
|
# verbose output
|
||||||
@ -534,10 +554,15 @@ EOHELP
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
elsif($ARGV[0] =~ /^(\d+)/) {
|
elsif($ARGV[0] =~ /^(\d+)/) {
|
||||||
$TESTCASES=$ARGV[0]; # run these tests
|
push @testthis, $1;
|
||||||
}
|
}
|
||||||
} while(shift @ARGV);
|
} while(shift @ARGV);
|
||||||
|
|
||||||
|
if($testthis[0] ne "") {
|
||||||
|
$TESTCASES=join(" ", @testthis);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# Output curl version and host info being tested
|
# Output curl version and host info being tested
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user