# HG changeset patch # User Patrick Mezard # Date 2012-09-12 20:31:54 # Node ID 31ca918d539a7f79c46518d667605d71e6e96a53 # Parent 31f32a96e1e3582c703c11b6256a1dd007cd0f23 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. diff --git a/tests/test-static-http.t b/tests/test-static-http.t --- a/tests/test-static-http.t +++ b/tests/test-static-http.t @@ -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 < 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