Skip to content

Commit 836bdc9

Browse files
committed
Revert test2json changes.
Only retain cmd/go/testdata/script/test_json_issue38050.txt
1 parent 5f65fa4 commit 836bdc9

File tree

3 files changed

+10
-115
lines changed

3 files changed

+10
-115
lines changed

src/cmd/internal/test2json/test2json.go

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,15 @@ func (b textBytes) MarshalText() ([]byte, error) { return b, nil }
4949
// It implements io.WriteCloser; the caller writes test output in,
5050
// and the converter writes JSON output to w.
5151
type converter struct {
52-
w io.Writer // JSON output stream
53-
pkg string // package to name in events
54-
mode Mode // mode bits
55-
start time.Time // time converter started
56-
testName string // name of current test, for output attribution
57-
testNames map[string]bool // names of all tests, for log output attribution
58-
report []*event // pending test result reports (nested for subtests)
59-
result string // overall test result if seen
60-
input lineBuffer // input buffer
61-
output lineBuffer // output buffer
52+
w io.Writer // JSON output stream
53+
pkg string // package to name in events
54+
mode Mode // mode bits
55+
start time.Time // time converter started
56+
testName string // name of current test, for output attribution
57+
report []*event // pending test result reports (nested for subtests)
58+
result string // overall test result if seen
59+
input lineBuffer // input buffer
60+
output lineBuffer // output buffer
6261
}
6362

6463
// inBuffer and outBuffer are the input and output buffer sizes.
@@ -118,7 +117,6 @@ func NewConverter(w io.Writer, pkg string, mode Mode) io.WriteCloser {
118117
line: c.writeOutputEvent,
119118
part: c.writeOutputEvent,
120119
},
121-
testNames: make(map[string]bool),
122120
}
123121
return c
124122
}
@@ -153,8 +151,6 @@ var (
153151
[]byte("--- BENCH: "),
154152
}
155153

156-
testNamePrefix = "Test"
157-
158154
fourSpace = []byte(" ")
159155

160156
skipLinePrefix = []byte("? \t")
@@ -216,19 +212,7 @@ func (c *converter) handleInputLine(line []byte) {
216212
}
217213

218214
if !ok {
219-
// Not a special test output line, but it may be the beginning
220-
// of decorated test log output.
221-
dedent := bytes.TrimSpace(origLine)
222-
if bytes.HasPrefix(dedent, []byte(testNamePrefix)) {
223-
end := bytes.Index(dedent, []byte(":"))
224-
if end > 0 {
225-
name := string(dedent[:end])
226-
if c.testNames[name] {
227-
c.testName = name
228-
}
229-
}
230-
}
231-
215+
// Not a special test output line.
232216
c.output.write(origLine)
233217
return
234218
}
@@ -268,7 +252,6 @@ func (c *converter) handleInputLine(line []byte) {
268252
c.flushReport(indent)
269253
e.Test = name
270254
c.testName = name
271-
c.testNames[name] = true
272255
c.report = append(c.report, e)
273256
c.output.write(origLine)
274257
return
@@ -277,7 +260,6 @@ func (c *converter) handleInputLine(line []byte) {
277260
// Finish any pending PASS/FAIL reports.
278261
c.flushReport(0)
279262
c.testName = name
280-
c.testNames[name] = true
281263

282264
if action == "pause" {
283265
// For a pause, we want to write the pause notification before

src/cmd/internal/test2json/testdata/issue38050.json

Lines changed: 0 additions & 56 deletions
This file was deleted.

src/cmd/internal/test2json/testdata/issue38050.test

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)