Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
21a0d52a
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
21a0d52a
编写于
2月 12, 2013
作者:
B
bors
浏览文件
操作
浏览文件
下载
差异文件
auto merge of #4876 : brson/rust/debuginfo, r=brson
Update of #4862
上级
210fa2d0
79e9b6d6
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
178 addition
and
13 deletion
+178
-13
configure
configure
+2
-0
mk/tests.mk
mk/tests.mk
+31
-3
src/compiletest/common.rs
src/compiletest/common.rs
+3
-2
src/compiletest/compiletest.rc
src/compiletest/compiletest.rc
+4
-1
src/compiletest/header.rs
src/compiletest/header.rs
+30
-4
src/compiletest/runtest.rs
src/compiletest/runtest.rs
+54
-3
src/test/debug-info/simple.rs
src/test/debug-info/simple.rs
+21
-0
src/test/debug-info/struct.rs
src/test/debug-info/struct.rs
+33
-0
未找到文件。
configure
浏览文件 @
21a0d52a
...
...
@@ -394,6 +394,7 @@ probe CFG_PDFLATEX pdflatex
probe CFG_XETEX xetex
probe CFG_LUATEX luatex
probe CFG_NODE nodejs node
probe CFG_GDB gdb
if
[
"
$CFG_OSTYPE
"
=
"unknown-linux-gnu"
]
then
probe CFG_PAXCTL paxctl /sbin/paxctl
...
...
@@ -619,6 +620,7 @@ do
make_dir
$h
/test/bench
make_dir
$h
/test/perf
make_dir
$h
/test/pretty
make_dir
$h
/test/debug-info
make_dir
$h
/test/doc-tutorial
make_dir
$h
/test/doc-tutorial-ffi
make_dir
$h
/test/doc-tutorial-macros
...
...
mk/tests.mk
浏览文件 @
21a0d52a
...
...
@@ -103,7 +103,8 @@ cleantestlibs:
-name
'*.dSYM'
-o
\
-name
'*.libaux'
-o
\
-name
'*.out'
-o
\
-name
'*.err'
\
-name
'*.err'
-o
\
-name
'*.debugger.script'
\
| xargs
rm
-rf
...
...
@@ -170,6 +171,7 @@ check-stage$(1)-T-$(2)-H-$(3)-exec: \
check-stage$(1)-T-$(2)-H-$(3)-rpass-full-exec
\
check-stage$(1)-T-$(2)-H-$(3)-crates-exec
\
check-stage$(1)-T-$(2)-H-$(3)-bench-exec
\
check-stage$(1)-T-$(2)-H-$(3)-debuginfo-exec
\
check-stage$(1)-T-$(2)-H-$(3)-doc-exec
\
check-stage$(1)-T-$(2)-H-$(3)-pretty-exec
...
...
@@ -284,6 +286,7 @@ CFAIL_RC := $(wildcard $(S)src/test/compile-fail/*.rc)
CFAIL_RS
:=
$(
wildcard
$(S)
src/test/compile-fail/
*
.rs
)
BENCH_RS
:=
$(
wildcard
$(S)
src/test/bench/
*
.rs
)
PRETTY_RS
:=
$(
wildcard
$(S)
src/test/pretty/
*
.rs
)
DEBUGINFO_RS
:=
$(
wildcard
$(S)
src/test/debug-info/
*
.rs
)
# perf tests are the same as bench tests only they run under
# a performance monitor.
...
...
@@ -296,6 +299,7 @@ CFAIL_TESTS := $(CFAIL_RC) $(CFAIL_RS)
BENCH_TESTS
:=
$(BENCH_RS)
PERF_TESTS
:=
$(PERF_RS)
PRETTY_TESTS
:=
$(PRETTY_RS)
DEBUGINFO_TESTS
:=
$(DEBUGINFO_RS)
CTEST_SRC_BASE_rpass
=
run-pass
CTEST_BUILD_BASE_rpass
=
run-pass
...
...
@@ -327,6 +331,15 @@ CTEST_BUILD_BASE_perf = perf
CTEST_MODE_perf
=
run-pass
CTEST_RUNTOOL_perf
=
$(CTEST_PERF_RUNTOOL)
CTEST_SRC_BASE_debuginfo
=
debug-info
CTEST_BUILD_BASE_debuginfo
=
debug-info
CTEST_MODE_debuginfo
=
debug-info
CTEST_RUNTOOL_debuginfo
=
$(CTEST_RUNTOOL)
ifeq
($(CFG_GDB),)
CTEST_DISABLE_debuginfo
=
"no gdb found"
endif
define
DEF_CTEST_VARS
# All the per-stage build rules you might want to call from the
...
...
@@ -349,7 +362,7 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
--rustc-path
$$
(
HBIN
$(1)
_H_
$(3)
)
/rustc
$
$(X)
\
--aux-base
$
$(S)
src/test/auxiliary/
\
--stage-id
stage
$(1)
-
$(2)
\
--rustcflags
"
$
$(CFG_RUSTC_FLAGS)
--target=
$(2)
"
\
--rustcflags
"
$
$(CFG_RUSTC_FLAGS)
--target=
$(2)
"
\
$
$(CTEST_TESTARGS)
CTEST_DEPS_rpass_$(1)-T-$(2)-H-$(3)
=
$
$(RPASS_TESTS)
...
...
@@ -358,6 +371,7 @@ CTEST_DEPS_rfail_$(1)-T-$(2)-H-$(3) = $$(RFAIL_TESTS)
CTEST_DEPS_cfail_$(1)-T-$(2)-H-$(3)
=
$
$(CFAIL_TESTS)
CTEST_DEPS_bench_$(1)-T-$(2)-H-$(3)
=
$
$(BENCH_TESTS)
CTEST_DEPS_perf_$(1)-T-$(2)-H-$(3)
=
$
$(PERF_TESTS)
CTEST_DEPS_debuginfo_$(1)-T-$(2)-H-$(3)
=
$
$(DEBUGINFO_TESTS)
endef
...
...
@@ -377,6 +391,8 @@ CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4) := \
check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec
:
$$(call TEST_OK_FILE
,
$(1)
,
$(2)
,
$(3)
,
$(4))
ifeq
($$(CTEST_DISABLE_$(4)),)
$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
:
\
$$(TEST_SREQ$(1)_T_$(2)_H_$(3))
\
$$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3))
...
...
@@ -386,9 +402,20 @@ $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
--logfile
$
$(
call
TEST_LOG_FILE,
$(1)
,
$(2)
,
$(3)
,
$(4)
)
\
&&
touch
$$
@
else
$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
:
\
$$(TEST_SREQ$(1)_T_$(2)_H_$(3))
\
$$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3))
@
$
$(
call
E, run
$(4)
:
$$
<
)
@
$
$(
call
E, warning: tests disabled:
$$
(
CTEST_DISABLE_
$(4)
))
touch
$$
@
endif
endef
CTEST_NAMES
=
rpass rpass-full rfail cfail bench perf
CTEST_NAMES
=
rpass rpass-full rfail cfail bench perf
debuginfo
$(foreach
host,$(CFG_TARGET_TRIPLES),
\
$(eval
$(foreach
target,$(CFG_TARGET_TRIPLES),
\
...
...
@@ -496,6 +523,7 @@ TEST_GROUPS = \
cfail
\
bench
\
perf
\
debuginfo
\
doc
\
$(
foreach
docname,
$(DOC_TEST_NAMES)
,
$(docname)
)
\
pretty
\
...
...
src/compiletest/common.rs
浏览文件 @
21a0d52a
// Copyright 2012
The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// Copyright 2012
-2013 The Rust Project Developers. See the
//
COPYRIGHT
file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
...
...
@@ -18,6 +18,7 @@ pub enum mode {
mode_run_fail
,
mode_run_pass
,
mode_pretty
,
mode_debug_info
,
}
pub
type
config
=
{
...
...
src/compiletest/compiletest.rc
浏览文件 @
21a0d52a
...
...
@@ -41,6 +41,7 @@ use common::mode_run_pass;
use common::mode_run_fail;
use common::mode_compile_fail;
use common::mode_pretty;
use common::mode_debug_info;
use common::mode;
use util::logv;
...
...
@@ -131,6 +132,7 @@ pub fn str_mode(s: ~str) -> mode {
~"run-fail" => mode_run_fail,
~"run-pass" => mode_run_pass,
~"pretty" => mode_pretty,
~"debug-info" => mode_debug_info,
_ => die!(~"invalid mode")
}
}
...
...
@@ -140,7 +142,8 @@ pub fn mode_str(mode: mode) -> ~str {
mode_compile_fail => ~"compile-fail",
mode_run_fail => ~"run-fail",
mode_run_pass => ~"run-pass",
mode_pretty => ~"pretty"
mode_pretty => ~"pretty",
mode_debug_info => ~"debug-info",
}
}
...
...
src/compiletest/header.rs
浏览文件 @
21a0d52a
// Copyright 2012
The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// Copyright 2012
-2013 The Rust Project Developers. See the
//
COPYRIGHT
file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
...
...
@@ -28,7 +28,11 @@ pub struct TestProps {
// Modules from aux directory that should be compiled
aux_builds
:
~
[
~
str
],
// Environment settings to use during execution
exec_env
:
~
[(
~
str
,
~
str
)]
exec_env
:
~
[(
~
str
,
~
str
)],
// Commands to be given to the debugger, when testing debug info
debugger_cmds
:
~
[
~
str
],
// Lines to check if they appear in the expected debugger output
check_lines
:
~
[
~
str
],
}
// Load any test directives embedded in the file
...
...
@@ -38,6 +42,8 @@ pub fn load_props(testfile: &Path) -> TestProps {
let
mut
exec_env
=
~
[];
let
mut
compile_flags
=
None
;
let
mut
pp_exact
=
None
;
let
mut
debugger_cmds
=
~
[];
let
mut
check_lines
=
~
[];
for
iter_header
(
testfile
)
|
ln
|
{
match
parse_error_pattern
(
ln
)
{
Some
(
ep
)
=>
error_patterns
.push
(
ep
),
...
...
@@ -59,13 +65,25 @@ pub fn load_props(testfile: &Path) -> TestProps {
do
parse_exec_env
(
ln
)
.iter
|
ee
|
{
exec_env
.push
(
*
ee
);
}
match
parse_debugger_cmd
(
ln
)
{
Some
(
dc
)
=>
debugger_cmds
.push
(
dc
),
None
=>
()
};
match
parse_check_line
(
ln
)
{
Some
(
cl
)
=>
check_lines
.push
(
cl
),
None
=>
()
};
};
return
TestProps
{
error_patterns
:
error_patterns
,
compile_flags
:
compile_flags
,
pp_exact
:
pp_exact
,
aux_builds
:
aux_builds
,
exec_env
:
exec_env
exec_env
:
exec_env
,
debugger_cmds
:
debugger_cmds
,
check_lines
:
check_lines
};
}
...
...
@@ -112,6 +130,14 @@ fn parse_compile_flags(line: ~str) -> Option<~str> {
parse_name_value_directive
(
line
,
~
"compile-flags"
)
}
fn
parse_debugger_cmd
(
line
:
~
str
)
->
Option
<~
str
>
{
parse_name_value_directive
(
line
,
~
"debugger"
)
}
fn
parse_check_line
(
line
:
~
str
)
->
Option
<~
str
>
{
parse_name_value_directive
(
line
,
~
"check"
)
}
fn
parse_exec_env
(
line
:
~
str
)
->
Option
<
(
~
str
,
~
str
)
>
{
do
parse_name_value_directive
(
line
,
~
"exec-env"
)
.map
|
nv
|
{
// nv is either FOO or FOO=BAR
...
...
src/compiletest/runtest.rs
浏览文件 @
21a0d52a
// Copyright 2012
The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// Copyright 2012
-2013 The Rust Project Developers. See the
//
COPYRIGHT
file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
...
...
@@ -39,11 +39,13 @@ pub fn run(config: config, testfile: ~str) {
let
testfile
=
Path
(
testfile
);
debug!
(
"running %s"
,
testfile
.to_str
());
let
props
=
load_props
(
&
testfile
);
debug!
(
"loaded props"
);
match
config
.mode
{
mode_compile_fail
=>
run_cfail_test
(
config
,
props
,
&
testfile
),
mode_run_fail
=>
run_rfail_test
(
config
,
props
,
&
testfile
),
mode_run_pass
=>
run_rpass_test
(
config
,
props
,
&
testfile
),
mode_pretty
=>
run_pretty_test
(
config
,
props
,
&
testfile
)
mode_pretty
=>
run_pretty_test
(
config
,
props
,
&
testfile
),
mode_debug_info
=>
run_debuginfo_test
(
config
,
props
,
&
testfile
)
}
}
...
...
@@ -224,6 +226,55 @@ fn make_typecheck_args(config: config, testfile: &Path) -> ProcArgs {
}
}
fn
run_debuginfo_test
(
config
:
config
,
props
:
TestProps
,
testfile
:
&
Path
)
{
// compile test file (it shoud have 'compile-flags:-g' in the header)
let
mut
ProcRes
=
compile_test
(
config
,
props
,
testfile
);
if
ProcRes
.status
!=
0
{
fatal_ProcRes
(
~
"compilation failed!"
,
ProcRes
);
}
// write debugger script
let
script_str
=
str
::
append
(
str
::
connect
(
props
.debugger_cmds
,
"
\n
"
),
~
"
\n
quit
\n
"
);
debug!
(
"script_str = %s"
,
script_str
);
dump_output_file
(
config
,
testfile
,
script_str
,
~
"debugger.script"
);
// run debugger script with gdb
#[cfg(windows)]
fn
debugger
()
->
~
str
{
~
"gdb.exe"
}
#[cfg(unix)]
fn
debugger
()
->
~
str
{
~
"gdb"
}
let
debugger_script
=
make_out_name
(
config
,
testfile
,
~
"debugger.script"
);
let
debugger_opts
=
~
[
~
"-quiet"
,
~
"-batch"
,
~
"-nx"
,
~
"-command="
+
debugger_script
.to_str
(),
make_exe_name
(
config
,
testfile
)
.to_str
()];
let
ProcArgs
=
ProcArgs
{
prog
:
debugger
(),
args
:
debugger_opts
};
ProcRes
=
compose_and_run
(
config
,
testfile
,
ProcArgs
,
~
[],
~
""
,
None
);
if
ProcRes
.status
!=
0
{
fatal
(
~
"gdb failed to execute"
);
}
let
num_check_lines
=
vec
::
len
(
props
.check_lines
);
if
num_check_lines
>
0
{
// check if each line in props.check_lines appears in the
// output (in order)
let
mut
i
=
0u
;
for
str
::
lines
(
ProcRes
.stdout
)
.each
|
line
|
{
if
props
.check_lines
[
i
]
.trim
()
==
line
.trim
()
{
i
+=
1u
;
}
if
i
==
num_check_lines
{
// all lines checked
break
;
}
}
if
i
!=
num_check_lines
{
fatal
(
fmt!
(
"line not found in debugger output: %s"
,
props
.check_lines
[
i
]));
}
}
}
fn
check_error_patterns
(
props
:
TestProps
,
testfile
:
&
Path
,
ProcRes
:
ProcRes
)
{
...
...
src/test/debug-info/simple.rs
0 → 100644
浏览文件 @
21a0d52a
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// xfail-test
// compile-flags:-g
// debugger:break 20
// debugger:run
// debugger:print x
// check:$1 = 42
fn
main
()
{
let
x
=
42
;
debug!
(
"The answer is %d"
,
x
);
}
src/test/debug-info/struct.rs
0 → 100644
浏览文件 @
21a0d52a
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// xfail-test
// compile-flags:-g
// debugger:break 32
// debugger:run
// debugger:print pair
// check:$1 = {
// check:x = 1,
// check:y = 2,
// check:}
// debugger:print pair.x
// check:$2 = 1
// debugger:print pair.y
// check:$3 = 2
struct
Pair
{
x
:
int
,
y
:
int
}
fn
main
()
{
let
pair
=
Pair
{
x
:
1
,
y
:
2
};
debug!
(
"x = %d, y = %d"
,
pair
.x
,
pair
.y
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录