more elaborate travis setup

This commit is contained in:
Naitik Shah 2014-07-10 23:02:29 -07:00
parent feb0fe057f
commit 39959e963b
3 changed files with 37 additions and 18 deletions

View File

@ -1,5 +1,23 @@
language: go language: go
go: go:
- 1.2 - 1.2
- 1.3
matrix:
fast_finish: true
before_install:
- go get -v code.google.com/p/go.tools/cmd/vet
- go get -v github.com/golang/lint/golint
- go get -v code.google.com/p/go.tools/cmd/cover
install: install:
- go get -t ./... - go install -race -v std
- go get -race -t -v ./...
- go install -race -v ./...
script:
- go vet ./...
- $HOME/gopath/bin/golint .
- go test -cpu=2 -race -cover -v ./...

View File

@ -17,10 +17,10 @@ import (
) )
var ( var (
// This error is returned by Inherits() when we're not inheriting any fds. // ErrNotInheriting is returned by Inherits() when we're not inheriting any fds.
ErrNotInheriting = errors.New("grace: no inherited listeners") ErrNotInheriting = errors.New("grace: no inherited listeners")
// This error is returned by Listener.Accept() when Close is in progress. // ErrAlreadyClosed is returned by Listener.Accept() when Close is in progress.
ErrAlreadyClosed = errors.New("grace: already closed") ErrAlreadyClosed = errors.New("grace: already closed")
errRestartListeners = errors.New("grace: restart must be given listeners") errRestartListeners = errors.New("grace: restart must be given listeners")
@ -76,7 +76,8 @@ func (c *conn) Close() error {
return c.Conn.Close() return c.Conn.Close()
} }
// Wraps an existing File listener to provide a graceful Close() process. // NewListener wraps an existing File listener to provide a graceful Close()
// process.
func NewListener(l Listener) Listener { func NewListener(l Listener) Listener {
return &listener{Listener: l} return &listener{Listener: l}
} }
@ -215,7 +216,7 @@ func (p *Process) Wait(listeners []Listener) error {
} }
} }
// Try to inherit listeners from the parent process. // Inherit listeners from the parent process.
func (p *Process) Inherit() (listeners []Listener, err error) { func (p *Process) Inherit() (listeners []Listener, err error) {
countStr := os.Getenv(envCountKey) countStr := os.Getenv(envCountKey)
if countStr == "" { if countStr == "" {
@ -239,8 +240,8 @@ func (p *Process) Inherit() (listeners []Listener, err error) {
return return
} }
// Start the Close process in the parent. This does not wait for the // CloseParent starts the close process in the parent. This does not wait for
// parent to close and simply sends it the TERM signal. // the parent to close and simply sends it the TERM signal.
func (p *Process) CloseParent() error { func (p *Process) CloseParent() error {
ppid := os.Getppid() ppid := os.Getppid()
if ppid == 1 { // init provided sockets, for example systemd if ppid == 1 { // init provided sockets, for example systemd
@ -304,13 +305,13 @@ func Wait(listeners []Listener) (err error) {
return defaultProcess.Wait(listeners) return defaultProcess.Wait(listeners)
} }
// Try to inherit listeners from the parent process. // Inherit listeners from the parent process.
func Inherit() (listeners []Listener, err error) { func Inherit() (listeners []Listener, err error) {
return defaultProcess.Inherit() return defaultProcess.Inherit()
} }
// Start the Close process in the parent. This does not wait for the // CloseParent starts the close process in the parent. This does not wait for
// parent to close and simply sends it the TERM signal. // the parent to close and simply sends it the TERM signal.
func CloseParent() error { func CloseParent() error {
return defaultProcess.CloseParent() return defaultProcess.CloseParent()
} }

View File

@ -210,18 +210,18 @@ func (h *harness) SendOne(dialgroup *sync.WaitGroup, url string, pid int) {
// Send test HTTP request. // Send test HTTP request.
func (h *harness) SendRequest() { func (h *harness) SendRequest() {
pid := h.MostRecentProcess().Pid pid := h.MostRecentProcess().Pid
httpFastUrl := fmt.Sprintf("http://%s/sleep/?duration=0", h.httpAddr) httpFastURL := fmt.Sprintf("http://%s/sleep/?duration=0", h.httpAddr)
httpSlowUrl := fmt.Sprintf("http://%s/sleep/?duration=2s", h.httpAddr) httpSlowURL := fmt.Sprintf("http://%s/sleep/?duration=2s", h.httpAddr)
httpsFastUrl := fmt.Sprintf("https://%s/sleep/?duration=0", h.httpsAddr) httpsFastURL := fmt.Sprintf("https://%s/sleep/?duration=0", h.httpsAddr)
httpsSlowUrl := fmt.Sprintf("https://%s/sleep/?duration=2s", h.httpsAddr) httpsSlowURL := fmt.Sprintf("https://%s/sleep/?duration=2s", h.httpsAddr)
var dialgroup sync.WaitGroup var dialgroup sync.WaitGroup
h.RequestWaitGroup.Add(4) h.RequestWaitGroup.Add(4)
dialgroup.Add(4) dialgroup.Add(4)
go h.SendOne(&dialgroup, httpFastUrl, pid) go h.SendOne(&dialgroup, httpFastURL, pid)
go h.SendOne(&dialgroup, httpSlowUrl, pid) go h.SendOne(&dialgroup, httpSlowURL, pid)
go h.SendOne(&dialgroup, httpsFastUrl, pid) go h.SendOne(&dialgroup, httpsFastURL, pid)
go h.SendOne(&dialgroup, httpsSlowUrl, pid) go h.SendOne(&dialgroup, httpsSlowURL, pid)
debug("Added Requests pid=%d", pid) debug("Added Requests pid=%d", pid)
dialgroup.Wait() dialgroup.Wait()
debug("Dialed Requests pid=%d", pid) debug("Dialed Requests pid=%d", pid)