cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Running tests in Windows

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Fri, 29 Apr 2005 08:54:39 +0200 (CEST)

On Fri, 29 Apr 2005, Andres Garcia wrote:

>> Thanks! I fixed the attribute parser, I made the check for both MSwin32 and
>> msys and I committed the mode=text to test case 31. Can you update from cvs
>> and see if test 31 runs fine now?
>
> The test does run fine now, but the new checkserver function returns a
> negative value even though everything is well, I had to change the condition
> that checks the pid value for the test to run.

Sigh. All these special platform issues for the test servers are somewhat...
annoying.

The checkserver() function is not new, I just made it get used a bit more now,
so that it uses the pidfile to find the pid first, before asking the server
over HTTP. (The reason for this is that I found a case on a machine when the
test server started fine, but curl failed to talk to it and thus it couldn't
get the pid over HTTP even though the server had started and without pid it
can't kill the server properly when the test script exits).

> What does 'if ($pid ne "" && kill(0, $pid)) {' do?

If pid is something else than a blank, the kill(0) construct returns true if
the process exists (without terminating it). My 'man perlport' says this works
on win32 too.

BTW, speaking of test script portability: today we start the HTTP and FTP
servers from within runtests.pl by doing something like system("perl server.pl
&"); which I'm considering turning this into a plain fork() and exec(). It'll
reduce the risk for test server left-overs. Is the perl fork() function
working sufficiently good on Windows to allow this? Anyone here that knows?

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2005-04-29