aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/getpart.pm9
-rwxr-xr-xtests/httpserver.pl7
-rwxr-xr-xtests/runtests.pl9
-rw-r--r--tests/server/sws.c14
4 files changed, 33 insertions, 6 deletions
diff --git a/tests/getpart.pm b/tests/getpart.pm
index 6935f9eb7..9c74986f4 100644
--- a/tests/getpart.pm
+++ b/tests/getpart.pm
@@ -92,8 +92,15 @@ sub getpart {
sub loadtest {
my ($file)=@_;
+ my $dir;
+ $dir = $ENV{'srcdir'};
+ if(!$dir) {
+ $dir=".";
+ }
+
+
undef @xml;
- open(XML, "<$file") ||
+ open(XML, "<$dir/$file") ||
return 1; # failure!
binmode XML; # for crapage systems, use binary
while(<XML>) {
diff --git a/tests/httpserver.pl b/tests/httpserver.pl
index 7faef92f9..d458a35c2 100755
--- a/tests/httpserver.pl
+++ b/tests/httpserver.pl
@@ -4,14 +4,19 @@ use strict;
my $verbose=0; # set to 1 for debugging
+my $dir=".";
my $port = 8999; # just a default
do {
if($ARGV[0] eq "-v") {
$verbose=1;
}
+ elsif($ARGV[0] eq "-d") {
+ $dir=$ARGV[1];
+ shift @ARGV;
+ }
elsif($ARGV[0] =~ /^(\d+)$/) {
$port = $1;
}
} while(shift @ARGV);
-exec("server/sws $port");
+exec("server/sws $port $dir");
diff --git a/tests/runtests.pl b/tests/runtests.pl
index 00c2c81bc..f0ca9963c 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -39,7 +39,7 @@ my $FTPSPORT=8821; # this is the FTPS server port
my $CURL="../src/curl"; # what curl executable to run on the tests
my $DBGCURL=$CURL; #"../src/.libs/curl"; # alternative for debugging
my $LOGDIR="log";
-my $TESTDIR="data";
+my $TESTDIR="$srcdir/data";
my $LIBDIR="./libtest";
my $SERVERIN="$LOGDIR/server.input"; # what curl sent the server
my $CURLLOG="$LOGDIR/curl.log"; # all command lines run
@@ -354,6 +354,10 @@ sub runhttpserver {
}
my $flag=$debugprotocol?"-v ":"";
+ my $dir=$ENV{'srcdir'};
+ if($dir) {
+ $flag .= "-d \"$dir\" ";
+ }
$cmd="$perl $srcdir/httpserver.pl $flag $HOSTPORT &";
system($cmd);
if($verbose) {
@@ -691,6 +695,9 @@ sub checkcurl {
}
}
}
+ if(!$curl) {
+ die "couldn't run curl!"
+ }
my $hostname=`hostname`;
my $hosttype=`uname -a`;
diff --git a/tests/server/sws.c b/tests/server/sws.c
index 796806e7f..f2f465003 100644
--- a/tests/server/sws.c
+++ b/tests/server/sws.c
@@ -70,7 +70,10 @@ spitout(FILE *stream,
#define REQUEST_DUMP "log/server.input"
#define RESPONSE_DUMP "log/server.response"
-#define TEST_DATA_PATH "data/test%d"
+#define TEST_DATA_PATH "%s/data/test%d"
+
+/* global variable, where to find the 'data' dir */
+char *path=".";
enum {
DOCNUMBER_QUIT = -6,
@@ -442,7 +445,7 @@ static int send_doc(int sock,
if(0 != part_no)
sprintf(partbuf, "data%d", part_no);
- sprintf(filename, TEST_DATA_PATH, doc);
+ sprintf(filename, TEST_DATA_PATH, path, doc);
stream=fopen(filename, "rb");
if(!stream) {
@@ -537,9 +540,14 @@ int main(int argc, char *argv[])
int part_no;
FILE *pidfile;
- if(argc>1)
+ if(argc>1) {
port = atoi(argv[1]);
+ if(argc>2) {
+ path = argv[2];
+ }
+ }
+
logfp = fopen(logfile, "a");
if (!logfp) {
perror(logfile);