Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
HugeYuan
delve
提交
bc299a7a
D
delve
项目概览
HugeYuan
/
delve
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
delve
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
bc299a7a
编写于
4月 16, 2020
作者:
A
Alessandro Arzilli
提交者:
GitHub
4月 16, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tests: properly check if cgo is enabled for cgo related tests (#2010)
上级
c06a1a02
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
25 addition
and
6 deletion
+25
-6
pkg/proc/proc_test.go
pkg/proc/proc_test.go
+11
-6
pkg/proc/test/support.go
pkg/proc/test/support.go
+14
-0
未找到文件。
pkg/proc/proc_test.go
浏览文件 @
bc299a7a
...
...
@@ -805,9 +805,7 @@ func TestCGONext(t *testing.T) {
if
runtime
.
GOOS
==
"darwin"
&&
strings
.
Contains
(
runtime
.
Version
(),
"1.4"
)
{
return
}
if
os
.
Getenv
(
"CGO_ENABLED"
)
==
""
{
return
}
protest
.
MustHaveCgo
(
t
)
protest
.
AllowRecording
(
t
)
withTestProcess
(
"cgotest"
,
t
,
func
(
p
*
proc
.
Target
,
fixture
protest
.
Fixture
)
{
...
...
@@ -1047,9 +1045,7 @@ func TestGetG(t *testing.T) {
if
runtime
.
GOOS
==
"darwin"
&&
strings
.
Contains
(
runtime
.
Version
(),
"1.4"
)
{
return
}
if
os
.
Getenv
(
"CGO_ENABLED"
)
==
""
{
return
}
protest
.
MustHaveCgo
(
t
)
protest
.
AllowRecording
(
t
)
withTestProcess
(
"cgotest"
,
t
,
func
(
p
*
proc
.
Target
,
fixture
protest
.
Fixture
)
{
...
...
@@ -3264,6 +3260,7 @@ func TestCgoStacktrace(t *testing.T) {
if
runtime
.
GOARCH
==
"386"
{
t
.
Skip
(
"cgo stacktraces not supported on i386 for now"
)
}
protest
.
MustHaveCgo
(
t
)
// Tests that:
// a) we correctly identify the goroutine while we are executing cgo code
...
...
@@ -3368,6 +3365,8 @@ func TestCgoSources(t *testing.T) {
t
.
Skip
(
"cgo stacktraces not supported on i386 for now"
)
}
protest
.
MustHaveCgo
(
t
)
withTestProcess
(
"cgostacktest/"
,
t
,
func
(
p
*
proc
.
Target
,
fixture
protest
.
Fixture
)
{
sources
:=
p
.
BinInfo
()
.
Sources
for
_
,
needle
:=
range
[]
string
{
"main.go"
,
"hello.c"
}
{
...
...
@@ -3441,6 +3440,8 @@ func TestIssue1034(t *testing.T) {
t
.
Skip
(
"cgo stacktraces not supported on i386 for now"
)
}
protest
.
MustHaveCgo
(
t
)
// The external linker on macOS produces an abbrev for DW_TAG_subprogram
// without the "has children" flag, we should support this.
withTestProcess
(
"cgostacktest/"
,
t
,
func
(
p
*
proc
.
Target
,
fixture
protest
.
Fixture
)
{
...
...
@@ -3462,6 +3463,8 @@ func TestIssue1008(t *testing.T) {
t
.
Skip
(
"cgo stacktraces not supported on i386 for now"
)
}
protest
.
MustHaveCgo
(
t
)
// The external linker on macOS inserts "end of sequence" extended opcodes
// in debug_line. which we should support correctly.
withTestProcess
(
"cgostacktest/"
,
t
,
func
(
p
*
proc
.
Target
,
fixture
protest
.
Fixture
)
{
...
...
@@ -4416,6 +4419,7 @@ func TestPluginStepping(t *testing.T) {
}
func
TestIssue1601
(
t
*
testing
.
T
)
{
protest
.
MustHaveCgo
(
t
)
//Tests that recursive types involving C qualifiers and typedefs are parsed correctly
withTestProcess
(
"issue1601"
,
t
,
func
(
p
*
proc
.
Target
,
fixture
protest
.
Fixture
)
{
assertNoError
(
p
.
Continue
(),
t
,
"Continue"
)
...
...
@@ -4443,6 +4447,7 @@ func TestCgoStacktrace2(t *testing.T) {
if
runtime
.
GOOS
==
"windows"
{
t
.
Skip
(
"fixture crashes go runtime on windows"
)
}
protest
.
MustHaveCgo
(
t
)
// If a panic happens during cgo execution the stacktrace should show the C
// function that caused the problem.
withTestProcess
(
"cgosigsegvstack"
,
t
,
func
(
p
*
proc
.
Target
,
fixture
protest
.
Fixture
)
{
...
...
pkg/proc/test/support.go
浏览文件 @
bc299a7a
...
...
@@ -355,3 +355,17 @@ func WithPlugins(t *testing.T, flags BuildFlags, plugins ...string) []Fixture {
}
return
r
}
var
hasCgo
=
func
()
bool
{
out
,
err
:=
exec
.
Command
(
"go"
,
"env"
,
"CGO_ENABLED"
)
.
CombinedOutput
()
if
err
!=
nil
{
panic
(
err
)
}
return
strings
.
TrimSpace
(
string
(
out
))
==
"1"
}()
func
MustHaveCgo
(
t
*
testing
.
T
)
{
if
!
hasCgo
{
t
.
Skip
(
"Cgo not enabled"
)
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录