converted all tests to run-tests.pl

git-svn-id: svn://svn.lighttpd.net/lighttpd/trunk@56 152afb58-edef-0310-8abb-c4023f1b3aa9
This commit is contained in:
Jan Kneschke 2005-02-28 17:08:05 +00:00
parent 26b184ba6f
commit 6bf51546c7
38 changed files with 156 additions and 751 deletions

View File

@ -11,18 +11,6 @@ endif
TESTS=\
prepare.sh \
run-tests.pl \
bug-03.sh \
bug-06.sh \
bug-12.sh \
large-header-01.sh \
compress-01.sh \
compress-02.sh \
compress-03.sh \
compress-04.sh \
fastcgi-10.sh \
fastcgi-11.sh \
fastcgi-12.sh \
fastcgi-13.sh \
cleanup.sh
CONFS=fastcgi-10.conf \

View File

@ -1,16 +0,0 @@
#!/bin/sh
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
deny request for index.html~
GET /index.html~ HTTP/1.0
Status: 403
EOF
run_test

View File

@ -1,26 +0,0 @@
#!/bin/sh
if pidof php > /dev/null; then
echo -n
else
printf "%-40s" "FastCGI PHPinfo"
exit 77
fi
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
PHP_SELF + indexfile
GET /indexfile/ HTTP/1.0
Host: www.example.org
Status: 200
Content: /indexfile/index.php
EOF
run_test

View File

@ -1,26 +0,0 @@
#!/bin/sh
if pidof php > /dev/null; then
echo -n
else
printf "%-40s" "FastCGI PHPinfo"
exit 77
fi
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
PHP_SELF + last indexfile
GET /indexfile/ HTTP/1.0
Host: www.example.org
Status: 200
Content: /indexfile/index.php
EOF
run_test

View File

@ -1,27 +0,0 @@
#!/bin/sh
if pidof php > /dev/null; then
echo -n
else
printf "%-40s" "FastCGI PHPinfo"
exit 77
fi
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
FastCGI + errorhandler
POST /indexfile/abc HTTP/1.0
Host: www.example.org
Content-Length: 0
Status: 404
Content: /indexfile/return-404.php
EOF
run_test

View File

@ -1,18 +0,0 @@
#!/bin/sh
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
CGI + NPH
GET /nph-status.pl HTTP/1.0
Host: www.example.org
Status: 200
EOF
run_test

View File

@ -1,27 +0,0 @@
#!/bin/sh
if id weigon > /dev/null; then
echo -n
else
printf "%-40s" "userdir"
exit 77
fi
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
userdir for ~weigon + redirect
GET /~weigon HTTP/1.0
Host: www.example.org
Status: 301
Location: http://www.example.org/~weigon/
EOF
run_test

View File

@ -1,26 +0,0 @@
#!/bin/sh
if id weigon > /dev/null; then
echo -n
else
printf "%-40s" "userdir"
exit 77
fi
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
userdir for ~weigon + redirect
GET /~weigon HTTP/1.0
Status: 301
Location: http://localhost:2048/~weigon/
EOF
run_test

View File

@ -1,27 +0,0 @@
#!/bin/sh
if id weigon > /dev/null; then
echo -n
else
printf "%-40s" "userdir"
exit 77
fi
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
userdir for ~weigon
GET /~weigon/ HTTP/1.0
Host: www.example.org
Status: 200
EOF
run_test

View File

@ -1,18 +0,0 @@
#!/bin/sh
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
Check that %00 is decoded correctly
GET /%00 HTTP/1.0
Foo: foo
Foo: foo
Status: 404
EOF
run_test

View File

@ -1,18 +0,0 @@
#!/bin/sh
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
Compression - deflate
GET /index.html HTTP/1.0
Accept-Encoding: deflate
Status: 200
MUST: Vary
EOF
run_test

View File

@ -1,19 +0,0 @@
#!/bin/sh
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
Compression - deflate
GET /index.html HTTP/1.0
Accept-Encoding: deflate
Status: 200
Content-Length: 1288
MUST: Vary Content-Encoding
EOF
run_test

View File

@ -1,18 +0,0 @@
#!/bin/sh
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
Compression - gzip
GET /index.html HTTP/1.0
Accept-Encoding: gzip
Status: 200
MUST: Vary Content-Encoding
EOF
run_test

View File

@ -1,19 +0,0 @@
#!/bin/sh
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
Compression - gzip
GET /index.txt HTTP/1.0
Accept-Encoding: gzip, deflate
Host: www.example.org
Status: 200
MIGHT: Content-Encoding Vary
EOF
run_test

View File

@ -1,4 +1,4 @@
EXTRA_DIST=cgi.php cgi.pl dummydir index.html index.txt phpinfo.php \
phpself.php redirect.php cgi-pathinfo.pl phphost.php \
nph-status.pl
SUBDIRS=go indexfile
SUBDIRS=go indexfile expire

View File

@ -0,0 +1 @@
EXTRA_DIST=access.txt modification.txt

View File

View File

@ -1,25 +0,0 @@
#!/bin/sh
if pidof php > /dev/null; then
echo -n
else
printf "%-40s" "FastCGI PHPinfo"
exit 77
fi
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
FastCGI PHPinfo
GET /phpinfo.php HTTP/1.0
Host: www.example.org
Status: 200
EOF
run_test

View File

@ -1,24 +0,0 @@
#!/bin/sh
if pidof php > /dev/null; then
echo -n
else
printf "%-40s" "FastCGI - missing File"
exit 77
fi
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
FastCGI - missing File
GET /phpinfajdhdo.php HTTP/1.1
Host: www.example.org
Status: 404
EOF
run_test

View File

@ -1,25 +0,0 @@
#!/bin/sh
if pidof php > /dev/null; then
echo -n
else
printf "%-40s" "index-file -> FastCGI"
exit 77
fi
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
index-file -> FastCGI
GET /go/ HTTP/1.0
Host: www.example.org
Status: 200
EOF
run_test

View File

@ -1,27 +0,0 @@
#!/bin/sh
if pidof php > /dev/null; then
echo -n
else
printf "%-40s" "Redirect in PHP"
exit 77
fi
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
Redirect in PHP
GET /redirect.php HTTP/1.0
Host: www.example.org
Conntection: close
Status: 302
Location: http://www.example.org:2048/
EOF
run_test

View File

@ -1,27 +0,0 @@
#!/bin/sh
if pidof php > /dev/null; then
echo -n
else
printf "%-40s" "Redirect in PHP"
exit 77
fi
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
PHP_SELF
GET /phpself.php HTTP/1.0
Host: www.example.org
Conntection: close
Status: 200
Content: /phpself.php
EOF
run_test

View File

@ -1,27 +0,0 @@
#!/bin/sh
if pidof php > /dev/null; then
echo -n
else
printf "%-40s" "Redirect in PHP"
exit 77
fi
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
PHP_SELF + PATH_INFO
GET /phpself.php/foo HTTP/1.0
Host: www.example.org
Conntection: close
Status: 200
Content: /phpself.php
EOF
run_test

View File

@ -1,27 +0,0 @@
#!/bin/sh
if pidof php > /dev/null; then
echo -n
else
printf "%-40s" "Redirect in PHP"
exit 77
fi
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
SERVER_NAME + known host, simplevhost
GET /phphost.php HTTP/1.0
Host: www.example.org
Conntection: close
Status: 200
Content: www.example.org
EOF
run_test

View File

@ -1,27 +0,0 @@
#!/bin/sh
if pidof php > /dev/null; then
echo -n
else
printf "%-40s" "Redirect in PHP"
exit 77
fi
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
SERVER_NAME + unknown host, default
GET /phphost.php HTTP/1.0
Host: xxx.example.org
Conntection: close
Status: 200
Content: www.example.org
EOF
run_test

View File

@ -1,27 +0,0 @@
#!/bin/sh
if pidof php > /dev/null; then
echo -n
else
printf "%-40s" "Redirect in PHP"
exit 77
fi
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
SERVER_NAME + \$HTTP["Host"], default
GET /phphost.php HTTP/1.0
Host: vvv.example.org
Conntection: close
Status: 200
Content: www.example.org
EOF
run_test

View File

@ -1,27 +0,0 @@
#!/bin/sh
if pidof php > /dev/null; then
echo -n
else
printf "%-40s" "Redirect in PHP"
exit 77
fi
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
SERVER_NAME + \$HTTP, servername
GET /phphost.php HTTP/1.0
Host: zzz.example.org
Conntection: close
Status: 200
Content: zzz.example.org
EOF
run_test

View File

@ -1,19 +0,0 @@
#!/bin/sh
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
FastCGI-Auth - ok
GET /index.html?ok HTTP/1.0
Host: www.example.org
Conntection: close
Status: 200
EOF
run_test

View File

@ -1,19 +0,0 @@
#!/bin/sh
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
FastCGI-Authorizer - 403
GET /index.html?fail HTTP/1.0
Host: www.example.org
Conntection: close
Status: 403
EOF
run_test

View File

@ -1,26 +0,0 @@
#!/bin/sh
if test -e /home/weigon/Documents/php-4.3.10/sapi/cgi/php > /dev/null; then
echo -n
else
printf "%-40s" "FastCGI PHPinfo"
exit 77
fi
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
FastCGI + local-spawning
GET /indexfile/index.php HTTP/1.0
Host: www.example.org
Conntection: close
Status: 200
EOF
run_test

View File

@ -1,26 +0,0 @@
#!/bin/sh
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
HEAD request should have no content
HEAD /index.html HTTP/1.0
Status: 200
EOF
run_test_script
if test x$exitcode = x0; then
if test `cat $NAME.out | sed '1,/^.$/d' | wc -l` = 0; then
a=a
else
exitcode=-1
fi
fi
run_test_exit

View File

@ -1,25 +0,0 @@
#!/bin/sh
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
large request header
GET / HTTP/1.0
Hsgfsdjf: asdfhdf
hdhd: shdfhfdasd
hfhr: jfghsdfg
jfuuehdmn: sfdgjfdg
jvcbzufdg: sgfdfg
hrnvcnd: jfjdfg
jfusfdngmd: gfjgfdusdfg
nfj: jgfdjdfg
jfue: jfdfdg
Status: 200
EOF
run_test

View File

@ -4,8 +4,6 @@ server.pid-file = "/tmp/lighttpd/lighttpd.pid"
## bind to port (default: 80)
server.port = 2048
# server.license = "00000001000000013feccb804014587f000000010000000105911c976a3d462c8eaa2d7ca850432c"
## bind to localhost (default: all interfaces)
server.bind = "localhost"
server.errorlog = "/tmp/lighttpd/logs/lighttpd.error.log"
@ -14,11 +12,6 @@ server.tag = "Apache 1.3.29"
fastcgi.debug = 1
##
## Format: <errorfile-prefix><status>.html
## -> ..../status-404.html for 'File not found'
#server.errorfile-prefix = "/home/weigon/projects/lighttpd/doc/status-"
server.dir-listing = "enable"
#server.event-handler = "linux-sysepoll"
@ -46,17 +39,6 @@ server.modules = (
server.indexfiles = ( "index.php", "index.html",
"index.htm", "default.htm" )
#,-- only root can use these options
#|
#|# chroot() to directory (default: no chroot() )
#| server.chroot /
#|# change uid to <uid> (default: don't care)
#| server.userid wwwrun
#|# change uid to <uid> (default: don't care)
#| server.groupid wwwrun
#|
#`--
######################## MODULE CONFIG ############################
@ -102,7 +84,7 @@ cgi.assign = ( ".pl" => "/usr/bin/perl",
".cgi" => "/usr/bin/perl",
".py" => "/usr/bin/python" )
userdir.include-user = ( "weigon" )
userdir.include-user = ( "jan" )
userdir.path = "/"
ssl.engine = "disable"
@ -143,7 +125,8 @@ url.access-deny = ( "~", ".inc")
url.redirect = ( "^/redirect/$" => "http://localhost:2048/" )
expire.url = ( "/buggy/" => "access 2 hours", "/asdhas/" => "access plus 1 seconds 2 minutes")
expire.url = ( "/expire/access" => "access 2 hours",
"/expire/modification" => "access plus 1 seconds 2 minutes")
#cache.cache-dir = "/home/weigon/wwwroot/cache/"

View File

@ -1,24 +0,0 @@
#!/bin/sh
if pidof php > /dev/null; then
echo -n
else
printf "%-40s" "PathInfo"
exit 77
fi
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
PathInfo
GET /cgi.php/abc HTTP/1.0
Status: 200
EOF
run_test

View File

@ -1,24 +0,0 @@
#!/bin/sh
if pidof php > /dev/null; then
echo -n
else
printf "%-40s" "PathInfo"
exit 77
fi
test x$srcdir = x && srcdir=.
. $srcdir/testbase.sh
prepare_test
cat > $TMPFILE <<EOF
PathInfo on a directory
GET /www/abc/def HTTP/1.0
Status: 404
EOF
run_test

View File

@ -11,6 +11,7 @@ rm -rf $tmpdir
mkdir -p $tmpdir/servers/www.example.org/pages/
mkdir -p $tmpdir/servers/www.example.org/pages/dummydir/
mkdir -p $tmpdir/servers/www.example.org/pages/go/
mkdir -p $tmpdir/servers/www.example.org/pages/expire/
mkdir -p $tmpdir/servers/www.example.org/pages/indexfile/
mkdir -p $tmpdir/servers/123.example.org/pages/
mkdir -p $tmpdir/logs/
@ -23,6 +24,7 @@ cp $srcdir/docroot/www/*.html \
$srcdir/docroot/www/*.pl \
$srcdir/docroot/www/*.txt $tmpdir/servers/www.example.org/pages/
cp $srcdir/docroot/www/go/*.php $tmpdir/servers/www.example.org/pages/go/
cp $srcdir/docroot/www/expire/*.txt $tmpdir/servers/www.example.org/pages/expire/
cp $srcdir/docroot/www/indexfile/*.php $tmpdir/servers/www.example.org/pages/indexfile/
cp $srcdir/docroot/123/*.txt \
$srcdir/docroot/123/*.html \

View File

@ -2,7 +2,7 @@
use strict;
use IO::Socket;
use Test::More tests => 89;
use Test::More tests => 114;
my $testname;
@ -32,6 +32,7 @@ sub stop_proc {
close F;
kill('TERM',$pid) or return -1;
select(undef, undef, undef, 0.25);
return 0;
}
@ -165,7 +166,7 @@ sub handle_http {
}
if (!defined $resp_hdr{$k}) {
diag(sprintf("required header '%s' is missing\n", $_));
diag(sprintf("required header '%s' is missing\n", $k));
return -1;
}
@ -746,6 +747,22 @@ EOF
ok(handle_http == 0, 'GET, Range start out of range');
@request = ( <<EOF
GET / HTTP/1.0
Hsgfsdjf: asdfhdf
hdhd: shdfhfdasd
hfhr: jfghsdfg
jfuuehdmn: sfdgjfdg
jvcbzufdg: sgfdfg
hrnvcnd: jfjdfg
jfusfdngmd: gfjgfdusdfg
nfj: jgfdjdfg
jfue: jfdfdg
EOF
);
@response = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } );
ok(handle_http == 0, 'larger headers');
@ -941,6 +958,61 @@ EOF
ok(handle_http == 0, 'external redirect');
print "\nmodules - mod_compress\n";
@request = ( <<EOF
GET /index.html HTTP/1.0
Accept-Encoding: deflate
EOF
);
@response = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '' } );
ok(handle_http == 0, 'Vary is set');
@request = ( <<EOF
GET /index.html HTTP/1.0
Accept-Encoding: deflate
EOF
);
@response = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Length' => '1288', '+Content-Encoding' => '' } );
ok(handle_http == 0, 'deflate - Content-Length and Content-Encoding is set');
@request = ( <<EOF
GET /index.html HTTP/1.0
Accept-Encoding: gzip
EOF
);
@response = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', '+Content-Encoding' => '' } );
ok(handle_http == 0, 'gzip - Content-Length and Content-Encoding is set');
@request = ( <<EOF
GET /index.txt HTTP/1.0
Accept-Encoding: gzip, deflate
EOF
);
@response = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', '+Content-Encoding' => '' } );
ok(handle_http == 0, 'gzip, deflate - Content-Length and Content-Encoding is set');
print "\nmodules - mod_expire\n";
@request = ( <<EOF
GET /expire/access.txt HTTP/1.0
EOF
);
@response = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Expires' => '' } );
ok(handle_http == 0, 'access');
@request = ( <<EOF
GET /expire/modification.txt HTTP/1.0
EOF
);
@response = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Expires' => '' } );
ok(handle_http == 0, 'modification');
print "\nmodules - mod_userdir\n";
# get current user
@ -967,13 +1039,83 @@ EOF
@response = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://www.example.org/~jan/' } );
ok(handle_http == 0, 'valid user + redirect');
print "\nclean up\n";
ok(stop_proc == 0, "Stopping lighttpd");
print "\nspecial config\n";
$configfile = 'fastcgi-10.conf';
ok(start_proc == 0, "Starting lighttpd with fastcgi-10.conf") or die();
@request = ( <<EOF
GET /phphost.php HTTP/1.0
Host: zzz.example.org
EOF
);
@response = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'zzz.example.org' } );
ok(handle_http == 0, 'FastCGI + Host');
ok(stop_proc == 0, "Stopping lighttpd");
$configfile = 'fastcgi-11.conf';
ok(start_proc == 0, "Starting lighttpd with fastcgi-11.conf") or die();
@request = ( <<EOF
GET /index.html?ok HTTP/1.0
Host: www.example.org
EOF
);
@response = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } );
ok(handle_http == 0, 'FastCGI - Auth');
ok(stop_proc == 0, "Stopping lighttpd");
$configfile = 'fastcgi-12.conf';
ok(start_proc == 0, "Starting lighttpd with fastcgi-12.conf") or die();
@request = ( <<EOF
GET /index.html?fail HTTP/1.0
Host: www.example.org
EOF
);
@response = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } );
ok(handle_http == 0, 'FastCGI - Auth');
ok(stop_proc == 0, "Stopping lighttpd");
$configfile = 'fastcgi-13.conf';
ok(start_proc == 0, "Starting lighttpd with fastcgi-13.conf") or die();
@request = ( <<EOF
GET /indexfile/index.php HTTP/1.0
Host: www.example.org
EOF
);
@response = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } );
ok(handle_http == 0, 'FastCGI + local spawning');
ok(stop_proc == 0, "Stopping lighttpd");
$configfile = 'bug-06.conf';
ok(start_proc == 0, "Starting lighttpd with bug-06.conf") or die();
@request = ( <<EOF
GET /indexfile/ HTTP/1.0
Host: www.example.org
EOF
);
@response = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/indexfile/index.php' } );
ok(handle_http == 0, 'Bug #6');
ok(stop_proc == 0, "Stopping lighttpd");
$configfile = 'bug-12.conf';
ok(start_proc == 0, "Starting lighttpd with bug-12.conf") or die();
@request = ( <<EOF
POST /indexfile/abc HTTP/1.0
Host: www.example.org
Content-Length: 0
EOF
);
@response = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, 'HTTP-Content' => '/indexfile/return-404.php' } );
ok(handle_http == 0, 'Bug #12');
ok(stop_proc == 0, "Stopping lighttpd");