Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
e8cfd4db
Commit
e8cfd4db
authored
Dec 24, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
6bb1677f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
+6
-8
go/internal/xtracing/tracetest/example_test.go
go/internal/xtracing/tracetest/example_test.go
+6
-8
No files found.
go/internal/xtracing/tracetest/example_test.go
View file @
e8cfd4db
...
...
@@ -183,12 +183,11 @@ func verifyInSubprocess(t *testing.T, f func(t *testing.T), targvExtra ...string
argv
=
append
(
argv
,
targvExtra
...
)
cmd
:=
exec
.
Command
(
os
.
Args
[
0
],
argv
...
)
cmd
.
Env
=
append
(
os
.
Environ
(),
"TRACETEST_EX_VERIFY_IN_SUBPROCESS=1"
)
bout
,
err
:=
cmd
.
Output
()
stdout
:=
string
(
bout
)
stderr
:=
""
bout
,
err
:=
cmd
.
CombinedOutput
()
// NOTE `go test` combines everything to stdout only
out
:=
string
(
bout
)
ecode
:=
0
if
testing
.
Verbose
()
{
t
.
Logf
(
"stdout:
\n
%s
\n
"
,
std
out
)
t
.
Logf
(
"stdout:
\n
%s
\n
"
,
out
)
}
if
err
!=
nil
{
e
,
ok
:=
err
.
(
*
exec
.
ExitError
)
...
...
@@ -196,7 +195,6 @@ func verifyInSubprocess(t *testing.T, f func(t *testing.T), targvExtra ...string
// e.g. could not respawn at all
t
.
Fatal
(
err
)
}
stderr
=
string
(
e
.
Stderr
)
ecode
=
e
.
ExitCode
()
}
...
...
@@ -209,8 +207,8 @@ func verifyInSubprocess(t *testing.T, f func(t *testing.T), targvExtra ...string
badf
(
"exit code: %d ; expected: %d"
,
ecode
,
expectOK
.
exitCode
)
}
if
stderr
!=
expectOK
.
stderr
Re
{
// XXX match with re
badf
(
"unexpected
stderr:
\n
%s
\n
want: %s
\n
"
,
stderr
,
expectOK
.
stderr
Re
)
if
out
!=
expectOK
.
output
Re
{
// XXX match with re
badf
(
"unexpected
output:
\n
%s
\n
want: %s
\n
"
,
out
,
expectOK
.
output
Re
)
}
if
bad
!=
""
{
...
...
@@ -221,7 +219,7 @@ func verifyInSubprocess(t *testing.T, f func(t *testing.T), targvExtra ...string
// testExpect describes what result to expect from a test.
type
testExpect
struct
{
exitCode
int
stderr
Re
string
output
Re
string
}
// testExpectMap maps <test name> -> testExpect.
var
testExpectMap
=
map
[
string
]
testExpect
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment