Fixup experimental, add a makefile and add it to circle to stop experimental getting broken again.

This commit is contained in:
Tom Wilkie
2015-06-05 12:11:18 +00:00
parent b9091b9b2c
commit b031835148
7 changed files with 35 additions and 9 deletions

1
.gitignore vendored
View File

@@ -43,6 +43,7 @@ experimental/fixprobe/fixprobe
experimental/genreport/genreport
experimental/graphviz/graphviz
experimental/oneshot/oneshot
experimental/_integration/_integration
experimental/example/qotd/qotd
experimental/example/goapp/app
*sublime-project

View File

@@ -38,6 +38,7 @@ test:
- cd $SRCDIR; make
- cd $SRCDIR; ./bin/test
- cd $SRCDIR; make client-test
- cd $SRCDIR/experimental; make
post:
- goveralls -repotoken $COVERALLS_REPO_TOKEN -coverprofile=$SRCDIR/profile.cov -service=circleci || true
- cd $SRCDIR; cp coverage.html $CIRCLE_ARTIFACTS

16
experimental/Makefile Normal file
View File

@@ -0,0 +1,16 @@
.PHONY: all test clean
DIRS=$(shell find . -maxdepth 2 -name *.go -printf "%h\n" | uniq)
TARGETS=$(join $(patsubst %,%/,$(DIRS)),$(DIRS))
all: $(TARGETS)
$(TARGETS):
go get -tags netgo ./$(@D)
go build -ldflags "-extldflags \"-static\"" -tags netgo -o $@ ./$(@D)
test:
go test ./...
clean:
go clean ./...

View File

@@ -50,7 +50,9 @@ func main() {
// Collector deals with the probes, and generates a single merged report
// every second.
c := xfer.NewCollector(*batch)
c.AddAddresses(fixedAddresses)
for _, addr := range fixedAddresses {
c.Add(addr)
}
defer c.Stop()
publisher, err := xfer.NewTCPPublisher(*listen)
@@ -81,8 +83,8 @@ func interrupt() chan os.Signal {
type collector interface {
Reports() <-chan report.Report
RemoveAddress(string)
AddAddress(string)
Remove(string)
Add(string)
}
type publisher xfer.Publisher
@@ -143,7 +145,7 @@ func discover(c collector, p publisher, fixed []string) {
if _, ok := lastSeen[addr]; !ok {
if interestingAddress(localNets, addr) {
log.Printf("discovery %v: potential probe address", addr)
c.AddAddress(addressToDial(addr))
c.Add(addressToDial(addr))
} else {
log.Printf("discovery %v: non-probe address", addr)
}
@@ -164,7 +166,7 @@ func discover(c collector, p publisher, fixed []string) {
// anything.
log.Printf("discovery %v: traffic timeout", addr)
delete(lastSeen, addr)
c.RemoveAddress(addressToDial(addr))
c.Remove(addressToDial(addr))
}
}
}

View File

@@ -14,7 +14,9 @@ import (
func handleTXT(r Reporter) http.HandlerFunc {
return func(w http.ResponseWriter, req *http.Request) {
w.Header().Set("Content-Type", "text/plain")
dot(w, r.Report().Process.RenderBy(mapFunc(req), classView(req)))
dot(w, r.Report().Process.RenderBy(mapFunc(req), nil))
//report.Render(r.Report(), report.SelectEndpoint, mapFunc(req), report.NoPseudoNode))
}
}
@@ -30,7 +32,7 @@ func handleSVG(r Reporter) http.HandlerFunc {
cmd.Stdout = w
dot(wc, r.Report().Process.RenderBy(mapFunc(req), classView(req)))
dot(wc, r.Report().Process.RenderBy(mapFunc(req), nil))
wc.Close()
w.Header().Set("Content-Type", "image/svg+xml")

View File

@@ -27,7 +27,9 @@ func main() {
xfer.MaxBackoff = 10 * time.Second
c := xfer.NewCollector(*batch)
c.AddAddresses(strings.Split(*probes, ","))
for _, addr := range strings.Split(*probes, ",") {
c.Add(addr)
}
defer c.Stop()
lifo := NewReportLIFO(c, *window)
defer lifo.Stop()

View File

@@ -29,7 +29,9 @@ func main() {
// Collector deals with the probes, and generates merged reports.
xfer.MaxBackoff = 1 * time.Second
c := xfer.NewCollector(1 * time.Second)
c.AddAddresses(strings.Split(*probes, ","))
for _, addr := range strings.Split(*probes, ",") {
c.Add(addr)
}
defer c.Stop()
report := report.NewReport()