forked from bsm/ginkgo
/
update.patch
139 lines (133 loc) · 4.7 KB
/
update.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
diff --git a/ginkgo/internal/profiles_and_reports.go b/ginkgo/internal/profiles_and_reports.go
index 77268c3..57fb7fd 100644
--- a/ginkgo/internal/profiles_and_reports.go
+++ b/ginkgo/internal/profiles_and_reports.go
@@ -9,7 +9,6 @@ import (
"regexp"
"strconv"
- "github.com/google/pprof/profile"
"github.com/bsm/ginkgo/v2/reporters"
"github.com/bsm/ginkgo/v2/types"
)
@@ -199,39 +198,3 @@ func GetCoverageFromCoverProfile(profile string) (float64, error) {
return coverage, nil
}
-
-func MergeProfiles(profilePaths []string, destination string) error {
- profiles := []*profile.Profile{}
- for _, profilePath := range profilePaths {
- proFile, err := os.Open(profilePath)
- if err != nil {
- return fmt.Errorf("Could not open profile: %s\n%s", profilePath, err.Error())
- }
- prof, err := profile.Parse(proFile)
- if err != nil {
- return fmt.Errorf("Could not parse profile: %s\n%s", profilePath, err.Error())
- }
- profiles = append(profiles, prof)
- os.Remove(profilePath)
- }
-
- mergedProfile, err := profile.Merge(profiles)
- if err != nil {
- return fmt.Errorf("Could not merge profiles:\n%s", err.Error())
- }
-
- outFile, err := os.Create(destination)
- if err != nil {
- return fmt.Errorf("Could not create merged profile %s:\n%s", destination, err.Error())
- }
- err = mergedProfile.Write(outFile)
- if err != nil {
- return fmt.Errorf("Could not write merged profile %s:\n%s", destination, err.Error())
- }
- err = outFile.Close()
- if err != nil {
- return fmt.Errorf("Could not close merged profile %s:\n%s", destination, err.Error())
- }
-
- return nil
-}
diff --git a/ginkgo/internal/run.go b/ginkgo/internal/run.go
index 3b392a8..deb2077 100644
--- a/ginkgo/internal/run.go
+++ b/ginkgo/internal/run.go
@@ -277,42 +277,6 @@ func runParallel(suite TestSuite, ginkgoConfig types.SuiteConfig, reporterConfig
}
}
}
- if len(blockProfiles) > 0 {
- if suite.HasProgrammaticFocus {
- fmt.Fprintln(os.Stdout, "no block profile was generated because specs are programmatically focused")
- } else {
- blockProfile := AbsPathForGeneratedAsset(goFlagsConfig.BlockProfile, suite, cliConfig, 0)
- err := MergeProfiles(blockProfiles, blockProfile)
- command.AbortIfError("Failed to combine blockprofiles", err)
- }
- }
- if len(cpuProfiles) > 0 {
- if suite.HasProgrammaticFocus {
- fmt.Fprintln(os.Stdout, "no cpu profile was generated because specs are programmatically focused")
- } else {
- cpuProfile := AbsPathForGeneratedAsset(goFlagsConfig.CPUProfile, suite, cliConfig, 0)
- err := MergeProfiles(cpuProfiles, cpuProfile)
- command.AbortIfError("Failed to combine cpuprofiles", err)
- }
- }
- if len(memProfiles) > 0 {
- if suite.HasProgrammaticFocus {
- fmt.Fprintln(os.Stdout, "no mem profile was generated because specs are programmatically focused")
- } else {
- memProfile := AbsPathForGeneratedAsset(goFlagsConfig.MemProfile, suite, cliConfig, 0)
- err := MergeProfiles(memProfiles, memProfile)
- command.AbortIfError("Failed to combine memprofiles", err)
- }
- }
- if len(mutexProfiles) > 0 {
- if suite.HasProgrammaticFocus {
- fmt.Fprintln(os.Stdout, "no mutex profile was generated because specs are programmatically focused")
- } else {
- mutexProfile := AbsPathForGeneratedAsset(goFlagsConfig.MutexProfile, suite, cliConfig, 0)
- err := MergeProfiles(mutexProfiles, mutexProfile)
- command.AbortIfError("Failed to combine mutexprofiles", err)
- }
- }
return suite
}
diff --git a/ginkgo/main.go b/ginkgo/main.go
index 6a78a63..c638b65 100644
--- a/ginkgo/main.go
+++ b/ginkgo/main.go
@@ -6,9 +6,6 @@ import (
"github.com/bsm/ginkgo/v2/ginkgo/build"
"github.com/bsm/ginkgo/v2/ginkgo/command"
- "github.com/bsm/ginkgo/v2/ginkgo/generators"
- "github.com/bsm/ginkgo/v2/ginkgo/labels"
- "github.com/bsm/ginkgo/v2/ginkgo/outline"
"github.com/bsm/ginkgo/v2/ginkgo/run"
"github.com/bsm/ginkgo/v2/ginkgo/unfocus"
"github.com/bsm/ginkgo/v2/ginkgo/watch"
@@ -21,10 +18,6 @@ func GenerateCommands() []command.Command {
return []command.Command{
watch.BuildWatchCommand(),
build.BuildBuildCommand(),
- generators.BuildBootstrapCommand(),
- generators.BuildGenerateCommand(),
- labels.BuildLabelsCommand(),
- outline.BuildOutlineCommand(),
unfocus.BuildUnfocusCommand(),
BuildVersionCommand(),
}
diff --git a/internal/output_interceptor.go b/internal/output_interceptor.go
index b59918a..a75ae56 100644
--- a/internal/output_interceptor.go
+++ b/internal/output_interceptor.go
@@ -55,6 +55,10 @@ type OutputInterceptor interface {
Shutdown()
}
+func NewOutputInterceptor() OutputInterceptor {
+ return NewOSGlobalReassigningOutputInterceptor()
+}
+
type NoopOutputInterceptor struct{}
func (interceptor NoopOutputInterceptor) StartInterceptingOutput() {}