tests/test-static-http.t
changeset 17538 31ca918d539a
parent 17486 73e3e368bd42
child 22046 7a9cbb315d84
equal deleted inserted replaced
17537:31f32a96e1e3 17538:31ca918d539a
     1   $ "$TESTDIR/hghave" serve || exit 80
     1   $ "$TESTDIR/hghave" killdaemons || exit 80
     2 
     2 
     3 #if windows
     3 #if windows
     4   $ hg clone http://localhost:$HGPORT/ copy
     4   $ hg clone http://localhost:$HGPORT/ copy
     5   abort: * (glob)
     5   abort: * (glob)
     6   [255]
     6   [255]
    23   >     server_address = ('localhost', int(os.environ['HGPORT']))
    23   >     server_address = ('localhost', int(os.environ['HGPORT']))
    24   >     httpd = server_class(server_address, handler_class)
    24   >     httpd = server_class(server_address, handler_class)
    25   >     httpd.serve_forever()
    25   >     httpd.serve_forever()
    26   > 
    26   > 
    27   > signal.signal(signal.SIGTERM, lambda x, y: sys.exit(0))
    27   > signal.signal(signal.SIGTERM, lambda x, y: sys.exit(0))
       
    28   > fp = file('dumb.pid', 'wb')
       
    29   > fp.write(str(os.getpid()) + '\n')
       
    30   > fp.close()
    28   > run()
    31   > run()
    29   > EOF
    32   > EOF
    30   $ python dumb.py 2>/dev/null &
    33   $ python dumb.py 2>/dev/null &
    31   $ echo $! >> $DAEMON_PIDS
    34 
       
    35 Cannot just read $!, it will not be set to the right value on Windows/MinGW
       
    36 
       
    37   $ cat > wait.py <<EOF
       
    38   > import time
       
    39   > while True:
       
    40   >     try:
       
    41   >         if '\n' in file('dumb.pid', 'rb').read():
       
    42   >             break
       
    43   >     except IOError:
       
    44   >         pass
       
    45   >     time.sleep(0.2)
       
    46   > EOF
       
    47   $ python wait.py
       
    48   $ cat dumb.pid >> $DAEMON_PIDS
    32   $ hg init remote
    49   $ hg init remote
    33   $ cd remote
    50   $ cd remote
    34   $ echo foo > bar
    51   $ echo foo > bar
    35   $ echo c2 > '.dotfile with spaces'
    52   $ echo c2 > '.dotfile with spaces'
    36   $ hg add
    53   $ hg add
   169   $ cd ..
   186   $ cd ..
   170   $ mkdir notarepo
   187   $ mkdir notarepo
   171   $ hg clone static-http://localhost:$HGPORT/notarepo local3
   188   $ hg clone static-http://localhost:$HGPORT/notarepo local3
   172   abort: 'http://localhost:$HGPORT/notarepo' does not appear to be an hg repository!
   189   abort: 'http://localhost:$HGPORT/notarepo' does not appear to be an hg repository!
   173   [255]
   190   [255]
   174   $ kill $!
   191   $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS