test-static-http.t: enable on Windows

We cannot read $! to get the background job process identifier, with
MinGW it can return internal identifiers not matching the native Windows
ones. Instead we introduce a helper script polling on the pid file. We
assume the pid file data will be written in order.
This commit is contained in:
Patrick Mezard 2012-09-12 22:31:54 +02:00
parent dc9ede17dc
commit 7424bcac9c

View File

@ -1,4 +1,4 @@
$ "$TESTDIR/hghave" serve || exit 80
$ "$TESTDIR/hghave" killdaemons || exit 80
#if windows
$ hg clone http://localhost:$HGPORT/ copy
@ -25,10 +25,27 @@ one pull
> httpd.serve_forever()
>
> signal.signal(signal.SIGTERM, lambda x, y: sys.exit(0))
> fp = file('dumb.pid', 'wb')
> fp.write(str(os.getpid()) + '\n')
> fp.close()
> run()
> EOF
$ python dumb.py 2>/dev/null &
$ echo $! >> $DAEMON_PIDS
Cannot just read $!, it will not be set to the right value on Windows/MinGW
$ cat > wait.py <<EOF
> import time
> while True:
> try:
> if '\n' in file('dumb.pid', 'rb').read():
> break
> except IOError:
> pass
> time.sleep(0.2)
> EOF
$ python wait.py
$ cat dumb.pid >> $DAEMON_PIDS
$ hg init remote
$ cd remote
$ echo foo > bar
@ -171,4 +188,4 @@ test with non-repo
$ hg clone static-http://localhost:$HGPORT/notarepo local3
abort: 'http://localhost:$HGPORT/notarepo' does not appear to be an hg repository!
[255]
$ kill $!
$ "$TESTDIR/killdaemons.py" $DAEMON_PIDS