|
@@ -109,9 +109,6 @@ func TestParse(t *testing.T) {
|
109
|
109
|
|
110
|
110
|
flags := strings.Split(tc.flags, ",")
|
111
|
111
|
|
112
|
|
- // Skip the output format in the first flag, to output to a proto
|
113
|
|
- addFlags(&f, flags[1:])
|
114
|
|
-
|
115
|
112
|
// Encode profile into a protobuf and decode it again.
|
116
|
113
|
protoTempFile, err := ioutil.TempFile("", "profile_proto")
|
117
|
114
|
if err != nil {
|
|
@@ -124,6 +121,7 @@ func TestParse(t *testing.T) {
|
124
|
121
|
if flags[0] == "topproto" {
|
125
|
122
|
f.bools["proto"] = false
|
126
|
123
|
f.bools["topproto"] = true
|
|
124
|
+ f.bools["addresses"] = true
|
127
|
125
|
}
|
128
|
126
|
|
129
|
127
|
// First pprof invocation to save the profile into a profile.proto.
|
|
@@ -145,23 +143,22 @@ func TestParse(t *testing.T) {
|
145
|
143
|
}
|
146
|
144
|
defer os.Remove(outputTempFile.Name())
|
147
|
145
|
defer outputTempFile.Close()
|
|
146
|
+
|
|
147
|
+ f = baseFlags()
|
148
|
148
|
f.strings["output"] = outputTempFile.Name()
|
149
|
149
|
f.args = []string{protoTempFile.Name()}
|
150
|
150
|
|
151
|
|
- var solution string
|
|
151
|
+ delete(f.bools, "proto")
|
|
152
|
+ addFlags(&f, flags)
|
|
153
|
+ solution := solutionFilename(tc.source, &f)
|
152
|
154
|
// Apply the flags for the second pprof run, and identify name of
|
153
|
155
|
// the file containing expected results
|
154
|
156
|
if flags[0] == "topproto" {
|
|
157
|
+ addFlags(&f, flags)
|
155
|
158
|
solution = solutionFilename(tc.source, &f)
|
156
|
159
|
delete(f.bools, "topproto")
|
157
|
160
|
f.bools["text"] = true
|
158
|
|
- } else {
|
159
|
|
- delete(f.bools, "proto")
|
160
|
|
- addFlags(&f, flags[:1])
|
161
|
|
- solution = solutionFilename(tc.source, &f)
|
162
|
161
|
}
|
163
|
|
- // The add_comment flag is not idempotent so only apply it on the first run.
|
164
|
|
- delete(f.strings, "add_comment")
|
165
|
162
|
|
166
|
163
|
// Second pprof invocation to read the profile from profile.proto
|
167
|
164
|
// and generate a report.
|