Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
40ae704f
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,发现更多精彩内容 >>
提交
40ae704f
编写于
8月 10, 2011
作者:
B
Brian Anderson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Begin valgrinding run-fail tests
Introduce a temporary no-valgrind directive for the few that aren't clean
上级
0cd607bc
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
41 addition
and
20 deletion
+41
-20
mk/tests.mk
mk/tests.mk
+1
-1
src/test/compiletest/header.rs
src/test/compiletest/header.rs
+11
-2
src/test/compiletest/runtest.rs
src/test/compiletest/runtest.rs
+24
-9
src/test/run-fail/explicit-fail-msg.rs
src/test/run-fail/explicit-fail-msg.rs
+1
-2
src/test/run-fail/fmt-fail.rs
src/test/run-fail/fmt-fail.rs
+1
-0
src/test/run-fail/linked-failure.rs
src/test/run-fail/linked-failure.rs
+1
-0
src/test/run-fail/vec-overrun.rs
src/test/run-fail/vec-overrun.rs
+1
-3
src/test/run-fail/vec-underrun.rs
src/test/run-fail/vec-underrun.rs
+1
-3
未找到文件。
mk/tests.mk
浏览文件 @
40ae704f
...
...
@@ -185,11 +185,11 @@ CFAIL_ARGS$(2) := $$(CTEST_COMMON_ARGS$(2)) \
--build-base
test
/compile-fail/
\
--mode
compile-fail
\
# FIXME (236): run-fail should run under valgrind once unwinding works
RFAIL_ARGS$(2)
:=
$$
(
CTEST_COMMON_ARGS
$(2)
)
\
--src-base
$
$(S)
src/test/run-fail/
\
--build-base
test
/run-fail/
\
--mode
run-fail
\
$
$(CTEST_RUNTOOL)
\
RPASS_ARGS$(2)
:=
$$
(
CTEST_COMMON_ARGS
$(2)
)
\
--src-base
$(S)
src/test/run-pass/
\
...
...
src/test/compiletest/header.rs
浏览文件 @
40ae704f
...
...
@@ -16,7 +16,10 @@
compile_flags
:
option
::
t
[
str
],
// If present, the name of a file that this test should match when
// pretty-printed
pp_exact
:
option
::
t
[
str
]
pp_exact
:
option
::
t
[
str
],
// FIXME: no-valgrind is a temporary directive until all of run-fail
// is valgrind-clean
no_valgrind
:
bool
};
// Load any test directives embedded in the file
...
...
@@ -24,6 +27,7 @@ fn load_props(testfile: &str) -> test_props {
let
error_patterns
=
~
[];
let
compile_flags
=
option
::
none
;
let
pp_exact
=
option
::
none
;
let
no_valgrind
=
false
;
for
each
ln
:
str
in
iter_header
(
testfile
)
{
alt
parse_error_pattern
(
ln
)
{
option
::
some
(
ep
)
{
error_patterns
+=
~
[
ep
];
}
...
...
@@ -37,11 +41,16 @@ fn load_props(testfile: &str) -> test_props {
if
option
::
is_none
(
pp_exact
)
{
pp_exact
=
parse_pp_exact
(
ln
,
testfile
);
}
if
no_valgrind
==
false
{
no_valgrind
=
parse_name_directive
(
ln
,
"no-valgrind"
);
}
}
ret
{
error_patterns
:
error_patterns
,
compile_flags
:
compile_flags
,
pp_exact
:
pp_exact
pp_exact
:
pp_exact
,
no_valgrind
:
no_valgrind
};
}
...
...
src/test/compiletest/runtest.rs
浏览文件 @
40ae704f
...
...
@@ -53,13 +53,22 @@ fn run_rfail_test(cx: &cx, props: &test_props, testfile: &str) {
if
procres
.status
!=
0
{
fatal_procres
(
"compilation failed!"
,
procres
);
}
procres
=
exec_compiled_test
(
cx
,
testfile
);
procres
=
exec_compiled_test
(
cx
,
props
,
testfile
);
if
procres
.status
==
0
{
fatal_procres
(
"run-fail test didn't produce an error!"
,
procres
);
}
// This is the value valgrind returns on failure
// FIXME: Why is this value neither the value we pass to
// valgrind as --error-exitcode (1), nor the value we see as the
// exit code on the command-line (137)?
const
valgrind_err
:
int
=
9
;
if
procres
.status
==
valgrind_err
{
fatal_procres
(
"run-fail test isn't valgrind-clean!"
,
procres
);
}
check_error_patterns
(
props
,
testfile
,
procres
);
}
...
...
@@ -69,7 +78,7 @@ fn run_rpass_test(cx: &cx, props: &test_props, testfile: &str) {
if
procres
.status
!=
0
{
fatal_procres
(
"compilation failed!"
,
procres
);
}
procres
=
exec_compiled_test
(
cx
,
testfile
);
procres
=
exec_compiled_test
(
cx
,
props
,
testfile
);
if
procres
.status
!=
0
{
fatal_procres
(
"test run failed!"
,
procres
);
}
...
...
@@ -219,8 +228,9 @@ fn compile_test(cx: &cx, props: &test_props, testfile: &str) -> procres {
cx
.config.compile_lib_path
,
option
::
none
)
}
fn
exec_compiled_test
(
cx
:
&
cx
,
testfile
:
&
str
)
->
procres
{
compose_and_run
(
cx
,
testfile
,
make_run_args
,
fn
exec_compiled_test
(
cx
:
&
cx
,
props
:
&
test_props
,
testfile
:
&
str
)
->
procres
{
compose_and_run
(
cx
,
testfile
,
bind
make_run_args
(
_
,
props
,
_
),
cx
.config.run_lib_path
,
option
::
none
)
}
...
...
@@ -248,12 +258,17 @@ fn make_exe_name(config: &config, testfile: &str) -> str {
output_base_name
(
config
,
testfile
)
+
os
::
exec_suffix
()
}
fn
make_run_args
(
config
:
&
config
,
testfile
:
&
str
)
->
procargs
{
fn
make_run_args
(
config
:
&
config
,
props
:
&
test_props
,
testfile
:
&
str
)
->
procargs
{
let
toolargs
=
if
!
props
.no_valgrind
{
// If we've got another tool to run under (valgrind),
// then split apart its command
let
args
=
split_maybe_args
(
config
.runtool
)
+
[
make_exe_name
(
config
,
testfile
)];
}
else
{
[]
};
let
args
=
toolargs
+
[
make_exe_name
(
config
,
testfile
)];
ret
{
prog
:
args
.
(
0
),
args
:
vec
::
slice
(
args
,
1u
,
vec
::
len
(
args
))};
}
...
...
src/test/run-fail/explicit-fail-msg.rs
浏览文件 @
40ae704f
// error-pattern:wooooo
// no-valgrind
fn
main
()
{
let
a
=
1
;
if
1
==
1
{
a
=
2
;
}
fail
"woooo"
+
"o"
;
}
\ No newline at end of file
src/test/run-fail/fmt-fail.rs
浏览文件 @
40ae704f
// error-pattern:meh
// no-valgrind
use
std
;
import
std
::
str
;
...
...
src/test/run-fail/linked-failure.rs
浏览文件 @
40ae704f
// -*- rust -*-
// error-pattern:1 == 2
// no-valgrind
fn
child
()
{
assert
(
1
==
2
);
}
...
...
src/test/run-fail/vec-overrun.rs
浏览文件 @
40ae704f
// -*- rust -*-
// error-pattern:bounds check
// no-valgrind
fn
main
()
{
let
v
:
vec
[
int
]
=
[
10
];
let
x
:
int
=
0
;
...
...
src/test/run-fail/vec-underrun.rs
浏览文件 @
40ae704f
// -*- rust -*-
// error-pattern:bounds check
// no-valgrind
fn
main
()
{
let
v
:
vec
[
int
]
=
[
10
,
20
];
let
x
:
int
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录