diff options
author | Christopher Speller <crspeller@gmail.com> | 2018-05-17 12:40:40 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-17 12:40:40 -0700 |
commit | 11cbb597471127c1b29e78e6cad0a1a4d93ea24c (patch) | |
tree | 0eceb950872c7234348f0b41d4492073908840d0 /cmd/cmdtestlib.go | |
parent | 1f6c271b3bedd6656ae7155714423b1b39a669c1 (diff) | |
download | chat-11cbb597471127c1b29e78e6cad0a1a4d93ea24c.tar.gz chat-11cbb597471127c1b29e78e6cad0a1a4d93ea24c.tar.bz2 chat-11cbb597471127c1b29e78e6cad0a1a4d93ea24c.zip |
Renaming platform binary to mattermost. (#8801)
Diffstat (limited to 'cmd/cmdtestlib.go')
-rw-r--r-- | cmd/cmdtestlib.go | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/cmd/cmdtestlib.go b/cmd/cmdtestlib.go deleted file mode 100644 index db97b1a41..000000000 --- a/cmd/cmdtestlib.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -package cmd - -import ( - "flag" - "fmt" - "os" - "os/exec" - "path/filepath" - "strings" - "testing" - - "github.com/stretchr/testify/require" -) - -var coverprofileCounters map[string]int = make(map[string]int) - -func execArgs(t *testing.T, args []string) []string { - ret := []string{"-test.run", "ExecCommand"} - if coverprofile := flag.Lookup("test.coverprofile").Value.String(); coverprofile != "" { - dir := filepath.Dir(coverprofile) - base := filepath.Base(coverprofile) - baseParts := strings.SplitN(base, ".", 2) - coverprofileCounters[t.Name()] = coverprofileCounters[t.Name()] + 1 - baseParts[0] = fmt.Sprintf("%v-%v-%v", baseParts[0], t.Name(), coverprofileCounters[t.Name()]) - ret = append(ret, "-test.coverprofile", filepath.Join(dir, strings.Join(baseParts, "."))) - } - return append(append(ret, "--", "--disableconfigwatch"), args...) -} - -func CheckCommand(t *testing.T, args ...string) string { - path, err := os.Executable() - require.NoError(t, err) - output, err := exec.Command(path, execArgs(t, args)...).CombinedOutput() - require.NoError(t, err, string(output)) - return strings.TrimSpace(strings.TrimSuffix(strings.TrimSpace(string(output)), "PASS")) -} - -func RunCommand(t *testing.T, args ...string) error { - path, err := os.Executable() - require.NoError(t, err) - return exec.Command(path, execArgs(t, args)...).Run() -} |