aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/smartystreets/goconvey/web/server
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/smartystreets/goconvey/web/server')
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/api/api.goconvey2
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/api/server.go164
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/contract/contracts.go27
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/contract/result.go100
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/executor/contract.go12
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/executor/coordinator.go71
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/executor/executor.go84
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/executor/executor.goconvey2
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/executor/tester.go56
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/messaging/messages.go56
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/parser/packageParser.go178
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/parser/parser.go32
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/parser/parser.goconvey2
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/parser/rules.go45
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/parser/testParser.go177
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/parser/util.go49
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/system/shell.go174
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/system/system.goconvey3
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/watch/functional_core.go171
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/watch/imperative_shell.go82
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/watch/integration.go183
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/watch/watch.goconvey3
22 files changed, 0 insertions, 1673 deletions
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/api/api.goconvey b/vendor/github.com/smartystreets/goconvey/web/server/api/api.goconvey
deleted file mode 100644
index 79982854..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/api/api.goconvey
+++ /dev/null
@@ -1,2 +0,0 @@
-#ignore
--timeout=1s
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/api/server.go b/vendor/github.com/smartystreets/goconvey/web/server/api/server.go
deleted file mode 100644
index 6cea26da..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/api/server.go
+++ /dev/null
@@ -1,164 +0,0 @@
-package api
-
-import (
- "encoding/json"
- "fmt"
- "net/http"
- "os"
- "strconv"
- "time"
-
- "github.com/smartystreets/goconvey/web/server/contract"
- "github.com/smartystreets/goconvey/web/server/messaging"
-)
-
-type HTTPServer struct {
- watcher chan messaging.WatcherCommand
- executor contract.Executor
- latest *contract.CompleteOutput
- currentRoot string
- longpoll chan chan string
- paused bool
-}
-
-func (self *HTTPServer) ReceiveUpdate(root string, update *contract.CompleteOutput) {
- self.currentRoot = root
- self.latest = update
-}
-
-func (self *HTTPServer) Watch(response http.ResponseWriter, request *http.Request) {
- if request.Method == "POST" {
- self.adjustRoot(response, request)
- } else if request.Method == "GET" {
- response.Write([]byte(self.currentRoot))
- }
-}
-
-func (self *HTTPServer) adjustRoot(response http.ResponseWriter, request *http.Request) {
- newRoot := self.parseQueryString("root", response, request)
- if newRoot == "" {
- return
- }
- info, err := os.Stat(newRoot) // TODO: how to unit test?
- if !info.IsDir() || err != nil {
- http.Error(response, err.Error(), http.StatusNotFound)
- return
- }
-
- self.watcher <- messaging.WatcherCommand{
- Instruction: messaging.WatcherAdjustRoot,
- Details: newRoot,
- }
-}
-
-func (self *HTTPServer) Ignore(response http.ResponseWriter, request *http.Request) {
- paths := self.parseQueryString("paths", response, request)
- if paths != "" {
- self.watcher <- messaging.WatcherCommand{
- Instruction: messaging.WatcherIgnore,
- Details: paths,
- }
- }
-}
-
-func (self *HTTPServer) Reinstate(response http.ResponseWriter, request *http.Request) {
- paths := self.parseQueryString("paths", response, request)
- if paths != "" {
- self.watcher <- messaging.WatcherCommand{
- Instruction: messaging.WatcherReinstate,
- Details: paths,
- }
- }
-}
-
-func (self *HTTPServer) parseQueryString(key string, response http.ResponseWriter, request *http.Request) string {
- value := request.URL.Query()[key]
-
- if len(value) == 0 {
- http.Error(response, fmt.Sprintf("No '%s' query string parameter included!", key), http.StatusBadRequest)
- return ""
- }
-
- path := value[0]
- if path == "" {
- http.Error(response, "You must provide a non-blank path.", http.StatusBadRequest)
- }
- return path
-}
-
-func (self *HTTPServer) Status(response http.ResponseWriter, request *http.Request) {
- status := self.executor.Status()
- response.Write([]byte(status))
-}
-
-func (self *HTTPServer) LongPollStatus(response http.ResponseWriter, request *http.Request) {
- if self.executor.ClearStatusFlag() {
- response.Write([]byte(self.executor.Status()))
- return
- }
-
- timeout, err := strconv.Atoi(request.URL.Query().Get("timeout"))
- if err != nil || timeout > 180000 || timeout < 0 {
- timeout = 60000 // default timeout is 60 seconds
- }
-
- myReqChan := make(chan string)
-
- select {
- case self.longpoll <- myReqChan: // this case means the executor's status is changing
- case <-time.After(time.Duration(timeout) * time.Millisecond): // this case means the executor hasn't changed status
- return
- }
-
- out := <-myReqChan
-
- if out != "" { // TODO: Why is this check necessary? Sometimes it writes empty string...
- response.Write([]byte(out))
- }
-}
-
-func (self *HTTPServer) Results(response http.ResponseWriter, request *http.Request) {
- response.Header().Set("Content-Type", "application/json")
- response.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
- response.Header().Set("Pragma", "no-cache")
- response.Header().Set("Expires", "0")
- if self.latest != nil {
- self.latest.Paused = self.paused
- }
- stuff, _ := json.Marshal(self.latest)
- response.Write(stuff)
-}
-
-func (self *HTTPServer) Execute(response http.ResponseWriter, request *http.Request) {
- go self.execute()
-}
-
-func (self *HTTPServer) execute() {
- self.watcher <- messaging.WatcherCommand{Instruction: messaging.WatcherExecute}
-}
-
-func (self *HTTPServer) TogglePause(response http.ResponseWriter, request *http.Request) {
- instruction := messaging.WatcherPause
- if self.paused {
- instruction = messaging.WatcherResume
- }
-
- self.watcher <- messaging.WatcherCommand{Instruction: instruction}
- self.paused = !self.paused
-
- fmt.Fprint(response, self.paused) // we could write out whatever helps keep the UI honest...
-}
-
-func NewHTTPServer(
- root string,
- watcher chan messaging.WatcherCommand,
- executor contract.Executor,
- status chan chan string) *HTTPServer {
-
- self := new(HTTPServer)
- self.currentRoot = root
- self.watcher = watcher
- self.executor = executor
- self.longpoll = status
- return self
-}
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/contract/contracts.go b/vendor/github.com/smartystreets/goconvey/web/server/contract/contracts.go
deleted file mode 100644
index e758f3e1..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/contract/contracts.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package contract
-
-import "net/http"
-
-type (
- Server interface {
- ReceiveUpdate(root string, update *CompleteOutput)
- Watch(writer http.ResponseWriter, request *http.Request)
- Ignore(writer http.ResponseWriter, request *http.Request)
- Reinstate(writer http.ResponseWriter, request *http.Request)
- Status(writer http.ResponseWriter, request *http.Request)
- LongPollStatus(writer http.ResponseWriter, request *http.Request)
- Results(writer http.ResponseWriter, request *http.Request)
- Execute(writer http.ResponseWriter, request *http.Request)
- TogglePause(writer http.ResponseWriter, request *http.Request)
- }
-
- Executor interface {
- ExecuteTests([]*Package) *CompleteOutput
- Status() string
- ClearStatusFlag() bool
- }
-
- Shell interface {
- GoTest(directory, packageName string, tags, arguments []string) (output string, err error)
- }
-)
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/contract/result.go b/vendor/github.com/smartystreets/goconvey/web/server/contract/result.go
deleted file mode 100644
index 8feef715..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/contract/result.go
+++ /dev/null
@@ -1,100 +0,0 @@
-package contract
-
-import (
- "github.com/smartystreets/goconvey/convey/reporting"
- "github.com/smartystreets/goconvey/web/server/messaging"
-)
-
-type Package struct {
- Path string
- Name string
- Ignored bool
- Disabled bool
- BuildTags []string
- TestArguments []string
- Error error
- Output string
- Result *PackageResult
-
- HasImportCycle bool
-}
-
-func NewPackage(folder *messaging.Folder, name string, hasImportCycle bool) *Package {
- self := new(Package)
- self.Path = folder.Path
- self.Name = name
- self.Result = NewPackageResult(self.Name)
- self.Ignored = folder.Ignored
- self.Disabled = folder.Disabled
- self.BuildTags = folder.BuildTags
- self.TestArguments = folder.TestArguments
- self.HasImportCycle = hasImportCycle
- return self
-}
-
-func (self *Package) Active() bool {
- return !self.Disabled && !self.Ignored
-}
-
-func (self *Package) HasUsableResult() bool {
- return self.Active() && (self.Error == nil || (self.Output != ""))
-}
-
-type CompleteOutput struct {
- Packages []*PackageResult
- Revision string
- Paused bool
-}
-
-var ( // PackageResult.Outcome values:
- Ignored = "ignored"
- Disabled = "disabled"
- Passed = "passed"
- Failed = "failed"
- Panicked = "panicked"
- BuildFailure = "build failure"
- NoTestFiles = "no test files"
- NoTestFunctions = "no test functions"
- NoGoFiles = "no go code"
-
- TestRunAbortedUnexpectedly = "test run aborted unexpectedly"
-)
-
-type PackageResult struct {
- PackageName string
- Elapsed float64
- Coverage float64
- Outcome string
- BuildOutput string
- TestResults []TestResult
-}
-
-func NewPackageResult(packageName string) *PackageResult {
- self := new(PackageResult)
- self.PackageName = packageName
- self.TestResults = []TestResult{}
- self.Coverage = -1
- return self
-}
-
-type TestResult struct {
- TestName string
- Elapsed float64
- Passed bool
- Skipped bool
- File string
- Line int
- Message string
- Error string
- Stories []reporting.ScopeResult
-
- RawLines []string `json:",omitempty"`
-}
-
-func NewTestResult(testName string) *TestResult {
- self := new(TestResult)
- self.Stories = []reporting.ScopeResult{}
- self.RawLines = []string{}
- self.TestName = testName
- return self
-}
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/executor/contract.go b/vendor/github.com/smartystreets/goconvey/web/server/executor/contract.go
deleted file mode 100644
index 209dbca5..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/executor/contract.go
+++ /dev/null
@@ -1,12 +0,0 @@
-package executor
-
-import "github.com/smartystreets/goconvey/web/server/contract"
-
-type Parser interface {
- Parse([]*contract.Package)
-}
-
-type Tester interface {
- SetBatchSize(batchSize int)
- TestAll(folders []*contract.Package)
-}
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/executor/coordinator.go b/vendor/github.com/smartystreets/goconvey/web/server/executor/coordinator.go
deleted file mode 100644
index 117dd56d..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/executor/coordinator.go
+++ /dev/null
@@ -1,71 +0,0 @@
-package executor
-
-import (
- "errors"
- "fmt"
- "log"
- "strings"
- "sync"
-
- "github.com/smartystreets/goconvey/web/server/contract"
-)
-
-type concurrentCoordinator struct {
- batchSize int
- queue chan *contract.Package
- folders []*contract.Package
- shell contract.Shell
- waiter sync.WaitGroup
-}
-
-func (self *concurrentCoordinator) ExecuteConcurrently() {
- self.enlistWorkers()
- self.scheduleTasks()
- self.awaitCompletion()
-}
-
-func (self *concurrentCoordinator) enlistWorkers() {
- for i := 0; i < self.batchSize; i++ {
- self.waiter.Add(1)
- go self.worker(i)
- }
-}
-func (self *concurrentCoordinator) worker(id int) {
- for folder := range self.queue {
- packageName := strings.Replace(folder.Name, "\\", "/", -1)
- if !folder.Active() {
- log.Printf("Skipping concurrent execution: %s\n", packageName)
- continue
- }
-
- if folder.HasImportCycle {
- message := fmt.Sprintf("can't load package: import cycle not allowed\npackage %s\n\timports %s", packageName, packageName)
- log.Println(message)
- folder.Output, folder.Error = message, errors.New(message)
- } else {
- log.Printf("Executing concurrent tests: %s\n", packageName)
- folder.Output, folder.Error = self.shell.GoTest(folder.Path, packageName, folder.BuildTags, folder.TestArguments)
- }
- }
- self.waiter.Done()
-}
-
-func (self *concurrentCoordinator) scheduleTasks() {
- for _, folder := range self.folders {
- self.queue <- folder
- }
-}
-
-func (self *concurrentCoordinator) awaitCompletion() {
- close(self.queue)
- self.waiter.Wait()
-}
-
-func newConcurrentCoordinator(folders []*contract.Package, batchSize int, shell contract.Shell) *concurrentCoordinator {
- self := new(concurrentCoordinator)
- self.queue = make(chan *contract.Package)
- self.folders = folders
- self.batchSize = batchSize
- self.shell = shell
- return self
-}
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/executor/executor.go b/vendor/github.com/smartystreets/goconvey/web/server/executor/executor.go
deleted file mode 100644
index 887080cc..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/executor/executor.go
+++ /dev/null
@@ -1,84 +0,0 @@
-package executor
-
-import (
- "log"
- "time"
-
- "github.com/smartystreets/goconvey/web/server/contract"
-)
-
-const (
- Idle = "idle"
- Executing = "executing"
-)
-
-type Executor struct {
- tester Tester
- parser Parser
- status string
- statusChan chan chan string
- statusFlag bool
-}
-
-func (self *Executor) Status() string {
- return self.status
-}
-
-func (self *Executor) ClearStatusFlag() bool {
- hasNewStatus := self.statusFlag
- self.statusFlag = false
- return hasNewStatus
-}
-
-func (self *Executor) ExecuteTests(folders []*contract.Package) *contract.CompleteOutput {
- defer func() { self.setStatus(Idle) }()
- self.execute(folders)
- result := self.parse(folders)
- return result
-}
-
-func (self *Executor) execute(folders []*contract.Package) {
- self.setStatus(Executing)
- self.tester.TestAll(folders)
-}
-
-func (self *Executor) parse(folders []*contract.Package) *contract.CompleteOutput {
- result := &contract.CompleteOutput{Revision: now().String()}
- self.parser.Parse(folders)
- for _, folder := range folders {
- result.Packages = append(result.Packages, folder.Result)
- }
- return result
-}
-
-func (self *Executor) setStatus(status string) {
- self.status = status
- self.statusFlag = true
-
-Loop:
- for {
- select {
- case c := <-self.statusChan:
- self.statusFlag = false
- c <- status
- default:
- break Loop
- }
- }
-
- log.Printf("Executor status: '%s'\n", self.status)
-}
-
-func NewExecutor(tester Tester, parser Parser, ch chan chan string) *Executor {
- return &Executor{
- tester: tester,
- parser: parser,
- status: Idle,
- statusChan: ch,
- statusFlag: false,
- }
-}
-
-var now = func() time.Time {
- return time.Now()
-}
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/executor/executor.goconvey b/vendor/github.com/smartystreets/goconvey/web/server/executor/executor.goconvey
deleted file mode 100644
index 79982854..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/executor/executor.goconvey
+++ /dev/null
@@ -1,2 +0,0 @@
-#ignore
--timeout=1s
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/executor/tester.go b/vendor/github.com/smartystreets/goconvey/web/server/executor/tester.go
deleted file mode 100644
index 76f353a5..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/executor/tester.go
+++ /dev/null
@@ -1,56 +0,0 @@
-package executor
-
-import (
- "errors"
- "fmt"
- "log"
- "strings"
-
- "github.com/smartystreets/goconvey/web/server/contract"
-)
-
-type ConcurrentTester struct {
- shell contract.Shell
- batchSize int
-}
-
-func (self *ConcurrentTester) SetBatchSize(batchSize int) {
- self.batchSize = batchSize
- log.Printf("Now configured to test %d packages concurrently.\n", self.batchSize)
-}
-
-func (self *ConcurrentTester) TestAll(folders []*contract.Package) {
- if self.batchSize == 1 {
- self.executeSynchronously(folders)
- } else {
- newConcurrentCoordinator(folders, self.batchSize, self.shell).ExecuteConcurrently()
- }
- return
-}
-
-func (self *ConcurrentTester) executeSynchronously(folders []*contract.Package) {
- for _, folder := range folders {
- packageName := strings.Replace(folder.Name, "\\", "/", -1)
- if !folder.Active() {
- log.Printf("Skipping execution: %s\n", packageName)
- continue
- }
- if folder.HasImportCycle {
- message := fmt.Sprintf("can't load package: import cycle not allowed\npackage %s\n\timports %s", packageName, packageName)
- log.Println(message)
- folder.Output, folder.Error = message, errors.New(message)
- } else {
- log.Printf("Executing tests: %s\n", packageName)
- folder.Output, folder.Error = self.shell.GoTest(folder.Path, packageName, folder.BuildTags, folder.TestArguments)
- }
- }
-}
-
-func NewConcurrentTester(shell contract.Shell) *ConcurrentTester {
- self := new(ConcurrentTester)
- self.shell = shell
- self.batchSize = defaultBatchSize
- return self
-}
-
-const defaultBatchSize = 10
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/messaging/messages.go b/vendor/github.com/smartystreets/goconvey/web/server/messaging/messages.go
deleted file mode 100644
index 7a920911..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/messaging/messages.go
+++ /dev/null
@@ -1,56 +0,0 @@
-package messaging
-
-///////////////////////////////////////////////////////////////////////////////
-
-type WatcherCommand struct {
- Instruction WatcherInstruction
- Details string
-}
-
-type WatcherInstruction int
-
-func (this WatcherInstruction) String() string {
- switch this {
- case WatcherPause:
- return "Pause"
- case WatcherResume:
- return "Resume"
- case WatcherIgnore:
- return "Ignore"
- case WatcherReinstate:
- return "Reinstate"
- case WatcherAdjustRoot:
- return "AdjustRoot"
- case WatcherExecute:
- return "Execute"
- case WatcherStop:
- return "Stop"
- default:
- return "UNKNOWN INSTRUCTION"
- }
-}
-
-const (
- WatcherPause WatcherInstruction = iota
- WatcherResume
- WatcherIgnore
- WatcherReinstate
- WatcherAdjustRoot
- WatcherExecute
- WatcherStop
-)
-
-///////////////////////////////////////////////////////////////////////////////
-
-type Folders map[string]*Folder
-
-type Folder struct {
- Path string // key
- Root string
- Ignored bool
- Disabled bool
- BuildTags []string
- TestArguments []string
-}
-
-///////////////////////////////////////////////////////////////////////////////
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/parser/packageParser.go b/vendor/github.com/smartystreets/goconvey/web/server/parser/packageParser.go
deleted file mode 100644
index 406cc68c..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/parser/packageParser.go
+++ /dev/null
@@ -1,178 +0,0 @@
-package parser
-
-import (
- "fmt"
- "regexp"
- "sort"
- "strconv"
- "strings"
-
- "github.com/smartystreets/goconvey/web/server/contract"
-)
-
-var (
- testNamePattern = regexp.MustCompile("^=== RUN:? +(.+)$")
-)
-
-func ParsePackageResults(result *contract.PackageResult, rawOutput string) {
- newOutputParser(result, rawOutput).parse()
-}
-
-type outputParser struct {
- raw string
- lines []string
- result *contract.PackageResult
- tests []*contract.TestResult
-
- // place holders for loops
- line string
- test *contract.TestResult
- testMap map[string]*contract.TestResult
-}
-
-func newOutputParser(result *contract.PackageResult, rawOutput string) *outputParser {
- self := new(outputParser)
- self.raw = strings.TrimSpace(rawOutput)
- self.lines = strings.Split(self.raw, "\n")
- self.result = result
- self.tests = []*contract.TestResult{}
- self.testMap = make(map[string]*contract.TestResult)
- return self
-}
-
-func (self *outputParser) parse() {
- self.separateTestFunctionsAndMetadata()
- self.parseEachTestFunction()
-}
-
-func (self *outputParser) separateTestFunctionsAndMetadata() {
- for _, self.line = range self.lines {
- if self.processNonTestOutput() {
- break
- }
- self.processTestOutput()
- }
-}
-func (self *outputParser) processNonTestOutput() bool {
- if noGoFiles(self.line) {
- self.recordFinalOutcome(contract.NoGoFiles)
-
- } else if buildFailed(self.line) {
- self.recordFinalOutcome(contract.BuildFailure)
-
- } else if noTestFiles(self.line) {
- self.recordFinalOutcome(contract.NoTestFiles)
-
- } else if noTestFunctions(self.line) {
- self.recordFinalOutcome(contract.NoTestFunctions)
-
- } else {
- return false
- }
- return true
-}
-
-func (self *outputParser) recordFinalOutcome(outcome string) {
- self.result.Outcome = outcome
- self.result.BuildOutput = strings.Join(self.lines, "\n")
-}
-
-func (self *outputParser) processTestOutput() {
- self.line = strings.TrimSpace(self.line)
- if isNewTest(self.line) {
- self.registerTestFunction()
-
- } else if isTestResult(self.line) {
- self.recordTestMetadata()
-
- } else if isPackageReport(self.line) {
- self.recordPackageMetadata()
-
- } else {
- self.saveLineForParsingLater()
-
- }
-}
-
-func (self *outputParser) registerTestFunction() {
- testNameReg := testNamePattern.FindStringSubmatch(self.line)
- if len(testNameReg) < 2 { // Test-related lines that aren't about a new test
- return
- }
- self.test = contract.NewTestResult(testNameReg[1])
- self.tests = append(self.tests, self.test)
- self.testMap[self.test.TestName] = self.test
-}
-func (self *outputParser) recordTestMetadata() {
- testName := strings.Split(self.line, " ")[2]
- if test, ok := self.testMap[testName]; ok {
- self.test = test
- self.test.Passed = !strings.HasPrefix(self.line, "--- FAIL: ")
- self.test.Skipped = strings.HasPrefix(self.line, "--- SKIP: ")
- self.test.Elapsed = parseTestFunctionDuration(self.line)
- }
-}
-func (self *outputParser) recordPackageMetadata() {
- if packageFailed(self.line) {
- self.recordTestingOutcome(contract.Failed)
-
- } else if packagePassed(self.line) {
- self.recordTestingOutcome(contract.Passed)
-
- } else if isCoverageSummary(self.line) {
- self.recordCoverageSummary(self.line)
- }
-}
-func (self *outputParser) recordTestingOutcome(outcome string) {
- self.result.Outcome = outcome
- fields := strings.Split(self.line, "\t")
- self.result.PackageName = strings.TrimSpace(fields[1])
- self.result.Elapsed = parseDurationInSeconds(fields[2], 3)
-}
-func (self *outputParser) recordCoverageSummary(summary string) {
- start := len("coverage: ")
- end := strings.Index(summary, "%")
- value := summary[start:end]
- parsed, err := strconv.ParseFloat(value, 64)
- if err != nil {
- self.result.Coverage = -1
- } else {
- self.result.Coverage = parsed
- }
-}
-func (self *outputParser) saveLineForParsingLater() {
- self.line = strings.TrimLeft(self.line, "\t")
- if self.test == nil {
- fmt.Println("Potential error parsing output of", self.result.PackageName, "; couldn't handle this stray line:", self.line)
- return
- }
- self.test.RawLines = append(self.test.RawLines, self.line)
-}
-
-// TestResults is a collection of TestResults that implements sort.Interface.
-type TestResults []contract.TestResult
-
-func (r TestResults) Len() int {
- return len(r)
-}
-
-// Less compares TestResults on TestName
-func (r TestResults) Less(i, j int) bool {
- return r[i].TestName < r[j].TestName
-}
-
-func (r TestResults) Swap(i, j int) {
- r[i], r[j] = r[j], r[i]
-}
-
-func (self *outputParser) parseEachTestFunction() {
- for _, self.test = range self.tests {
- self.test = parseTestOutput(self.test)
- if self.test.Error != "" {
- self.result.Outcome = contract.Panicked
- }
- self.test.RawLines = []string{}
- self.result.TestResults = append(self.result.TestResults, *self.test)
- }
- sort.Sort(TestResults(self.result.TestResults))
-}
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/parser/parser.go b/vendor/github.com/smartystreets/goconvey/web/server/parser/parser.go
deleted file mode 100644
index f6250caf..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/parser/parser.go
+++ /dev/null
@@ -1,32 +0,0 @@
-package parser
-
-import (
- "log"
-
- "github.com/smartystreets/goconvey/web/server/contract"
-)
-
-type Parser struct {
- parser func(*contract.PackageResult, string)
-}
-
-func (self *Parser) Parse(packages []*contract.Package) {
- for _, p := range packages {
- if p.Active() && p.HasUsableResult() {
- self.parser(p.Result, p.Output)
- } else if p.Ignored {
- p.Result.Outcome = contract.Ignored
- } else if p.Disabled {
- p.Result.Outcome = contract.Disabled
- } else {
- p.Result.Outcome = contract.TestRunAbortedUnexpectedly
- }
- log.Printf("[%s]: %s\n", p.Result.Outcome, p.Name)
- }
-}
-
-func NewParser(helper func(*contract.PackageResult, string)) *Parser {
- self := new(Parser)
- self.parser = helper
- return self
-}
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/parser/parser.goconvey b/vendor/github.com/smartystreets/goconvey/web/server/parser/parser.goconvey
deleted file mode 100644
index 79982854..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/parser/parser.goconvey
+++ /dev/null
@@ -1,2 +0,0 @@
-#ignore
--timeout=1s
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/parser/rules.go b/vendor/github.com/smartystreets/goconvey/web/server/parser/rules.go
deleted file mode 100644
index e632ec0e..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/parser/rules.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package parser
-
-import "strings"
-
-func noGoFiles(line string) bool {
- return strings.HasPrefix(line, "can't load package: ") &&
- (strings.Contains(line, ": no buildable Go source files in ") ||
- strings.Contains(line, ": no Go ") ||
- strings.Contains(line, "cannot find module providing package"))
-}
-func buildFailed(line string) bool {
- return strings.HasPrefix(line, "# ") ||
- strings.Contains(line, "cannot find package") ||
- (strings.HasPrefix(line, "can't load package: ") && !strings.Contains(line, ": no Go ")) ||
- (strings.Contains(line, ": found packages ") && strings.Contains(line, ".go) and ") && strings.Contains(line, ".go) in "))
-}
-func noTestFunctions(line string) bool {
- return line == "testing: warning: no tests to run"
-}
-func noTestFiles(line string) bool {
- return strings.HasPrefix(line, "?") && strings.Contains(line, "[no test files]")
-}
-func isNewTest(line string) bool {
- return strings.HasPrefix(line, "=== ")
-}
-func isTestResult(line string) bool {
- return strings.HasPrefix(line, "--- FAIL:") || strings.HasPrefix(line, "--- PASS:") || strings.HasPrefix(line, "--- SKIP:")
-}
-func isPackageReport(line string) bool {
- return (strings.HasPrefix(line, "FAIL") ||
- strings.HasPrefix(line, "exit status") ||
- strings.HasPrefix(line, "PASS") ||
- isCoverageSummary(line) ||
- packagePassed(line))
-}
-
-func packageFailed(line string) bool {
- return strings.HasPrefix(line, "FAIL\t")
-}
-func packagePassed(line string) bool {
- return strings.HasPrefix(line, "ok \t")
-}
-func isCoverageSummary(line string) bool {
- return strings.HasPrefix(line, "coverage: ") && strings.Contains(line, "% of statements")
-}
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/parser/testParser.go b/vendor/github.com/smartystreets/goconvey/web/server/parser/testParser.go
deleted file mode 100644
index 9fda9802..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/parser/testParser.go
+++ /dev/null
@@ -1,177 +0,0 @@
-package parser
-
-import (
- "encoding/json"
- "fmt"
- "strconv"
- "strings"
-
- "github.com/smartystreets/goconvey/convey/reporting"
- "github.com/smartystreets/goconvey/web/server/contract"
-)
-
-type testParser struct {
- test *contract.TestResult
- line string
- index int
- inJson bool
- jsonLines []string
- otherLines []string
-}
-
-func parseTestOutput(test *contract.TestResult) *contract.TestResult {
- parser := newTestParser(test)
- parser.parseTestFunctionOutput()
- return test
-}
-
-func newTestParser(test *contract.TestResult) *testParser {
- self := new(testParser)
- self.test = test
- return self
-}
-
-func (self *testParser) parseTestFunctionOutput() {
- if len(self.test.RawLines) > 0 {
- self.processLines()
- self.deserializeJson()
- self.composeCapturedOutput()
- }
-}
-
-func (self *testParser) processLines() {
- for self.index, self.line = range self.test.RawLines {
- if !self.processLine() {
- break
- }
- }
-}
-
-func (self *testParser) processLine() bool {
- if strings.HasSuffix(self.line, reporting.OpenJson) {
- self.inJson = true
- self.accountForOutputWithoutNewline()
-
- } else if self.line == reporting.CloseJson {
- self.inJson = false
-
- } else if self.inJson {
- self.jsonLines = append(self.jsonLines, self.line)
-
- } else if isPanic(self.line) {
- self.parsePanicOutput()
- return false
-
- } else if isGoTestLogOutput(self.line) {
- self.parseLogLocation()
-
- } else {
- self.otherLines = append(self.otherLines, self.line)
- }
- return true
-}
-
-// If fmt.Print(f) produces output with no \n and that output
-// is that last output before the framework spits out json
-// (which starts with ''>>>>>'') then without this code
-// all of the json is counted as output, not as json to be
-// parsed and displayed by the web UI.
-func (self *testParser) accountForOutputWithoutNewline() {
- prefix := strings.Split(self.line, reporting.OpenJson)[0]
- if prefix != "" {
- self.otherLines = append(self.otherLines, prefix)
- }
-}
-
-func (self *testParser) deserializeJson() {
- formatted := createArrayForJsonItems(self.jsonLines)
- var scopes []reporting.ScopeResult
- err := json.Unmarshal(formatted, &scopes)
- if err != nil {
- panic(fmt.Sprintf(bugReportRequest, err, formatted))
- }
- self.test.Stories = scopes
-}
-func (self *testParser) parsePanicOutput() {
- for index, line := range self.test.RawLines[self.index:] {
- self.parsePanicLocation(index, line)
- self.preserveStackTraceIndentation(index, line)
- }
- self.test.Error = strings.Join(self.test.RawLines, "\n")
-}
-func (self *testParser) parsePanicLocation(index int, line string) {
- if !panicLineHasMetadata(line) {
- return
- }
- metaLine := self.test.RawLines[index+4]
- fields := strings.Split(metaLine, " ")
- fileAndLine := strings.Split(fields[0], ":")
- self.test.File = fileAndLine[0]
- if len(fileAndLine) >= 2 {
- self.test.Line, _ = strconv.Atoi(fileAndLine[1])
- }
-}
-func (self *testParser) preserveStackTraceIndentation(index int, line string) {
- if panicLineShouldBeIndented(index, line) {
- self.test.RawLines[index] = "\t" + line
- }
-}
-func (self *testParser) parseLogLocation() {
- self.otherLines = append(self.otherLines, self.line)
- lineFields := strings.TrimSpace(self.line)
- if strings.HasPrefix(lineFields, "Error Trace:") {
- lineFields = strings.TrimPrefix(lineFields, "Error Trace:")
- }
- fields := strings.Split(lineFields, ":")
- self.test.File = strings.TrimSpace(fields[0])
- self.test.Line, _ = strconv.Atoi(fields[1])
-}
-
-func (self *testParser) composeCapturedOutput() {
- self.test.Message = strings.Join(self.otherLines, "\n")
-}
-
-func createArrayForJsonItems(lines []string) []byte {
- jsonArrayItems := strings.Join(lines, "")
- jsonArrayItems = removeTrailingComma(jsonArrayItems)
- return []byte(fmt.Sprintf("[%s]\n", jsonArrayItems))
-}
-func removeTrailingComma(rawJson string) string {
- if trailingComma(rawJson) {
- return rawJson[:len(rawJson)-1]
- }
- return rawJson
-}
-func trailingComma(value string) bool {
- return strings.HasSuffix(value, ",")
-}
-
-func isGoTestLogOutput(line string) bool {
- return strings.Count(line, ":") == 2
-}
-
-func isPanic(line string) bool {
- return strings.HasPrefix(line, "panic: ")
-}
-
-func panicLineHasMetadata(line string) bool {
- return strings.HasPrefix(line, "goroutine") && strings.Contains(line, "[running]")
-}
-func panicLineShouldBeIndented(index int, line string) bool {
- return strings.Contains(line, "+") || (index > 0 && strings.Contains(line, "panic: "))
-}
-
-const bugReportRequest = `
-Uh-oh! Looks like something went wrong. Please copy the following text and file a bug report at:
-
-https://github.com/smartystreets/goconvey/issues?state=open
-
-======= BEGIN BUG REPORT =======
-
-ERROR: %v
-
-OUTPUT: %s
-
-======= END BUG REPORT =======
-
-`
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/parser/util.go b/vendor/github.com/smartystreets/goconvey/web/server/parser/util.go
deleted file mode 100644
index 474bfa6d..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/parser/util.go
+++ /dev/null
@@ -1,49 +0,0 @@
-package parser
-
-import (
- "math"
- "strings"
- "time"
-)
-
-// parseTestFunctionDuration parses the duration in seconds as a float64
-// from a line of go test output that looks something like this:
-// --- PASS: TestOldSchool_PassesWithMessage (0.03 seconds)
-func parseTestFunctionDuration(line string) float64 {
- line = strings.Replace(line, "(", "", 1)
- line = strings.Replace(line, ")", "", 1)
- fields := strings.Split(line, " ")
- return parseDurationInSeconds(fields[3], 2)
-}
-
-func parseDurationInSeconds(raw string, precision int) float64 {
- elapsed, err := time.ParseDuration(raw)
- if err != nil {
- elapsed, _ = time.ParseDuration(raw + "s")
- }
- return round(elapsed.Seconds(), precision)
-}
-
-// round returns the rounded version of x with precision.
-//
-// Special cases are:
-// round(±0) = ±0
-// round(±Inf) = ±Inf
-// round(NaN) = NaN
-//
-// Why, oh why doesn't the math package come with a round function?
-// Inspiration: http://play.golang.org/p/ZmFfr07oHp
-func round(x float64, precision int) float64 {
- var rounder float64
- pow := math.Pow(10, float64(precision))
- intermediate := x * pow
-
- if intermediate < 0.0 {
- intermediate -= 0.5
- } else {
- intermediate += 0.5
- }
- rounder = float64(int64(intermediate))
-
- return rounder / float64(pow)
-}
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/system/shell.go b/vendor/github.com/smartystreets/goconvey/web/server/system/shell.go
deleted file mode 100644
index 0adb8942..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/system/shell.go
+++ /dev/null
@@ -1,174 +0,0 @@
-package system
-
-import (
- "log"
- "os/exec"
- "path/filepath"
- "regexp"
- "strings"
-)
-
-///////////////////////////////////////////////////////////////////////////////
-// Integration: ///////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-
-type Shell struct {
- coverage bool
- gobin string
- reportsPath string
- defaultTimeout string
-}
-
-func NewShell(gobin, reportsPath string, coverage bool, defaultTimeout string) *Shell {
- return &Shell{
- coverage: coverage,
- gobin: gobin,
- reportsPath: reportsPath,
- defaultTimeout: defaultTimeout,
- }
-}
-
-func (self *Shell) GoTest(directory, packageName string, tags, arguments []string) (output string, err error) {
- reportFilename := strings.Replace(packageName, "/", "-", -1)
- reportPath := filepath.Join(self.reportsPath, reportFilename)
- reportData := reportPath + ".txt"
- reportHTML := reportPath + ".html"
- tagsArg := "-tags=" + strings.Join(tags, ",")
-
- goconvey := findGoConvey(directory, self.gobin, packageName, tagsArg).Execute()
- compilation := compile(directory, self.gobin, tagsArg).Execute()
- withCoverage := runWithCoverage(compilation, goconvey, self.coverage, reportData, directory, self.gobin, self.defaultTimeout, tagsArg, arguments).Execute()
- final := runWithoutCoverage(compilation, withCoverage, goconvey, directory, self.gobin, self.defaultTimeout, tagsArg, arguments).Execute()
- go generateReports(final, self.coverage, directory, self.gobin, reportData, reportHTML).Execute()
-
- return final.Output, final.Error
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Functional Core:////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-
-func findGoConvey(directory, gobin, packageName, tagsArg string) Command {
- return NewCommand(directory, gobin, "list", "-f", "'{{.TestImports}}{{.XTestImports}}'", tagsArg, packageName)
-}
-
-func compile(directory, gobin, tagsArg string) Command {
- return NewCommand(directory, gobin, "test", "-i", tagsArg)
-}
-
-func runWithCoverage(compile, goconvey Command, coverage bool, reportPath, directory, gobin, defaultTimeout, tagsArg string, customArguments []string) Command {
- if compile.Error != nil || goconvey.Error != nil {
- return compile
- }
-
- if !coverage {
- return compile
- }
-
- arguments := []string{"test", "-v", "-coverprofile=" + reportPath, tagsArg}
-
- customArgsText := strings.Join(customArguments, "\t")
- if !strings.Contains(customArgsText, "-covermode=") {
- arguments = append(arguments, "-covermode=set")
- }
-
- if !strings.Contains(customArgsText, "-timeout=") {
- arguments = append(arguments, "-timeout="+defaultTimeout)
- }
-
- if strings.Contains(goconvey.Output, goconveyDSLImport) {
- arguments = append(arguments, "-convey-json")
- }
-
- arguments = append(arguments, customArguments...)
-
- return NewCommand(directory, gobin, arguments...)
-}
-
-func runWithoutCoverage(compile, withCoverage, goconvey Command, directory, gobin, defaultTimeout, tagsArg string, customArguments []string) Command {
- if compile.Error != nil {
- return compile
- }
-
- if goconvey.Error != nil {
- log.Println(gopathProblem, goconvey.Output, goconvey.Error)
- return goconvey
- }
-
- if coverageStatementRE.MatchString(withCoverage.Output) {
- return withCoverage
- }
-
- log.Printf("Coverage output: %v", withCoverage.Output)
-
- log.Print("Run without coverage")
-
- arguments := []string{"test", "-v", tagsArg}
- customArgsText := strings.Join(customArguments, "\t")
- if !strings.Contains(customArgsText, "-timeout=") {
- arguments = append(arguments, "-timeout="+defaultTimeout)
- }
-
- if strings.Contains(goconvey.Output, goconveyDSLImport) {
- arguments = append(arguments, "-convey-json")
- }
- arguments = append(arguments, customArguments...)
- return NewCommand(directory, gobin, arguments...)
-}
-
-func generateReports(previous Command, coverage bool, directory, gobin, reportData, reportHTML string) Command {
- if previous.Error != nil {
- return previous
- }
-
- if !coverage {
- return previous
- }
-
- return NewCommand(directory, gobin, "tool", "cover", "-html="+reportData, "-o", reportHTML)
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Imperative Shell: //////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-
-type Command struct {
- directory string
- executable string
- arguments []string
-
- Output string
- Error error
-}
-
-func NewCommand(directory, executable string, arguments ...string) Command {
- return Command{
- directory: directory,
- executable: executable,
- arguments: arguments,
- }
-}
-
-func (this Command) Execute() Command {
- if len(this.executable) == 0 {
- return this
- }
-
- if len(this.Output) > 0 || this.Error != nil {
- return this
- }
-
- command := exec.Command(this.executable, this.arguments...)
- command.Dir = this.directory
- var rawOutput []byte
- rawOutput, this.Error = command.CombinedOutput()
- this.Output = string(rawOutput)
- return this
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-const goconveyDSLImport = "github.com/smartystreets/goconvey/convey " // note the trailing space: we don't want to target packages nested in the /convey package.
-const gopathProblem = "Please run goconvey from within $GOPATH/src (also, symlinks might be problematic). Output and Error: "
-
-var coverageStatementRE = regexp.MustCompile(`(?m)^coverage: \d+\.\d% of statements(.*)$|^panic: test timed out after `)
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/system/system.goconvey b/vendor/github.com/smartystreets/goconvey/web/server/system/system.goconvey
deleted file mode 100644
index aa26e8b7..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/system/system.goconvey
+++ /dev/null
@@ -1,3 +0,0 @@
-#ignore
--timeout=1s
--short \ No newline at end of file
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/watch/functional_core.go b/vendor/github.com/smartystreets/goconvey/web/server/watch/functional_core.go
deleted file mode 100644
index 404a25d3..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/watch/functional_core.go
+++ /dev/null
@@ -1,171 +0,0 @@
-package watch
-
-import (
- "os"
- "path/filepath"
- "strings"
-
- "github.com/smartystreets/goconvey/web/server/messaging"
-)
-
-///////////////////////////////////////////////////////////////////////////////
-
-func Categorize(items chan *FileSystemItem, root string, watchSuffixes []string) (folders, profiles, goFiles []*FileSystemItem) {
- for item := range items {
- if item.IsFolder && !isHidden(item.Name) && !foundInHiddenDirectory(item, root) {
- folders = append(folders, item)
-
- } else if strings.HasSuffix(item.Name, ".goconvey") && len(item.Name) > len(".goconvey") {
- profiles = append(profiles, item)
-
- } else {
- for _, suffix := range watchSuffixes {
- if strings.HasSuffix(item.Name, suffix) && !isHidden(item.Name) && !foundInHiddenDirectory(item, root) {
- goFiles = append(goFiles, item)
- }
- }
- }
- }
- return folders, profiles, goFiles
-}
-
-func foundInHiddenDirectory(item *FileSystemItem, root string) bool {
- path := item.Path
- if len(path) > len(root) {
- path = path[len(root):]
- }
-
- for _, folder := range strings.Split(filepath.Dir(path), slash) {
- if isHidden(folder) {
- return true
- }
- }
-
- return false
-}
-func isHidden(path string) bool {
- return strings.HasPrefix(path, ".") || strings.HasPrefix(path, "_") || strings.HasPrefix(path, "flymake_")
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-func ParseProfile(profile string) (isDisabled bool, tags, arguments []string) {
- lines := strings.Split(profile, "\n")
-
- for _, line := range lines {
- line = strings.TrimSpace(line)
-
- if len(arguments) == 0 && strings.ToLower(line) == "ignore" {
- return true, nil, nil
-
- } else if strings.HasPrefix(line, "-tags=") {
- tags = append(tags, strings.Split(strings.SplitN(line, "=", 2)[1], ",")...)
- continue
-
- } else if len(line) == 0 {
- continue
-
- } else if strings.HasPrefix(line, "#") {
- continue
-
- } else if strings.HasPrefix(line, "//") {
- continue
-
- } else if line == "-cover" || strings.HasPrefix(line, "-coverprofile") {
- continue
-
- } else if line == "-v" {
- continue // Verbose mode is always enabled so there is no need to record it here.
-
- }
-
- arguments = append(arguments, line)
- }
-
- return false, tags, arguments
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-func CreateFolders(items []*FileSystemItem) messaging.Folders {
- folders := map[string]*messaging.Folder{}
-
- for _, item := range items {
- folders[item.Path] = &messaging.Folder{Path: item.Path, Root: item.Root}
- }
-
- return folders
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-func LimitDepth(folders messaging.Folders, depth int) {
- if depth < 0 {
- return
- }
-
- for path, folder := range folders {
- if strings.Count(path[len(folder.Root):], slash) > depth {
- delete(folders, path)
- }
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-func AttachProfiles(folders messaging.Folders, items []*FileSystemItem) {
- for _, profile := range items {
- if folder, exists := folders[filepath.Dir(profile.Path)]; exists {
- folder.Disabled, folder.BuildTags, folder.TestArguments = profile.ProfileDisabled, profile.ProfileTags, profile.ProfileArguments
- }
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-func MarkIgnored(folders messaging.Folders, ignored map[string]struct{}) {
- if len(ignored) == 0 {
- return
- }
-
- for _, folder := range folders {
- for ignored := range ignored {
- if !folder.Ignored && strings.HasSuffix(folder.Path, ignored) {
- folder.Ignored = true
- }
- }
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-func ActiveFolders(folders messaging.Folders) messaging.Folders {
- var active messaging.Folders = map[string]*messaging.Folder{}
-
- for path, folder := range folders {
- if folder.Ignored || folder.Disabled {
- continue
- }
-
- active[path] = folder
- }
- return active
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-func Sum(folders messaging.Folders, items []*FileSystemItem) int64 {
- var sum int64
- for _, item := range items {
- if _, exists := folders[filepath.Dir(item.Path)]; exists {
- sum += item.Size + item.Modified
- }
- }
- return sum
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-const slash = string(os.PathSeparator)
-
-///////////////////////////////////////////////////////////////////////////////
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/watch/imperative_shell.go b/vendor/github.com/smartystreets/goconvey/web/server/watch/imperative_shell.go
deleted file mode 100644
index 9d9890d2..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/watch/imperative_shell.go
+++ /dev/null
@@ -1,82 +0,0 @@
-package watch
-
-import (
- "io"
- "io/ioutil"
- "os"
- "path/filepath"
- "strings"
-)
-
-///////////////////////////////////////////////////////////////////////////////
-
-type FileSystemItem struct {
- Root string
- Path string
- Name string
- Size int64
- Modified int64
- IsFolder bool
-
- ProfileDisabled bool
- ProfileTags []string
- ProfileArguments []string
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-func YieldFileSystemItems(root string, excludedDirs []string) chan *FileSystemItem {
- items := make(chan *FileSystemItem)
-
- go func() {
- filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
- if err != nil {
- return filepath.SkipDir
- }
-
- if info.IsDir() && strings.HasPrefix(info.Name(), ".") {
- return filepath.SkipDir
- }
-
- basePath := filepath.Base(path)
- for _, item := range excludedDirs {
- if item == basePath && info.IsDir() && item != "" && basePath != "" {
- return filepath.SkipDir
- }
- }
-
- items <- &FileSystemItem{
- Root: root,
- Path: path,
- Name: info.Name(),
- Size: info.Size(),
- Modified: info.ModTime().Unix(),
- IsFolder: info.IsDir(),
- }
-
- return nil
- })
- close(items)
- }()
-
- return items
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-// ReadContents reads files wholesale. This function is only called on files
-// that end in '.goconvey'. These files should be very small, probably not
-// ever more than a few hundred bytes. The ignored errors are ok because in
-// the event of an IO error all that need be returned is an empty string.
-func ReadContents(path string) string {
- file, err := os.Open(path)
- if err != nil {
- return ""
- }
- defer file.Close()
- reader := io.LimitReader(file, 1024*4)
- content, _ := ioutil.ReadAll(reader)
- return string(content)
-}
-
-///////////////////////////////////////////////////////////////////////////////
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/watch/integration.go b/vendor/github.com/smartystreets/goconvey/web/server/watch/integration.go
deleted file mode 100644
index 9827c043..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/watch/integration.go
+++ /dev/null
@@ -1,183 +0,0 @@
-package watch
-
-import (
- "log"
- "os"
- "strings"
- "sync"
- "time"
-
- "github.com/smartystreets/goconvey/web/server/messaging"
-)
-
-type Watcher struct {
- nap time.Duration
- rootFolder string
- folderDepth int
- ignoredFolders map[string]struct{}
- fileSystemState int64
- paused bool
- stopped bool
- watchSuffixes []string
- excludedDirs []string
-
- input chan messaging.WatcherCommand
- output chan messaging.Folders
-
- lock sync.RWMutex
-}
-
-func NewWatcher(rootFolder string, folderDepth int, nap time.Duration,
- input chan messaging.WatcherCommand, output chan messaging.Folders, watchSuffixes string, excludedDirs []string) *Watcher {
-
- return &Watcher{
- nap: nap,
- rootFolder: rootFolder,
- folderDepth: folderDepth,
- input: input,
- output: output,
- watchSuffixes: strings.Split(watchSuffixes, ","),
- excludedDirs: excludedDirs,
-
- ignoredFolders: make(map[string]struct{}),
- }
-}
-
-func (this *Watcher) Listen() {
- for {
- if this.stopped {
- return
- }
-
- select {
-
- case command := <-this.input:
- this.respond(command)
-
- default:
- if !this.paused {
- this.scan()
- }
- time.Sleep(this.nap)
- }
- }
-}
-
-func (this *Watcher) respond(command messaging.WatcherCommand) {
- switch command.Instruction {
-
- case messaging.WatcherAdjustRoot:
- log.Println("Adjusting root...")
- this.rootFolder = command.Details
- this.execute()
-
- case messaging.WatcherIgnore:
- log.Println("Ignoring specified folders")
- this.ignore(command.Details)
- // Prevent a filesystem change due to the number of active folders changing
- _, checksum := this.gather()
- this.set(checksum)
-
- case messaging.WatcherReinstate:
- log.Println("Reinstating specified folders")
- this.reinstate(command.Details)
- // Prevent a filesystem change due to the number of active folders changing
- _, checksum := this.gather()
- this.set(checksum)
-
- case messaging.WatcherPause:
- log.Println("Pausing watcher...")
- this.paused = true
-
- case messaging.WatcherResume:
- log.Println("Resuming watcher...")
- this.paused = false
-
- case messaging.WatcherExecute:
- log.Println("Gathering folders for immediate execution...")
- this.execute()
-
- case messaging.WatcherStop:
- log.Println("Stopping the watcher...")
- close(this.output)
- this.stopped = true
-
- default:
- log.Println("Unrecognized command from server:", command.Instruction)
- }
-}
-
-func (this *Watcher) execute() {
- folders, _ := this.gather()
- this.sendToExecutor(folders)
-}
-
-func (this *Watcher) scan() {
- folders, checksum := this.gather()
-
- if checksum == this.fileSystemState {
- return
- }
-
- log.Println("File system state modified, publishing current folders...", this.fileSystemState, checksum)
-
- defer this.set(checksum)
- this.sendToExecutor(folders)
-}
-
-func (this *Watcher) gather() (folders messaging.Folders, checksum int64) {
- items := YieldFileSystemItems(this.rootFolder, this.excludedDirs)
- folderItems, profileItems, goFileItems := Categorize(items, this.rootFolder, this.watchSuffixes)
-
- for _, item := range profileItems {
- // TODO: don't even bother if the item's size is over a few hundred bytes...
- contents := ReadContents(item.Path)
- item.ProfileDisabled, item.ProfileTags, item.ProfileArguments = ParseProfile(contents)
- }
-
- folders = CreateFolders(folderItems)
- LimitDepth(folders, this.folderDepth)
- AttachProfiles(folders, profileItems)
- this.protectedRead(func() { MarkIgnored(folders, this.ignoredFolders) })
-
- active := ActiveFolders(folders)
- checksum = int64(len(active))
- checksum += Sum(active, profileItems)
- checksum += Sum(active, goFileItems)
-
- return folders, checksum
-}
-
-func (this *Watcher) set(state int64) {
- this.fileSystemState = state
-}
-
-func (this *Watcher) sendToExecutor(folders messaging.Folders) {
- this.output <- folders
-}
-
-func (this *Watcher) ignore(paths string) {
- this.protectedWrite(func() {
- for _, folder := range strings.Split(paths, string(os.PathListSeparator)) {
- this.ignoredFolders[folder] = struct{}{}
- log.Println("Currently ignored folders:", this.ignoredFolders)
- }
- })
-}
-func (this *Watcher) reinstate(paths string) {
- this.protectedWrite(func() {
- for _, folder := range strings.Split(paths, string(os.PathListSeparator)) {
- delete(this.ignoredFolders, folder)
- }
- })
-}
-func (this *Watcher) protectedWrite(protected func()) {
- this.lock.Lock()
- defer this.lock.Unlock()
- protected()
-}
-func (this *Watcher) protectedRead(protected func()) {
- this.lock.RLock()
- defer this.lock.RUnlock()
- protected()
-}
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/watch/watch.goconvey b/vendor/github.com/smartystreets/goconvey/web/server/watch/watch.goconvey
deleted file mode 100644
index aa26e8b7..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/watch/watch.goconvey
+++ /dev/null
@@ -1,3 +0,0 @@
-#ignore
--timeout=1s
--short \ No newline at end of file