-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdate.patch
237 lines (223 loc) · 7.55 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
diff --git a/core_dsl.go b/core_dsl.go
index cbde304..846d3c9 100644
--- a/core_dsl.go
+++ b/core_dsl.go
@@ -22,7 +22,6 @@ import (
"path/filepath"
"strings"
- "github.com/go-logr/logr"
"github.com/bsm/ginkgo/v2/formatter"
"github.com/bsm/ginkgo/v2/internal"
"github.com/bsm/ginkgo/v2/internal/global"
@@ -48,7 +47,6 @@ func init() {
exitIfErr(err)
writer := internal.NewWriter(os.Stdout)
GinkgoWriter = writer
- GinkgoLogr = internal.GinkgoLogrFunc(writer)
}
func exitIfErr(err error) {
@@ -114,11 +112,6 @@ You can learn more at https://onsi.github.io/ginkgo/#logging-output
*/
var GinkgoWriter GinkgoWriterInterface
-/*
-GinkgoLogr is a logr.Logger that writes to GinkgoWriter
-*/
-var GinkgoLogr logr.Logger
-
// The interface by which Ginkgo receives *testing.T
type GinkgoTestingT interface {
Fail()
diff --git a/dsl/core/core_dsl.go b/dsl/core/core_dsl.go
index 8d86c74..8e38c6e 100644
--- a/dsl/core/core_dsl.go
+++ b/dsl/core/core_dsl.go
@@ -25,7 +25,6 @@ type FullGinkgoTInterface = ginkgo.FullGinkgoTInterface
type SpecContext = ginkgo.SpecContext
var GinkgoWriter = ginkgo.GinkgoWriter
-var GinkgoLogr = ginkgo.GinkgoLogr
var GinkgoConfiguration = ginkgo.GinkgoConfiguration
var GinkgoRandomSeed = ginkgo.GinkgoRandomSeed
var GinkgoParallelProcess = ginkgo.GinkgoParallelProcess
diff --git a/ginkgo/internal/profiles_and_reports.go b/ginkgo/internal/profiles_and_reports.go
index 77268c3..25b08bd 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"
)
@@ -144,7 +143,7 @@ func FinalizeProfilesAndReportsForSuites(suites TestSuites, cliConfig types.CLIC
return messages, nil
}
-//loads each profile, combines them, deletes them, stores them in destination
+// loads each profile, combines them, deletes them, stores them in destination
func MergeAndCleanupCoverProfiles(profiles []string, destination string) error {
combined := &bytes.Buffer{}
modeRegex := regexp.MustCompile(`^mode: .*\n`)
@@ -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 229aaf1..f6fd0f4 100644
--- a/ginkgo/internal/run.go
+++ b/ginkgo/internal/run.go
@@ -286,41 +286,8 @@ 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)
- }
+ if len(blockProfiles) > 0 || len(cpuProfiles) > 0 || len(memProfiles) > 0 || len(mutexProfiles) > 0 {
+ fmt.Fprintln(os.Stdout, "profiles are not supported")
}
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 4a1c094..9f09c8c 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() {}
diff --git a/internal/suite.go b/internal/suite.go
index faf01f1..174359c 100644
--- a/internal/suite.go
+++ b/internal/suite.go
@@ -1,6 +1,7 @@
package internal
import (
+ "context"
"fmt"
"sync"
"time"
@@ -9,7 +10,6 @@ import (
"github.com/bsm/ginkgo/v2/internal/parallel_support"
"github.com/bsm/ginkgo/v2/reporters"
"github.com/bsm/ginkgo/v2/types"
- "golang.org/x/net/context"
)
type Phase uint
diff --git a/internal/writer.go b/internal/writer.go
index 574f172..b46ed70 100644
--- a/internal/writer.go
+++ b/internal/writer.go
@@ -5,9 +5,6 @@ import (
"fmt"
"io"
"sync"
-
- "github.com/go-logr/logr"
- "github.com/go-logr/logr/funcr"
)
type WriterMode uint
@@ -132,9 +129,3 @@ func (w *Writer) Printf(format string, a ...interface{}) {
func (w *Writer) Println(a ...interface{}) {
fmt.Fprintln(w, a...)
}
-
-func GinkgoLogrFunc(writer *Writer) logr.Logger {
- return funcr.New(func(prefix, args string) {
- writer.Printf("%s\n", args)
- }, funcr.Options{})
-}