Re: [RFC/PATCH] git-instaweb: Add support for running gitweb via 'plackup'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jakub Narebski <jnareb@xxxxxxxxx> wrote:
> Do you have any idea on how to synchronize those two processes, the web
> server and the web client (web browser), so that web browser is run only
> after web server prints that it is ready to accept connection?

Your polling http_is_ready() function is fine, and really the only
portable solution across all servers (and OSes).

But if your webserver lets you run arbitrary code hooks after it
binds the listen socket, what I do when writing integration tests
is have it open a FIFO for writing.

Adapted and abridged from the Rainbows! web server test suite, the
following config snippet is from the config file for the Rainbows! web
server:
---------------- rainbows.conf.rb -----------------
after_fork do |server, worker|
  # test script will block while reading from the FIFO,
  # so notify the script on the first worker we spawn
  # by opening the FIFO
  if worker.nr == 0
    File.open("/path/to/fifo", "wb") { |fp| fp.syswrite "START" }
  end
end
---------------------------------------------------

And then in the test script:
----------- my-integration-test.sh ----------------
set -e
mkfifo /path/to/fifo
# start the server
rainbows --daemonize --config-file rainbows.conf.rb

# "cat /path/to/fifo" will block until the after_fork hook is called
# in rainbows.conf.rb
test xSTART = x"$(cat /path/to/fifo)"

# server is up, run the rest of the tests...
---------------------------------------------------

-- 
Eric Wong
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]