From 6cb629a0581aa73da99cff43d8f017ba968c0e42 Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Mon, 30 Apr 2018 18:36:34 -0700 Subject: [PATCH 01/14] Add coverage target in Makefile for coverage reporting Signed-off-by: Joffrey F --- .gitignore | 1 + Makefile | 9 +++++++++ codecoverage/coverage-bin | 7 +++++++ main_test.go | 9 +++++++++ 4 files changed, 26 insertions(+) create mode 100755 codecoverage/coverage-bin create mode 100644 main_test.go diff --git a/.gitignore b/.gitignore index 5e28c3605..1f0f0b701 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.tar.gz *.dockerapp _build/ +codecoverage/*.out !examples/simple/*.dockerapp diff --git a/Makefile b/Makefile index 30251696a..8a6170d89 100644 --- a/Makefile +++ b/Makefile @@ -84,6 +84,15 @@ unit-test: clean: rm -Rf ./_build docker-app-*.tar.gz +coverage-bin: + $(GO_TEST) -coverpkg="./..." -c -tags testrunmain -o _build/$(BIN_NAME).cov + +coverage: coverage-bin + DOCKERAPP_BINARY=../codecoverage/coverage-bin $(GO_TEST) -v ./e2e + $(GO_TEST) -cover -test.coverprofile=codecoverage/unit.out $(shell go list ./... | grep -vE '/vendor/|/e2e') + gocovmerge codecoverage/*.out > codecoverage/all.out + go tool cover -func codecoverage/all.out + ########################## # Continuous Integration # ########################## diff --git a/codecoverage/coverage-bin b/codecoverage/coverage-bin new file mode 100755 index 000000000..27bc846eb --- /dev/null +++ b/codecoverage/coverage-bin @@ -0,0 +1,7 @@ +#!/bin/sh + +# This script is a proxy that injects the required test flags and strips out test output +# It allows us to use a coverage-enabled binary for e2e tests + +../_build/docker-app.cov $* -test.v -test.coverprofile=../codecoverage/e2e.out | \ +grep -vE '^PASS$' | grep -vE '^coverage: [0-9]+\.[0-9]+% of statements in .+$' | grep -v '^=== RUN TestRunMain$' diff --git a/main_test.go b/main_test.go new file mode 100644 index 000000000..e2a6aee45 --- /dev/null +++ b/main_test.go @@ -0,0 +1,9 @@ +// +build testrunmain + +package main + +import "testing" + +func TestRunMain(t *testing.T) { + main() +} From eff17e75189ed689fe51414339451521ba042441 Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Tue, 1 May 2018 15:02:40 -0700 Subject: [PATCH 02/14] Vendor gocovmerge tool Signed-off-by: Joffrey F --- Gopkg.lock | 13 +- Gopkg.toml | 6 + vendor/github.com/docker/yatee/yatee/yatee.go | 66 ++---- vendor/github.com/wadey/gocovmerge/LICENSE | 22 ++ .../github.com/wadey/gocovmerge/gocovmerge.go | 111 +++++++++ vendor/golang.org/x/tools/AUTHORS | 3 + vendor/golang.org/x/tools/CONTRIBUTORS | 3 + vendor/golang.org/x/tools/LICENSE | 27 +++ vendor/golang.org/x/tools/PATENTS | 22 ++ vendor/golang.org/x/tools/cmd/getgo/LICENSE | 27 +++ vendor/golang.org/x/tools/cover/profile.go | 213 ++++++++++++++++++ .../x/tools/third_party/moduleloader/LICENSE | 22 ++ .../x/tools/third_party/typescript/LICENSE | 55 +++++ .../x/tools/third_party/webcomponents/LICENSE | 27 +++ 14 files changed, 575 insertions(+), 42 deletions(-) create mode 100644 vendor/github.com/wadey/gocovmerge/LICENSE create mode 100644 vendor/github.com/wadey/gocovmerge/gocovmerge.go create mode 100644 vendor/golang.org/x/tools/AUTHORS create mode 100644 vendor/golang.org/x/tools/CONTRIBUTORS create mode 100644 vendor/golang.org/x/tools/LICENSE create mode 100644 vendor/golang.org/x/tools/PATENTS create mode 100644 vendor/golang.org/x/tools/cmd/getgo/LICENSE create mode 100644 vendor/golang.org/x/tools/cover/profile.go create mode 100644 vendor/golang.org/x/tools/third_party/moduleloader/LICENSE create mode 100644 vendor/golang.org/x/tools/third_party/typescript/LICENSE create mode 100644 vendor/golang.org/x/tools/third_party/webcomponents/LICENSE diff --git a/Gopkg.lock b/Gopkg.lock index 82954d27a..610ee9f5b 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -491,6 +491,12 @@ ] revision = "2b39e81caa26d9b0392f637d83520cb244390ffa" +[[projects]] + branch = "master" + name = "github.com/wadey/gocovmerge" + packages = ["."] + revision = "b5bfa59ec0adc420475f97f89b58045c721d761c" + [[projects]] branch = "master" name = "github.com/xeipuuv/gojsonpointer" @@ -574,6 +580,11 @@ packages = ["rate"] revision = "fbb02b2291d28baffd63558aa44b4b56f178d650" +[[projects]] + name = "golang.org/x/tools" + packages = ["cover"] + revision = "5c8013c5617234a9515f1b1379aba7e03e846479" + [[projects]] branch = "master" name = "google.golang.org/genproto" @@ -771,6 +782,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "a4b9c982d2f79a4c3ba9232dd354bb8069819070233f81b6285697c0dff72e23" + inputs-digest = "7d50265f6c7fa2c559e6dd2f27991d2560779a24a2dc0b69af3d24e9b4ccb7c7" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index d3f932a7f..a7bc5a377 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -20,6 +20,8 @@ # name = "github.com/x/y" # version = "2.4.0" +required = ["github.com/wadey/gocovmerge"] + [[constraint]] name = "github.com/spf13/cobra" @@ -38,6 +40,10 @@ name = "github.com/gotestyourself/gotestyourself" branch = "master" +[[constraint]] + name = "github.com/wadey/gocovmerge" + branch = "master" + [[constraint]] name = "github.com/sirupsen/logrus" version = "v1.0.5" diff --git a/vendor/github.com/docker/yatee/yatee/yatee.go b/vendor/github.com/docker/yatee/yatee/yatee.go index 7aefe8843..40a3fd97f 100644 --- a/vendor/github.com/docker/yatee/yatee/yatee.go +++ b/vendor/github.com/docker/yatee/yatee/yatee.go @@ -20,7 +20,7 @@ type options struct { } // flatten flattens a structure: foo.bar.baz -> 'foo.bar.baz' -func flatten(in map[string]interface{}, out map[string]interface{}, prefix string) { +func flatten(in map[string]interface{}, out map[string]string, prefix string) { for k, v := range in { switch vv := v.(type) { case string: @@ -34,7 +34,7 @@ func flatten(in map[string]interface{}, out map[string]interface{}, prefix strin } out[prefix+k] = strings.Join(values, " ") default: - out[prefix+k] = v + out[prefix+k] = fmt.Sprintf("%v", v) } } } @@ -196,23 +196,21 @@ func evalSub(comps []string, i int) (int64, int, error) { } // resolves an arithmetic expression -func evalExpr(expr string) (int64, error) { +func evalExpr(expr string) (string, error) { comps, err := tokenize(expr) if err != nil { - return 0, err + return "", err } v, _, err := evalSub(comps, 0) - return v, err + return fmt.Sprintf("%v", v), err } // resolves and evaluate all ${foo.bar}, $foo.bar and $(expr) in epr -func eval(expr string, flattened map[string]interface{}, o options) (interface{}, error) { +func eval(expr string, flattened map[string]string, o options) (string, error) { // Since we go from right to left to support nesting, handling $$ escape is // painful, so just hide them and restore them at the end expr = strings.Replace(expr, "$$", "\x00", -1) end := len(expr) - // If evaluation resolves to a single value, return the type value, not a string - var bypass interface{} iteration := 0 for { iteration++ @@ -223,12 +221,11 @@ func eval(expr string, flattened map[string]interface{}, o options) (interface{} if i == -1 { break } - bypass = nil comp, err := extract(expr[i+1:]) if err != nil { return "", err } - var val interface{} + var val string if len(comp) != 0 && comp[0] == '(' { var err error val, err = evalExpr(comp[1 : len(comp)-1]) @@ -247,7 +244,7 @@ func eval(expr string, flattened map[string]interface{}, o options) (interface{} } variable := content[0:q] val, ok = flattened[variable] - if isTrue(fmt.Sprintf("%v", val)) { + if isTrue(val) { val = content[q+1 : s] } else { val = content[s+1:] @@ -265,16 +262,9 @@ func eval(expr string, flattened map[string]interface{}, o options) (interface{} fmt.Fprintf(os.Stderr, "variable '%s' not set, expanding to empty string", comp) } } - valstr := fmt.Sprintf("%v", val) - expr = expr[0:i] + valstr + expr[i+1+len(comp):] - if strings.Trim(expr, " ") == valstr { - bypass = val - } + expr = expr[0:i] + val + expr[i+1+len(comp):] end = len(expr) } - if bypass != nil { - return bypass, nil - } expr = strings.Replace(expr, "\x00", "$", -1) return expr, nil } @@ -289,7 +279,7 @@ func isTrue(cond string) bool { return (cond != "" && cond != "false" && cond != "0") != reverse } -func recurseList(input []interface{}, settings map[string]interface{}, flattened map[string]interface{}, o options) ([]interface{}, error) { +func recurseList(input []interface{}, settings map[string]interface{}, flattened map[string]string, o options) ([]interface{}, error) { var res []interface{} for _, v := range input { switch vv := v.(type) { @@ -310,20 +300,18 @@ func recurseList(input []interface{}, settings map[string]interface{}, flattened if err != nil { return nil, err } - if vvvs, ok := vvv.(string); ok { - trimed := strings.TrimLeft(vvvs, " ") - if strings.HasPrefix(trimed, "@if") { - be := strings.Index(trimed, "(") - ee := strings.Index(trimed, ")") - if be == -1 || ee == -1 || be > ee { - return nil, fmt.Errorf("parse error looking for if condition in '%s'", vvv) - } - cond := trimed[be+1 : ee] - if isTrue(cond) { - res = append(res, strings.Trim(trimed[ee+1:], " ")) - } - continue + trimed := strings.TrimLeft(vvv, " ") + if strings.HasPrefix(trimed, "@if") { + be := strings.Index(trimed, "(") + ee := strings.Index(trimed, ")") + if be == -1 || ee == -1 || be > ee { + return nil, fmt.Errorf("parse error looking for if condition in '%s'", vvv) } + cond := trimed[be+1 : ee] + if isTrue(cond) { + res = append(res, strings.Trim(trimed[ee+1:], " ")) + } + continue } res = append(res, vvv) default: @@ -333,7 +321,7 @@ func recurseList(input []interface{}, settings map[string]interface{}, flattened return res, nil } -func recurse(input map[interface{}]interface{}, settings map[string]interface{}, flattened map[string]interface{}, o options) (map[interface{}]interface{}, error) { +func recurse(input map[interface{}]interface{}, settings map[string]interface{}, flattened map[string]string, o options) (map[interface{}]interface{}, error) { res := make(map[interface{}]interface{}) for k, v := range input { rk := k @@ -388,14 +376,10 @@ func recurse(input map[interface{}]interface{}, settings map[string]interface{}, } comps := strings.SplitN(trimed, " ", 4) varname := comps[1] - varrangeraw, err := eval(comps[3], flattened, o) + varrange, err := eval(comps[3], flattened, o) if err != nil { return nil, err } - varrange, ok := varrangeraw.(string) - if !ok { - return nil, fmt.Errorf("@for argument must be a string") - } mayberange := strings.Split(varrange, "..") if len(mayberange) == 2 { rangestart, err := strconv.ParseInt(mayberange[0], 0, 64) @@ -441,7 +425,7 @@ func recurse(input map[interface{}]interface{}, settings map[string]interface{}, if !ok { return nil, fmt.Errorf("@if value must be a mapping") } - if isTrue(fmt.Sprintf("%v", cond)) { + if isTrue(cond) { val, err := recurse(mii, settings, flattened, o) if err != nil { return nil, err @@ -533,7 +517,7 @@ func Process(inputString string, settings map[string]interface{}, opts ...string if err != nil { return nil, err } - flattened := make(map[string]interface{}) + flattened := make(map[string]string) flatten(settings, flattened, "") return recurse(input, settings, flattened, o) } diff --git a/vendor/github.com/wadey/gocovmerge/LICENSE b/vendor/github.com/wadey/gocovmerge/LICENSE new file mode 100644 index 000000000..455fb1087 --- /dev/null +++ b/vendor/github.com/wadey/gocovmerge/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2015, Wade Simmons +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/wadey/gocovmerge/gocovmerge.go b/vendor/github.com/wadey/gocovmerge/gocovmerge.go new file mode 100644 index 000000000..e8099839e --- /dev/null +++ b/vendor/github.com/wadey/gocovmerge/gocovmerge.go @@ -0,0 +1,111 @@ +// gocovmerge takes the results from multiple `go test -coverprofile` runs and +// merges them into one profile +package main + +import ( + "flag" + "fmt" + "io" + "log" + "os" + "sort" + + "golang.org/x/tools/cover" +) + +func mergeProfiles(p *cover.Profile, merge *cover.Profile) { + if p.Mode != merge.Mode { + log.Fatalf("cannot merge profiles with different modes") + } + // Since the blocks are sorted, we can keep track of where the last block + // was inserted and only look at the blocks after that as targets for merge + startIndex := 0 + for _, b := range merge.Blocks { + startIndex = mergeProfileBlock(p, b, startIndex) + } +} + +func mergeProfileBlock(p *cover.Profile, pb cover.ProfileBlock, startIndex int) int { + sortFunc := func(i int) bool { + pi := p.Blocks[i+startIndex] + return pi.StartLine >= pb.StartLine && (pi.StartLine != pb.StartLine || pi.StartCol >= pb.StartCol) + } + + i := 0 + if sortFunc(i) != true { + i = sort.Search(len(p.Blocks)-startIndex, sortFunc) + } + i += startIndex + if i < len(p.Blocks) && p.Blocks[i].StartLine == pb.StartLine && p.Blocks[i].StartCol == pb.StartCol { + if p.Blocks[i].EndLine != pb.EndLine || p.Blocks[i].EndCol != pb.EndCol { + log.Fatalf("OVERLAP MERGE: %v %v %v", p.FileName, p.Blocks[i], pb) + } + switch p.Mode { + case "set": + p.Blocks[i].Count |= pb.Count + case "count", "atomic": + p.Blocks[i].Count += pb.Count + default: + log.Fatalf("unsupported covermode: '%s'", p.Mode) + } + } else { + if i > 0 { + pa := p.Blocks[i-1] + if pa.EndLine >= pb.EndLine && (pa.EndLine != pb.EndLine || pa.EndCol > pb.EndCol) { + log.Fatalf("OVERLAP BEFORE: %v %v %v", p.FileName, pa, pb) + } + } + if i < len(p.Blocks)-1 { + pa := p.Blocks[i+1] + if pa.StartLine <= pb.StartLine && (pa.StartLine != pb.StartLine || pa.StartCol < pb.StartCol) { + log.Fatalf("OVERLAP AFTER: %v %v %v", p.FileName, pa, pb) + } + } + p.Blocks = append(p.Blocks, cover.ProfileBlock{}) + copy(p.Blocks[i+1:], p.Blocks[i:]) + p.Blocks[i] = pb + } + return i + 1 +} + +func addProfile(profiles []*cover.Profile, p *cover.Profile) []*cover.Profile { + i := sort.Search(len(profiles), func(i int) bool { return profiles[i].FileName >= p.FileName }) + if i < len(profiles) && profiles[i].FileName == p.FileName { + mergeProfiles(profiles[i], p) + } else { + profiles = append(profiles, nil) + copy(profiles[i+1:], profiles[i:]) + profiles[i] = p + } + return profiles +} + +func dumpProfiles(profiles []*cover.Profile, out io.Writer) { + if len(profiles) == 0 { + return + } + fmt.Fprintf(out, "mode: %s\n", profiles[0].Mode) + for _, p := range profiles { + for _, b := range p.Blocks { + fmt.Fprintf(out, "%s:%d.%d,%d.%d %d %d\n", p.FileName, b.StartLine, b.StartCol, b.EndLine, b.EndCol, b.NumStmt, b.Count) + } + } +} + +func main() { + flag.Parse() + + var merged []*cover.Profile + + for _, file := range flag.Args() { + profiles, err := cover.ParseProfiles(file) + if err != nil { + log.Fatalf("failed to parse profiles: %v", err) + } + for _, p := range profiles { + merged = addProfile(merged, p) + } + } + + dumpProfiles(merged, os.Stdout) +} diff --git a/vendor/golang.org/x/tools/AUTHORS b/vendor/golang.org/x/tools/AUTHORS new file mode 100644 index 000000000..15167cd74 --- /dev/null +++ b/vendor/golang.org/x/tools/AUTHORS @@ -0,0 +1,3 @@ +# This source code refers to The Go Authors for copyright purposes. +# The master list of authors is in the main Go distribution, +# visible at http://tip.golang.org/AUTHORS. diff --git a/vendor/golang.org/x/tools/CONTRIBUTORS b/vendor/golang.org/x/tools/CONTRIBUTORS new file mode 100644 index 000000000..1c4577e96 --- /dev/null +++ b/vendor/golang.org/x/tools/CONTRIBUTORS @@ -0,0 +1,3 @@ +# This source code was written by the Go contributors. +# The master list of contributors is in the main Go distribution, +# visible at http://tip.golang.org/CONTRIBUTORS. diff --git a/vendor/golang.org/x/tools/LICENSE b/vendor/golang.org/x/tools/LICENSE new file mode 100644 index 000000000..6a66aea5e --- /dev/null +++ b/vendor/golang.org/x/tools/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/golang.org/x/tools/PATENTS b/vendor/golang.org/x/tools/PATENTS new file mode 100644 index 000000000..733099041 --- /dev/null +++ b/vendor/golang.org/x/tools/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Go project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of Go, where such license applies only to those patent +claims, both currently owned or controlled by Google and acquired in +the future, licensable by Google that are necessarily infringed by this +implementation of Go. This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation. If you or your agent or exclusive licensee institute or +order or agree to the institution of patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging +that this implementation of Go or any code incorporated within this +implementation of Go constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of Go +shall terminate as of the date such litigation is filed. diff --git a/vendor/golang.org/x/tools/cmd/getgo/LICENSE b/vendor/golang.org/x/tools/cmd/getgo/LICENSE new file mode 100644 index 000000000..32017f8fa --- /dev/null +++ b/vendor/golang.org/x/tools/cmd/getgo/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2017 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/golang.org/x/tools/cover/profile.go b/vendor/golang.org/x/tools/cover/profile.go new file mode 100644 index 000000000..b6c8120a5 --- /dev/null +++ b/vendor/golang.org/x/tools/cover/profile.go @@ -0,0 +1,213 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package cover provides support for parsing coverage profiles +// generated by "go test -coverprofile=cover.out". +package cover // import "golang.org/x/tools/cover" + +import ( + "bufio" + "fmt" + "math" + "os" + "regexp" + "sort" + "strconv" + "strings" +) + +// Profile represents the profiling data for a specific file. +type Profile struct { + FileName string + Mode string + Blocks []ProfileBlock +} + +// ProfileBlock represents a single block of profiling data. +type ProfileBlock struct { + StartLine, StartCol int + EndLine, EndCol int + NumStmt, Count int +} + +type byFileName []*Profile + +func (p byFileName) Len() int { return len(p) } +func (p byFileName) Less(i, j int) bool { return p[i].FileName < p[j].FileName } +func (p byFileName) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + +// ParseProfiles parses profile data in the specified file and returns a +// Profile for each source file described therein. +func ParseProfiles(fileName string) ([]*Profile, error) { + pf, err := os.Open(fileName) + if err != nil { + return nil, err + } + defer pf.Close() + + files := make(map[string]*Profile) + buf := bufio.NewReader(pf) + // First line is "mode: foo", where foo is "set", "count", or "atomic". + // Rest of file is in the format + // encoding/base64/base64.go:34.44,37.40 3 1 + // where the fields are: name.go:line.column,line.column numberOfStatements count + s := bufio.NewScanner(buf) + mode := "" + for s.Scan() { + line := s.Text() + if mode == "" { + const p = "mode: " + if !strings.HasPrefix(line, p) || line == p { + return nil, fmt.Errorf("bad mode line: %v", line) + } + mode = line[len(p):] + continue + } + m := lineRe.FindStringSubmatch(line) + if m == nil { + return nil, fmt.Errorf("line %q doesn't match expected format: %v", line, lineRe) + } + fn := m[1] + p := files[fn] + if p == nil { + p = &Profile{ + FileName: fn, + Mode: mode, + } + files[fn] = p + } + p.Blocks = append(p.Blocks, ProfileBlock{ + StartLine: toInt(m[2]), + StartCol: toInt(m[3]), + EndLine: toInt(m[4]), + EndCol: toInt(m[5]), + NumStmt: toInt(m[6]), + Count: toInt(m[7]), + }) + } + if err := s.Err(); err != nil { + return nil, err + } + for _, p := range files { + sort.Sort(blocksByStart(p.Blocks)) + // Merge samples from the same location. + j := 1 + for i := 1; i < len(p.Blocks); i++ { + b := p.Blocks[i] + last := p.Blocks[j-1] + if b.StartLine == last.StartLine && + b.StartCol == last.StartCol && + b.EndLine == last.EndLine && + b.EndCol == last.EndCol { + if b.NumStmt != last.NumStmt { + return nil, fmt.Errorf("inconsistent NumStmt: changed from %d to %d", last.NumStmt, b.NumStmt) + } + if mode == "set" { + p.Blocks[j-1].Count |= b.Count + } else { + p.Blocks[j-1].Count += b.Count + } + continue + } + p.Blocks[j] = b + j++ + } + p.Blocks = p.Blocks[:j] + } + // Generate a sorted slice. + profiles := make([]*Profile, 0, len(files)) + for _, profile := range files { + profiles = append(profiles, profile) + } + sort.Sort(byFileName(profiles)) + return profiles, nil +} + +type blocksByStart []ProfileBlock + +func (b blocksByStart) Len() int { return len(b) } +func (b blocksByStart) Swap(i, j int) { b[i], b[j] = b[j], b[i] } +func (b blocksByStart) Less(i, j int) bool { + bi, bj := b[i], b[j] + return bi.StartLine < bj.StartLine || bi.StartLine == bj.StartLine && bi.StartCol < bj.StartCol +} + +var lineRe = regexp.MustCompile(`^(.+):([0-9]+).([0-9]+),([0-9]+).([0-9]+) ([0-9]+) ([0-9]+)$`) + +func toInt(s string) int { + i, err := strconv.Atoi(s) + if err != nil { + panic(err) + } + return i +} + +// Boundary represents the position in a source file of the beginning or end of a +// block as reported by the coverage profile. In HTML mode, it will correspond to +// the opening or closing of a tag and will be used to colorize the source +type Boundary struct { + Offset int // Location as a byte offset in the source file. + Start bool // Is this the start of a block? + Count int // Event count from the cover profile. + Norm float64 // Count normalized to [0..1]. +} + +// Boundaries returns a Profile as a set of Boundary objects within the provided src. +func (p *Profile) Boundaries(src []byte) (boundaries []Boundary) { + // Find maximum count. + max := 0 + for _, b := range p.Blocks { + if b.Count > max { + max = b.Count + } + } + // Divisor for normalization. + divisor := math.Log(float64(max)) + + // boundary returns a Boundary, populating the Norm field with a normalized Count. + boundary := func(offset int, start bool, count int) Boundary { + b := Boundary{Offset: offset, Start: start, Count: count} + if !start || count == 0 { + return b + } + if max <= 1 { + b.Norm = 0.8 // Profile is in"set" mode; we want a heat map. Use cov8 in the CSS. + } else if count > 0 { + b.Norm = math.Log(float64(count)) / divisor + } + return b + } + + line, col := 1, 2 // TODO: Why is this 2? + for si, bi := 0, 0; si < len(src) && bi < len(p.Blocks); { + b := p.Blocks[bi] + if b.StartLine == line && b.StartCol == col { + boundaries = append(boundaries, boundary(si, true, b.Count)) + } + if b.EndLine == line && b.EndCol == col || line > b.EndLine { + boundaries = append(boundaries, boundary(si, false, 0)) + bi++ + continue // Don't advance through src; maybe the next block starts here. + } + if src[si] == '\n' { + line++ + col = 0 + } + col++ + si++ + } + sort.Sort(boundariesByPos(boundaries)) + return +} + +type boundariesByPos []Boundary + +func (b boundariesByPos) Len() int { return len(b) } +func (b boundariesByPos) Swap(i, j int) { b[i], b[j] = b[j], b[i] } +func (b boundariesByPos) Less(i, j int) bool { + if b[i].Offset == b[j].Offset { + return !b[i].Start && b[j].Start + } + return b[i].Offset < b[j].Offset +} diff --git a/vendor/golang.org/x/tools/third_party/moduleloader/LICENSE b/vendor/golang.org/x/tools/third_party/moduleloader/LICENSE new file mode 100644 index 000000000..1723a2247 --- /dev/null +++ b/vendor/golang.org/x/tools/third_party/moduleloader/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2013-2016 Guy Bedford, Luke Hoban, Addy Osmani + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/vendor/golang.org/x/tools/third_party/typescript/LICENSE b/vendor/golang.org/x/tools/third_party/typescript/LICENSE new file mode 100644 index 000000000..e7259f843 --- /dev/null +++ b/vendor/golang.org/x/tools/third_party/typescript/LICENSE @@ -0,0 +1,55 @@ +Apache License + +Version 2.0, January 2004 + +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + +You must give any other recipients of the Work or Derivative Works a copy of this License; and + +You must cause any modified files to carry prominent notices stating that You changed the files; and + +You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + +If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/vendor/golang.org/x/tools/third_party/webcomponents/LICENSE b/vendor/golang.org/x/tools/third_party/webcomponents/LICENSE new file mode 100644 index 000000000..e648283b4 --- /dev/null +++ b/vendor/golang.org/x/tools/third_party/webcomponents/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2015 The Polymer Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file From eb11e4ec053190d0582eff85a6ab0c327cc4bdad Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Tue, 1 May 2018 16:02:46 -0700 Subject: [PATCH 03/14] Scripts cleanup Signed-off-by: Joffrey F --- Makefile | 12 ++++++++---- codecoverage/coverage-bin | 9 +++++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 8a6170d89..5c50ecee7 100644 --- a/Makefile +++ b/Makefile @@ -81,17 +81,21 @@ unit-test: @echo "Running unit tests..." $(GO_TEST) $(shell go list ./... | grep -vE '/e2e') -clean: - rm -Rf ./_build docker-app-*.tar.gz - coverage-bin: $(GO_TEST) -coverpkg="./..." -c -tags testrunmain -o _build/$(BIN_NAME).cov + go install ./vendor/github.com/wadey/gocovmerge/ coverage: coverage-bin + @echo "Running e2e tests (coverage)..." DOCKERAPP_BINARY=../codecoverage/coverage-bin $(GO_TEST) -v ./e2e + @echo "Running unit tests (coverage)..." $(GO_TEST) -cover -test.coverprofile=codecoverage/unit.out $(shell go list ./... | grep -vE '/vendor/|/e2e') gocovmerge codecoverage/*.out > codecoverage/all.out go tool cover -func codecoverage/all.out + go tool cover -html codecoverage/all.out -o codecoverage/coverage.html + +clean: + rm -Rf ./_build docker-app-*.tar.gz codecoverage/*.out codecoverage/*.html ########################## # Continuous Integration # @@ -116,5 +120,5 @@ ci-gradle-test: -e GRADLE_USER_HOME=/tmp/gradle \ gradle:jdk8 bash -c "cd /gradle && gradle --stacktrace build && cd example && gradle renderIt" -.PHONY: bin bin-all test check lint e2e-test e2e-all unit-test clean ci-lint ci-test ci-bin-all ci-e2e-all ci-gradle-test +.PHONY: bin bin-all release test check lint test-cov e2e-test e2e-all unit-test coverage coverage-bin clean ci-lint ci-test ci-bin-all ci-e2e-all ci-gradle-test .DEFAULT: all diff --git a/codecoverage/coverage-bin b/codecoverage/coverage-bin index 27bc846eb..5079da313 100755 --- a/codecoverage/coverage-bin +++ b/codecoverage/coverage-bin @@ -3,5 +3,10 @@ # This script is a proxy that injects the required test flags and strips out test output # It allows us to use a coverage-enabled binary for e2e tests -../_build/docker-app.cov $* -test.v -test.coverprofile=../codecoverage/e2e.out | \ -grep -vE '^PASS$' | grep -vE '^coverage: [0-9]+\.[0-9]+% of statements in .+$' | grep -v '^=== RUN TestRunMain$' +../_build/docker-app.cov \ + $* \ + -test.coverprofile=../codecoverage/$(uuidgen).out \ + -test.v \ +| grep -vE '^PASS$' \ +| grep -vE '^coverage: [0-9]+\.[0-9]+% of statements in .+$' \ +| grep -v '^=== RUN TestRunMain$' From 550fd7778e5a3f70ea779289d13cef2c5c863722 Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Wed, 2 May 2018 12:13:29 -0700 Subject: [PATCH 04/14] Vendor patched version of spf13/pflag Signed-off-by: Joffrey F --- Gopkg.lock | 7 ++++--- Gopkg.toml | 5 +++++ vendor/github.com/spf13/pflag/flag.go | 3 ++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 610ee9f5b..7163e0254 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -465,10 +465,11 @@ version = "v0.0.2" [[projects]] + branch = "master" name = "github.com/spf13/pflag" packages = ["."] - revision = "583c0c0531f06d5278b7d917446061adc344b5cd" - version = "v1.0.1" + revision = "ff05565044323371eb96042057fdfc1d8958aab7" + source = "github.com/shin-/pflag" [[projects]] branch = "master" @@ -782,6 +783,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "7d50265f6c7fa2c559e6dd2f27991d2560779a24a2dc0b69af3d24e9b4ccb7c7" + inputs-digest = "1502d8910e0c6be9293194ec44e78bb1fb1dab51e5fd130db123bb40e2733107" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index a7bc5a377..1f26b54e7 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -36,6 +36,11 @@ required = ["github.com/wadey/gocovmerge"] branch = "master" source = "github.com/mnottale/cli" +[[override]] + name = "github.com/spf13/pflag" + branch = "master" + source = "github.com/shin-/pflag" + [[constraint]] name = "github.com/gotestyourself/gotestyourself" branch = "master" diff --git a/vendor/github.com/spf13/pflag/flag.go b/vendor/github.com/spf13/pflag/flag.go index 5eadc84e3..5cc710ccd 100644 --- a/vendor/github.com/spf13/pflag/flag.go +++ b/vendor/github.com/spf13/pflag/flag.go @@ -990,11 +990,12 @@ func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []strin } func (f *FlagSet) parseSingleShortArg(shorthands string, args []string, fn parseFunc) (outShorts string, outArgs []string, err error) { + outArgs = args + if strings.HasPrefix(shorthands, "test.") { return } - outArgs = args outShorts = shorthands[1:] c := shorthands[0] From d1c85c2eeeb5cb20aafc1fae73a985e14299583c Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Wed, 2 May 2018 12:13:57 -0700 Subject: [PATCH 05/14] Fix flag order Signed-off-by: Joffrey F --- codecoverage/coverage-bin | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/codecoverage/coverage-bin b/codecoverage/coverage-bin index 5079da313..8bd4d7a7a 100755 --- a/codecoverage/coverage-bin +++ b/codecoverage/coverage-bin @@ -4,9 +4,8 @@ # It allows us to use a coverage-enabled binary for e2e tests ../_build/docker-app.cov \ - $* \ -test.coverprofile=../codecoverage/$(uuidgen).out \ - -test.v \ + $* \ | grep -vE '^PASS$' \ | grep -vE '^coverage: [0-9]+\.[0-9]+% of statements in .+$' \ | grep -v '^=== RUN TestRunMain$' From a9d588198b1c5e7712b30de1722e0cb4e5f42a95 Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Wed, 2 May 2018 13:14:23 -0700 Subject: [PATCH 06/14] Clean up directory structure Signed-off-by: Joffrey F --- .gitignore | 1 - Makefile | 15 ++++++++------- {codecoverage => e2e}/coverage-bin | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) rename {codecoverage => e2e}/coverage-bin (85%) diff --git a/.gitignore b/.gitignore index 1f0f0b701..5e28c3605 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ *.tar.gz *.dockerapp _build/ -codecoverage/*.out !examples/simple/*.dockerapp diff --git a/Makefile b/Makefile index 5c50ecee7..4c1543d56 100644 --- a/Makefile +++ b/Makefile @@ -82,20 +82,21 @@ unit-test: $(GO_TEST) $(shell go list ./... | grep -vE '/e2e') coverage-bin: - $(GO_TEST) -coverpkg="./..." -c -tags testrunmain -o _build/$(BIN_NAME).cov + $(GO_TEST) -coverpkg="./..." -c -ldflags=$(LDFLAGS) -tags testrunmain -o _build/$(BIN_NAME).cov go install ./vendor/github.com/wadey/gocovmerge/ coverage: coverage-bin + mkdir -p _build/cov @echo "Running e2e tests (coverage)..." - DOCKERAPP_BINARY=../codecoverage/coverage-bin $(GO_TEST) -v ./e2e + DOCKERAPP_BINARY=../e2e/coverage-bin $(GO_TEST) -v ./e2e @echo "Running unit tests (coverage)..." - $(GO_TEST) -cover -test.coverprofile=codecoverage/unit.out $(shell go list ./... | grep -vE '/vendor/|/e2e') - gocovmerge codecoverage/*.out > codecoverage/all.out - go tool cover -func codecoverage/all.out - go tool cover -html codecoverage/all.out -o codecoverage/coverage.html + $(GO_TEST) -cover -test.coverprofile=_build/cov/unit.out $(shell go list ./... | grep -vE '/vendor/|/e2e') + gocovmerge _build/cov/*.out > _build/cov/all.out + go tool cover -func _build/cov/all.out + go tool cover -html _build/cov/all.out -o _build/cov/coverage.html clean: - rm -Rf ./_build docker-app-*.tar.gz codecoverage/*.out codecoverage/*.html + rm -Rf ./_build docker-app-*.tar.gz ########################## # Continuous Integration # diff --git a/codecoverage/coverage-bin b/e2e/coverage-bin similarity index 85% rename from codecoverage/coverage-bin rename to e2e/coverage-bin index 8bd4d7a7a..30a7ecf99 100755 --- a/codecoverage/coverage-bin +++ b/e2e/coverage-bin @@ -4,7 +4,7 @@ # It allows us to use a coverage-enabled binary for e2e tests ../_build/docker-app.cov \ - -test.coverprofile=../codecoverage/$(uuidgen).out \ + -test.coverprofile=../_build/cov/$(uuidgen).out \ $* \ | grep -vE '^PASS$' \ | grep -vE '^coverage: [0-9]+\.[0-9]+% of statements in .+$' \ From c04818c0266cf73006c760a1c20a44cfa738c4bc Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Wed, 2 May 2018 13:39:24 -0700 Subject: [PATCH 07/14] Run coverage in CI Signed-off-by: Joffrey F --- Dockerfile | 3 ++- Jenkinsfile | 16 +++++++++++++++- Makefile | 9 ++++++++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0d5979260..dee7c73c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,8 @@ ARG TAG=unknown FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS build RUN apk add --no-cache \ build-base \ - git + git \ + util-linux WORKDIR /go/src/github.com/docker/lunchbox/ COPY . . diff --git a/Jenkinsfile b/Jenkinsfile index b549b43f7..cc295a22a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -34,7 +34,7 @@ pipeline { archiveArtifacts '*.tar.gz' } } finally { - def clean_images = /docker image ls --format "{{.ID}}\t{{.Tag}}" | grep $(git describe --always --dirty) | awk '{print $1}' | xargs docker image rm/ + def clean_images = /docker image ls --format "{{.ID}}\t{{.Tag}}" | grep $(git describe --always --dirty) | awk '{print $1}' | xargs docker image rm -f/ sh clean_images } } @@ -48,6 +48,20 @@ pipeline { } stage('Test') { parallel { + stage("Coverage report") { + agent { + label 'gcp-linux-worker-0' + } + steps { + dir('src/github.com/docker/lunchbox') { + sh 'ls -la' + sh 'make ci-coverage' + archiveArtifacts 'cov/all.out' + archiveArtifacts 'cov/coverage.html' + sh 'curl -s https://codecov.io/bash | bash -s - -t 0b5323a7-aa90-4855-95ad-c859a917d611 -f cov/all.out -C' + } + } + } stage("Test Linux") { agent { label 'linux' diff --git a/Makefile b/Makefile index 4c1543d56..95699f7a9 100644 --- a/Makefile +++ b/Makefile @@ -102,6 +102,8 @@ clean: # Continuous Integration # ########################## +COV_LABEL := com.docker.lunchbox.cov-run=$(TAG) + ci-lint: @echo "Linting..." docker build -t $(IMAGE_NAME)-lint:$(TAG) $(IMAGE_BUILD_ARGS) -f Dockerfile.lint . --target=lint-image @@ -111,6 +113,11 @@ ci-test: @echo "Testing..." docker build -t $(IMAGE_NAME)-test:$(TAG) $(IMAGE_BUILD_ARGS) . --target=test +ci-coverage: + docker build --target=build -t $(IMAGE_NAME)-cov:$(TAG) $(IMAGE_BUILD_ARGS) . + docker run --label $(COV_LABEL) $(IMAGE_NAME)-cov:$(TAG) make COMMIT=$(TAG) TAG=$(COMMIT) coverage + docker cp $$(docker ps -aql --filter label=$(COV_LABEL)):$(PKG_PATH)/_build/cov/ ./cov + ci-bin-all: docker build -t $(IMAGE_NAME)-bin-all:$(TAG) $(IMAGE_BUILD_ARGS) . --target=bin-build $(foreach OS, $(OS_LIST), docker run --rm $(IMAGE_NAME)-bin-all:$(TAG) tar -cz -C $(PKG_PATH)/_build $(BIN_NAME)-$(OS)$(if $(filter windows, $(OS)),.exe,) > $(BIN_NAME)-$(OS)-$(TAG).tar.gz || exit 1;) @@ -121,5 +128,5 @@ ci-gradle-test: -e GRADLE_USER_HOME=/tmp/gradle \ gradle:jdk8 bash -c "cd /gradle && gradle --stacktrace build && cd example && gradle renderIt" -.PHONY: bin bin-all release test check lint test-cov e2e-test e2e-all unit-test coverage coverage-bin clean ci-lint ci-test ci-bin-all ci-e2e-all ci-gradle-test +.PHONY: bin bin-all release test check lint test-cov e2e-test e2e-all unit-test coverage coverage-bin clean ci-lint ci-test ci-coverage ci-bin-all ci-e2e-all ci-gradle-test .DEFAULT: all From 4136efba0d715cf9ebda04ceac7122d935692d12 Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Wed, 2 May 2018 17:01:25 -0700 Subject: [PATCH 08/14] Cleanup Signed-off-by: Joffrey F --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index cc295a22a..4bb17acd2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -54,11 +54,12 @@ pipeline { } steps { dir('src/github.com/docker/lunchbox') { + checkout scm sh 'ls -la' sh 'make ci-coverage' archiveArtifacts 'cov/all.out' archiveArtifacts 'cov/coverage.html' - sh 'curl -s https://codecov.io/bash | bash -s - -t 0b5323a7-aa90-4855-95ad-c859a917d611 -f cov/all.out -C' + sh 'curl -s https://codecov.io/bash | bash -s - -t 0b5323a7-aa90-4855-95ad-c859a917d611 -f cov/all.out -K' } } } From abdac4c53a5921ee21adcd4ab6656d961e54c1a1 Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Thu, 3 May 2018 11:15:04 -0700 Subject: [PATCH 09/14] Use codecov token from Jenkins credentials Signed-off-by: Joffrey F --- Jenkinsfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4bb17acd2..7e9393ddd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -49,17 +49,20 @@ pipeline { stage('Test') { parallel { stage("Coverage report") { + environment { + CODECOV_TOKEN = credentials('jenkins-codecov-token') + } + agent { label 'gcp-linux-worker-0' } steps { dir('src/github.com/docker/lunchbox') { checkout scm - sh 'ls -la' sh 'make ci-coverage' archiveArtifacts 'cov/all.out' archiveArtifacts 'cov/coverage.html' - sh 'curl -s https://codecov.io/bash | bash -s - -t 0b5323a7-aa90-4855-95ad-c859a917d611 -f cov/all.out -K' + sh 'curl -s https://codecov.io/bash | bash -s - -f cov/all.out -K' } } } From 9aad84825264abff12bdc263386ca30825b75dc5 Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Thu, 3 May 2018 11:34:37 -0700 Subject: [PATCH 10/14] Keep produced artifacts under _build/ in ci-coverage Signed-off-by: Joffrey F --- Jenkinsfile | 6 +++--- Makefile | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7e9393ddd..a78a5c0bf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -60,9 +60,9 @@ pipeline { dir('src/github.com/docker/lunchbox') { checkout scm sh 'make ci-coverage' - archiveArtifacts 'cov/all.out' - archiveArtifacts 'cov/coverage.html' - sh 'curl -s https://codecov.io/bash | bash -s - -f cov/all.out -K' + archiveArtifacts '_build/ci-cov/all.out' + archiveArtifacts '_build/ci-cov/coverage.html' + sh 'curl -s https://codecov.io/bash | bash -s - -f _build/ci-cov/all.out -K' } } } diff --git a/Makefile b/Makefile index 95699f7a9..48097652a 100644 --- a/Makefile +++ b/Makefile @@ -116,7 +116,7 @@ ci-test: ci-coverage: docker build --target=build -t $(IMAGE_NAME)-cov:$(TAG) $(IMAGE_BUILD_ARGS) . docker run --label $(COV_LABEL) $(IMAGE_NAME)-cov:$(TAG) make COMMIT=$(TAG) TAG=$(COMMIT) coverage - docker cp $$(docker ps -aql --filter label=$(COV_LABEL)):$(PKG_PATH)/_build/cov/ ./cov + mkdir -p ./_build && docker cp $$(docker ps -aql --filter label=$(COV_LABEL)):$(PKG_PATH)/_build/cov/ ./_build/ci-cov ci-bin-all: docker build -t $(IMAGE_NAME)-bin-all:$(TAG) $(IMAGE_BUILD_ARGS) . --target=bin-build From 8095120ce5efa7a82b3144fc3fbf87b882449b02 Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Tue, 29 May 2018 13:46:29 -0700 Subject: [PATCH 11/14] Fix coverage-bin script Signed-off-by: Joffrey F --- Dockerfile | 3 ++- e2e/coverage-bin | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index dee7c73c0..d96379b6b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,8 @@ FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS build RUN apk add --no-cache \ build-base \ git \ - util-linux + util-linux \ + bash WORKDIR /go/src/github.com/docker/lunchbox/ COPY . . diff --git a/e2e/coverage-bin b/e2e/coverage-bin index 30a7ecf99..9e3cd5ca3 100755 --- a/e2e/coverage-bin +++ b/e2e/coverage-bin @@ -1,11 +1,15 @@ -#!/bin/sh +#!/bin/bash # This script is a proxy that injects the required test flags and strips out test output # It allows us to use a coverage-enabled binary for e2e tests -../_build/docker-app.cov \ - -test.coverprofile=../_build/cov/$(uuidgen).out \ - $* \ +BUILD_DIR=${BASH_SOURCE%/*}/../_build + +$BUILD_DIR/docker-app.cov \ + -test.coverprofile=$BUILD_DIR/cov/$(uuidgen).out \ + "$@" \ | grep -vE '^PASS$' \ | grep -vE '^coverage: [0-9]+\.[0-9]+% of statements in .+$' \ | grep -v '^=== RUN TestRunMain$' + +exit ${PIPESTATUS[0]} From d4ddc16af84f724094f88f56d6bbb3f815f87f32 Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Thu, 31 May 2018 18:50:24 -0700 Subject: [PATCH 12/14] cleanup Signed-off-by: Joffrey F --- Dockerfile | 4 ++-- Jenkinsfile | 1 - Makefile | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index d96379b6b..132468139 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,10 +5,10 @@ ARG TAG=unknown FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS build RUN apk add --no-cache \ + bash \ build-base \ git \ - util-linux \ - bash + util-linux WORKDIR /go/src/github.com/docker/lunchbox/ COPY . . diff --git a/Jenkinsfile b/Jenkinsfile index a78a5c0bf..767dbeea4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -52,7 +52,6 @@ pipeline { environment { CODECOV_TOKEN = credentials('jenkins-codecov-token') } - agent { label 'gcp-linux-worker-0' } diff --git a/Makefile b/Makefile index 48097652a..7bd5b1c9c 100644 --- a/Makefile +++ b/Makefile @@ -90,7 +90,7 @@ coverage: coverage-bin @echo "Running e2e tests (coverage)..." DOCKERAPP_BINARY=../e2e/coverage-bin $(GO_TEST) -v ./e2e @echo "Running unit tests (coverage)..." - $(GO_TEST) -cover -test.coverprofile=_build/cov/unit.out $(shell go list ./... | grep -vE '/vendor/|/e2e') + $(GO_TEST) -cover -test.coverprofile=_build/cov/unit.out $(shell go list ./... | grep -vE '/e2e') gocovmerge _build/cov/*.out > _build/cov/all.out go tool cover -func _build/cov/all.out go tool cover -html _build/cov/all.out -o _build/cov/coverage.html From e7d1ee80576543a1190cf32778dbf7b51358dcde Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Thu, 31 May 2018 19:00:56 -0700 Subject: [PATCH 13/14] Fix botched gocovmerge vendoring Signed-off-by: Joffrey F --- Gopkg.lock | 3 +- Gopkg.toml | 9 ++- vendor/github.com/docker/yatee/yatee/yatee.go | 66 ++++++++++++------- 3 files changed, 47 insertions(+), 31 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 7163e0254..de1b35e6f 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -582,9 +582,10 @@ revision = "fbb02b2291d28baffd63558aa44b4b56f178d650" [[projects]] + branch = "master" name = "golang.org/x/tools" packages = ["cover"] - revision = "5c8013c5617234a9515f1b1379aba7e03e846479" + revision = "a5b4c53f6e8bdcafa95a94671bf2d1203365858b" [[projects]] branch = "master" diff --git a/Gopkg.toml b/Gopkg.toml index 1f26b54e7..56b8331c1 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -22,7 +22,6 @@ required = ["github.com/wadey/gocovmerge"] - [[constraint]] name = "github.com/spf13/cobra" version = "0.0.2" @@ -45,10 +44,6 @@ required = ["github.com/wadey/gocovmerge"] name = "github.com/gotestyourself/gotestyourself" branch = "master" -[[constraint]] - name = "github.com/wadey/gocovmerge" - branch = "master" - [[constraint]] name = "github.com/sirupsen/logrus" version = "v1.0.5" @@ -81,6 +76,10 @@ required = ["github.com/wadey/gocovmerge"] name = "google.golang.org/grpc" revision = "v1.3.0" +[[constraint]] + name = "github.com/wadey/gocovmerge" + branch = "master" + [prune] non-go = true unused-packages = true diff --git a/vendor/github.com/docker/yatee/yatee/yatee.go b/vendor/github.com/docker/yatee/yatee/yatee.go index 40a3fd97f..7aefe8843 100644 --- a/vendor/github.com/docker/yatee/yatee/yatee.go +++ b/vendor/github.com/docker/yatee/yatee/yatee.go @@ -20,7 +20,7 @@ type options struct { } // flatten flattens a structure: foo.bar.baz -> 'foo.bar.baz' -func flatten(in map[string]interface{}, out map[string]string, prefix string) { +func flatten(in map[string]interface{}, out map[string]interface{}, prefix string) { for k, v := range in { switch vv := v.(type) { case string: @@ -34,7 +34,7 @@ func flatten(in map[string]interface{}, out map[string]string, prefix string) { } out[prefix+k] = strings.Join(values, " ") default: - out[prefix+k] = fmt.Sprintf("%v", v) + out[prefix+k] = v } } } @@ -196,21 +196,23 @@ func evalSub(comps []string, i int) (int64, int, error) { } // resolves an arithmetic expression -func evalExpr(expr string) (string, error) { +func evalExpr(expr string) (int64, error) { comps, err := tokenize(expr) if err != nil { - return "", err + return 0, err } v, _, err := evalSub(comps, 0) - return fmt.Sprintf("%v", v), err + return v, err } // resolves and evaluate all ${foo.bar}, $foo.bar and $(expr) in epr -func eval(expr string, flattened map[string]string, o options) (string, error) { +func eval(expr string, flattened map[string]interface{}, o options) (interface{}, error) { // Since we go from right to left to support nesting, handling $$ escape is // painful, so just hide them and restore them at the end expr = strings.Replace(expr, "$$", "\x00", -1) end := len(expr) + // If evaluation resolves to a single value, return the type value, not a string + var bypass interface{} iteration := 0 for { iteration++ @@ -221,11 +223,12 @@ func eval(expr string, flattened map[string]string, o options) (string, error) { if i == -1 { break } + bypass = nil comp, err := extract(expr[i+1:]) if err != nil { return "", err } - var val string + var val interface{} if len(comp) != 0 && comp[0] == '(' { var err error val, err = evalExpr(comp[1 : len(comp)-1]) @@ -244,7 +247,7 @@ func eval(expr string, flattened map[string]string, o options) (string, error) { } variable := content[0:q] val, ok = flattened[variable] - if isTrue(val) { + if isTrue(fmt.Sprintf("%v", val)) { val = content[q+1 : s] } else { val = content[s+1:] @@ -262,9 +265,16 @@ func eval(expr string, flattened map[string]string, o options) (string, error) { fmt.Fprintf(os.Stderr, "variable '%s' not set, expanding to empty string", comp) } } - expr = expr[0:i] + val + expr[i+1+len(comp):] + valstr := fmt.Sprintf("%v", val) + expr = expr[0:i] + valstr + expr[i+1+len(comp):] + if strings.Trim(expr, " ") == valstr { + bypass = val + } end = len(expr) } + if bypass != nil { + return bypass, nil + } expr = strings.Replace(expr, "\x00", "$", -1) return expr, nil } @@ -279,7 +289,7 @@ func isTrue(cond string) bool { return (cond != "" && cond != "false" && cond != "0") != reverse } -func recurseList(input []interface{}, settings map[string]interface{}, flattened map[string]string, o options) ([]interface{}, error) { +func recurseList(input []interface{}, settings map[string]interface{}, flattened map[string]interface{}, o options) ([]interface{}, error) { var res []interface{} for _, v := range input { switch vv := v.(type) { @@ -300,18 +310,20 @@ func recurseList(input []interface{}, settings map[string]interface{}, flattened if err != nil { return nil, err } - trimed := strings.TrimLeft(vvv, " ") - if strings.HasPrefix(trimed, "@if") { - be := strings.Index(trimed, "(") - ee := strings.Index(trimed, ")") - if be == -1 || ee == -1 || be > ee { - return nil, fmt.Errorf("parse error looking for if condition in '%s'", vvv) - } - cond := trimed[be+1 : ee] - if isTrue(cond) { - res = append(res, strings.Trim(trimed[ee+1:], " ")) + if vvvs, ok := vvv.(string); ok { + trimed := strings.TrimLeft(vvvs, " ") + if strings.HasPrefix(trimed, "@if") { + be := strings.Index(trimed, "(") + ee := strings.Index(trimed, ")") + if be == -1 || ee == -1 || be > ee { + return nil, fmt.Errorf("parse error looking for if condition in '%s'", vvv) + } + cond := trimed[be+1 : ee] + if isTrue(cond) { + res = append(res, strings.Trim(trimed[ee+1:], " ")) + } + continue } - continue } res = append(res, vvv) default: @@ -321,7 +333,7 @@ func recurseList(input []interface{}, settings map[string]interface{}, flattened return res, nil } -func recurse(input map[interface{}]interface{}, settings map[string]interface{}, flattened map[string]string, o options) (map[interface{}]interface{}, error) { +func recurse(input map[interface{}]interface{}, settings map[string]interface{}, flattened map[string]interface{}, o options) (map[interface{}]interface{}, error) { res := make(map[interface{}]interface{}) for k, v := range input { rk := k @@ -376,10 +388,14 @@ func recurse(input map[interface{}]interface{}, settings map[string]interface{}, } comps := strings.SplitN(trimed, " ", 4) varname := comps[1] - varrange, err := eval(comps[3], flattened, o) + varrangeraw, err := eval(comps[3], flattened, o) if err != nil { return nil, err } + varrange, ok := varrangeraw.(string) + if !ok { + return nil, fmt.Errorf("@for argument must be a string") + } mayberange := strings.Split(varrange, "..") if len(mayberange) == 2 { rangestart, err := strconv.ParseInt(mayberange[0], 0, 64) @@ -425,7 +441,7 @@ func recurse(input map[interface{}]interface{}, settings map[string]interface{}, if !ok { return nil, fmt.Errorf("@if value must be a mapping") } - if isTrue(cond) { + if isTrue(fmt.Sprintf("%v", cond)) { val, err := recurse(mii, settings, flattened, o) if err != nil { return nil, err @@ -517,7 +533,7 @@ func Process(inputString string, settings map[string]interface{}, opts ...string if err != nil { return nil, err } - flattened := make(map[string]string) + flattened := make(map[string]interface{}) flatten(settings, flattened, "") return recurse(input, settings, flattened, o) } From b205e55b77fd70b250c32af2fe2801f71d4cb81e Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Thu, 31 May 2018 19:26:03 -0700 Subject: [PATCH 14/14] Follow main package move Signed-off-by: Joffrey F --- Makefile | 2 +- main_test.go => cmd/docker-app/main_test.go | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename main_test.go => cmd/docker-app/main_test.go (100%) diff --git a/Makefile b/Makefile index 7bd5b1c9c..962a1e4a0 100644 --- a/Makefile +++ b/Makefile @@ -82,7 +82,7 @@ unit-test: $(GO_TEST) $(shell go list ./... | grep -vE '/e2e') coverage-bin: - $(GO_TEST) -coverpkg="./..." -c -ldflags=$(LDFLAGS) -tags testrunmain -o _build/$(BIN_NAME).cov + $(GO_TEST) -coverpkg="./..." -c -ldflags=$(LDFLAGS) -tags testrunmain -o _build/$(BIN_NAME).cov ./cmd/docker-app go install ./vendor/github.com/wadey/gocovmerge/ coverage: coverage-bin diff --git a/main_test.go b/cmd/docker-app/main_test.go similarity index 100% rename from main_test.go rename to cmd/docker-app/main_test.go