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
8d58ab5c
Commit
8d58ab5c
authored
Dec 24, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
8ee01a27
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
go/internal/xtracing/tracetest/example_test.go
go/internal/xtracing/tracetest/example_test.go
+8
-6
No files found.
go/internal/xtracing/tracetest/example_test.go
View file @
8d58ab5c
...
@@ -183,16 +183,18 @@ func verifyInSubprocess(t *testing.T, f func(t *testing.T), targvExtra ...string
...
@@ -183,16 +183,18 @@ func verifyInSubprocess(t *testing.T, f func(t *testing.T), targvExtra ...string
argv
=
append
(
argv
,
targvExtra
...
)
argv
=
append
(
argv
,
targvExtra
...
)
cmd
:=
exec
.
Command
(
os
.
Args
[
0
],
argv
...
)
cmd
:=
exec
.
Command
(
os
.
Args
[
0
],
argv
...
)
cmd
.
Env
=
append
(
os
.
Environ
(),
"TRACETEST_EX_VERIFY_IN_SUBPROCESS=1"
)
cmd
.
Env
=
append
(
os
.
Environ
(),
"TRACETEST_EX_VERIFY_IN_SUBPROCESS=1"
)
bout
,
err
:=
cmd
.
CombinedOutput
()
bout
,
err
:=
cmd
.
Output
()
out
:=
string
(
bout
)
stdout
:=
string
(
bout
)
stderr
:=
""
ecode
:=
0
ecode
:=
0
if
err
!=
nil
{
if
err
!=
nil
{
e
,
ok
:=
err
.
(
*
exec
.
ExitError
)
e
,
ok
:=
err
.
(
*
exec
.
ExitError
)
if
!
ok
{
if
!
ok
{
// e.g. could not respawn at all
// e.g. could not respawn at all
t
.
Log
(
out
)
t
.
Log
(
std
out
)
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
stderr
=
string
(
e
.
Stderr
)
ecode
=
e
.
ExitCode
()
ecode
=
e
.
ExitCode
()
}
}
...
@@ -205,8 +207,8 @@ func verifyInSubprocess(t *testing.T, f func(t *testing.T), targvExtra ...string
...
@@ -205,8 +207,8 @@ func verifyInSubprocess(t *testing.T, f func(t *testing.T), targvExtra ...string
badf
(
"exit code: %d ; expected: %d"
,
ecode
,
expectOK
.
exitCode
)
badf
(
"exit code: %d ; expected: %d"
,
ecode
,
expectOK
.
exitCode
)
}
}
if
out
!=
expectOK
.
output
Re
{
// XXX match with re
if
stderr
!=
expectOK
.
stderr
Re
{
// XXX match with re
badf
(
"unexpected
output:
\n
%s
\n
want: %s
\n
"
,
out
,
expectOK
.
output
Re
)
badf
(
"unexpected
stderr:
\n
%s
\n
want: %s
\n
"
,
stderr
,
expectOK
.
stderr
Re
)
}
}
if
bad
!=
""
{
if
bad
!=
""
{
...
@@ -217,7 +219,7 @@ func verifyInSubprocess(t *testing.T, f func(t *testing.T), targvExtra ...string
...
@@ -217,7 +219,7 @@ func verifyInSubprocess(t *testing.T, f func(t *testing.T), targvExtra ...string
// testExpect describes what result to expect from a test.
// testExpect describes what result to expect from a test.
type
testExpect
struct
{
type
testExpect
struct
{
exitCode
int
exitCode
int
output
Re
string
stderr
Re
string
}
}
// testExpectMap maps <test name> -> testExpect.
// testExpectMap maps <test name> -> testExpect.
var
testExpectMap
=
map
[
string
]
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