mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
uses stricter output
This commit is contained in:
parent
85705e105c
commit
7c6414ebbd
@ -29,7 +29,9 @@ setsockopt(Server, SOL_SOCKET, SO_REUSEADDR,
|
|||||||
bind(Server, sockaddr_in($port, INADDR_ANY))|| die "bind: $!";
|
bind(Server, sockaddr_in($port, INADDR_ANY))|| die "bind: $!";
|
||||||
listen(Server,SOMAXCONN) || die "listen: $!";
|
listen(Server,SOMAXCONN) || die "listen: $!";
|
||||||
|
|
||||||
|
if($verbose) {
|
||||||
print "HTTP server started on port $port\n";
|
print "HTTP server started on port $port\n";
|
||||||
|
}
|
||||||
|
|
||||||
open(PID, ">.server.pid");
|
open(PID, ">.server.pid");
|
||||||
print PID $$;
|
print PID $$;
|
||||||
@ -115,10 +117,13 @@ for ( $waitedpid = 0;
|
|||||||
my $testnum;
|
my $testnum;
|
||||||
if($path =~ /.*\/(\d*)/) {
|
if($path =~ /.*\/(\d*)/) {
|
||||||
$testnum=$1;
|
$testnum=$1;
|
||||||
|
|
||||||
|
if($verbose) {
|
||||||
|
print STDERR "sending reply $testnum\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print STDERR "UKNOWN TEST CASE\n";
|
$testnum=0;
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
open(INPUT, ">log/server.input");
|
open(INPUT, ">log/server.input");
|
||||||
for(@headers) {
|
for(@headers) {
|
||||||
@ -126,13 +131,21 @@ for ( $waitedpid = 0;
|
|||||||
}
|
}
|
||||||
close(INPUT);
|
close(INPUT);
|
||||||
|
|
||||||
# send a reply to the client
|
if(0 == $testnum ) {
|
||||||
|
print "HTTP/1.1 200 OK\r\n",
|
||||||
|
"header: yes\r\n",
|
||||||
|
"\r\n",
|
||||||
|
"You must select a test number to get good data back\r\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
# send a custom reply to the client
|
||||||
open(DATA, "<data/reply$testnum.txt");
|
open(DATA, "<data/reply$testnum.txt");
|
||||||
while(<DATA>) {
|
while(<DATA>) {
|
||||||
print $_;
|
print $_;
|
||||||
}
|
}
|
||||||
close(DATA);
|
close(DATA);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
# print "Hello there, $name, it's now ", scalar localtime, "\r\n";
|
# print "Hello there, $name, it's now ", scalar localtime, "\r\n";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@ my $memanalyze="../memanalyze.pl";
|
|||||||
|
|
||||||
my $short;
|
my $short;
|
||||||
my $verbose;
|
my $verbose;
|
||||||
|
my $anyway;
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# Return the pid of the http server as found in the pid file
|
# Return the pid of the http server as found in the pid file
|
||||||
@ -66,7 +67,7 @@ sub stopserver {
|
|||||||
my $res = kill (9, $PID); # die!
|
my $res = kill (9, $PID); # die!
|
||||||
unlink $PIDFILE; # server is killed
|
unlink $PIDFILE; # server is killed
|
||||||
|
|
||||||
if($res) {
|
if($res && $verbose) {
|
||||||
print "TCP server signalled to die\n";
|
print "TCP server signalled to die\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -223,11 +224,15 @@ sub compare {
|
|||||||
|
|
||||||
$res = comparefiles($first, $sec);
|
$res = comparefiles($first, $sec);
|
||||||
if ($res != 0) {
|
if ($res != 0) {
|
||||||
|
if(!$short) {
|
||||||
print " $text FAILED";
|
print " $text FAILED";
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!$short) {
|
||||||
print " $text OK";
|
print " $text OK";
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,16 +249,17 @@ sub displaydata {
|
|||||||
|
|
||||||
print "Running tests on:\n",
|
print "Running tests on:\n",
|
||||||
"* $version",
|
"* $version",
|
||||||
"* host $hostname",
|
"* Host: $hostname",
|
||||||
"* system $hosttype";
|
"* System: $hosttype";
|
||||||
|
|
||||||
if( -r $memdump) {
|
if( -r $memdump) {
|
||||||
# if this exists, curl was compiled with memory debugging
|
# if this exists, curl was compiled with memory debugging
|
||||||
# enabled and we shall verify that no memory leaks exist
|
# enabled and we shall verify that no memory leaks exist
|
||||||
# after each and every test!
|
# after each and every test!
|
||||||
$memory_debug=1;
|
$memory_debug=1;
|
||||||
print "** Memory debugging ENABLED\n";
|
|
||||||
}
|
}
|
||||||
|
printf("* Memory debugging: %s\n", $memory_debug?"ON":"OFF");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
@ -399,11 +405,16 @@ sub singletest {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if(!$short) {
|
||||||
print " memory OK";
|
print " memory OK";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if($short) {
|
||||||
|
print "OK";
|
||||||
|
}
|
||||||
print "\n";
|
print "\n";
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -423,10 +434,15 @@ do {
|
|||||||
# short output
|
# short output
|
||||||
$short=1;
|
$short=1;
|
||||||
}
|
}
|
||||||
|
elsif($ARGV[0] eq "-a") {
|
||||||
|
# continue anyway, even if a test fail
|
||||||
|
$anyway=1;
|
||||||
|
}
|
||||||
elsif($ARGV[0] eq "-h") {
|
elsif($ARGV[0] eq "-h") {
|
||||||
# show help text
|
# show help text
|
||||||
print <<EOHELP
|
print <<EOHELP
|
||||||
Usage: runtests.pl [-h][-s][-v][numbers]
|
Usage: runtests.pl [-h][-s][-v][numbers]
|
||||||
|
-a continue even if a test fails
|
||||||
-h this help text
|
-h this help text
|
||||||
-s short output
|
-s short output
|
||||||
-v verbose output
|
-v verbose output
|
||||||
@ -487,7 +503,7 @@ if ( $TESTCASES eq "all") {
|
|||||||
my $testnum;
|
my $testnum;
|
||||||
foreach $testnum (split(" ", $TESTCASES)) {
|
foreach $testnum (split(" ", $TESTCASES)) {
|
||||||
|
|
||||||
if(singletest($testnum)) {
|
if(singletest($testnum) && !$anyway) {
|
||||||
# a test failed, abort
|
# a test failed, abort
|
||||||
print "\n - abort tests\n";
|
print "\n - abort tests\n";
|
||||||
last;
|
last;
|
||||||
|
Loading…
Reference in New Issue
Block a user