Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
804b72af
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,发现更多精彩内容 >>
提交
804b72af
编写于
11月 26, 2020
作者:
J
Joshua Nelson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
If tidy isn't installed, only give one error, not many
上级
409382dd
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
22 addition
and
19 deletion
+22
-19
src/tools/compiletest/src/common.rs
src/tools/compiletest/src/common.rs
+3
-0
src/tools/compiletest/src/main.rs
src/tools/compiletest/src/main.rs
+11
-1
src/tools/compiletest/src/runtest.rs
src/tools/compiletest/src/runtest.rs
+8
-18
未找到文件。
src/tools/compiletest/src/common.rs
浏览文件 @
804b72af
...
...
@@ -327,6 +327,9 @@ pub struct Config {
/// created in `/<build_base>/rustfix_missing_coverage.txt`
pub
rustfix_coverage
:
bool
,
/// whether to run `tidy` when a rustdoc test fails
pub
has_tidy
:
bool
,
// Configuration for various run-make tests frobbing things like C compilers
// or querying about various LLVM component information.
pub
cc
:
String
,
...
...
src/tools/compiletest/src/main.rs
浏览文件 @
804b72af
...
...
@@ -14,7 +14,7 @@
use
std
::
fs
;
use
std
::
io
::{
self
,
ErrorKind
};
use
std
::
path
::{
Path
,
PathBuf
};
use
std
::
process
::
Command
;
use
std
::
process
::
{
Command
,
Stdio
}
;
use
std
::
time
::
SystemTime
;
use
test
::
ColorConfig
;
use
tracing
::
*
;
...
...
@@ -43,6 +43,10 @@ fn main() {
panic!
(
"Can't find Valgrind to run Valgrind tests"
);
}
if
!
config
.has_tidy
&&
config
.mode
==
Mode
::
Rustdoc
{
eprintln!
(
"warning: `tidy` is not installed; generated diffs will be harder to read"
);
}
log_config
(
&
config
);
run_tests
(
config
);
}
...
...
@@ -189,6 +193,11 @@ fn make_absolute(path: PathBuf) -> PathBuf {
let
src_base
=
opt_path
(
matches
,
"src-base"
);
let
run_ignored
=
matches
.opt_present
(
"ignored"
);
let
has_tidy
=
Command
::
new
(
"tidy"
)
.arg
(
"--version"
)
.stdout
(
Stdio
::
null
())
.status
()
.map_or
(
false
,
|
status
|
status
.success
());
Config
{
bless
:
matches
.opt_present
(
"bless"
),
compile_lib_path
:
make_absolute
(
opt_path
(
matches
,
"compile-lib-path"
)),
...
...
@@ -244,6 +253,7 @@ fn make_absolute(path: PathBuf) -> PathBuf {
remote_test_client
:
matches
.opt_str
(
"remote-test-client"
)
.map
(
PathBuf
::
from
),
compare_mode
:
matches
.opt_str
(
"compare-mode"
)
.map
(
CompareMode
::
parse
),
rustfix_coverage
:
matches
.opt_present
(
"rustfix-coverage"
),
has_tidy
,
cc
:
matches
.opt_str
(
"cc"
)
.unwrap
(),
cxx
:
matches
.opt_str
(
"cxx"
)
.unwrap
(),
...
...
src/tools/compiletest/src/runtest.rs
浏览文件 @
804b72af
...
...
@@ -2409,32 +2409,22 @@ fn compare_to_default_rustdoc(&mut self, out_dir: &Path) {
"-modify"
,
];
let
tidy_dir
=
|
dir
|
{
let
tidy
=
|
file
:
&
_
|
{
let
tidy_proc
=
Command
::
new
(
"tidy"
)
.args
(
&
tidy_args
)
.arg
(
file
)
.spawn
();
match
tidy_proc
{
Ok
(
mut
proc
)
=>
{
proc
.wait
()
.unwrap
();
true
}
Err
(
err
)
=>
{
eprintln!
(
"failed to run tidy - is it installed? - {}"
,
err
);
false
}
}
};
for
entry
in
walkdir
::
WalkDir
::
new
(
dir
)
{
let
entry
=
entry
.expect
(
"failed to read file"
);
if
entry
.file_type
()
.is_file
()
&&
entry
.path
()
.extension
()
.and_then
(|
p
|
p
.to_str
())
==
Some
(
"html"
.into
())
{
if
!
tidy
(
entry
.path
())
{
return
;
}
let
status
=
Command
::
new
(
"tidy"
)
.args
(
&
tidy_args
)
.arg
(
entry
.path
())
.status
()
.unwrap
();
// `tidy` returns 1 if it modified the file.
assert
!
(
status
.success
()
||
status
.code
()
==
Some
(
1
));
}
}
};
if
self
.config.has_tidy
{
tidy_dir
(
out_dir
);
tidy_dir
(
&
compare_dir
);
}
let
pager
=
{
let
output
=
Command
::
new
(
"git"
)
.args
(
&
[
"config"
,
"--get"
,
"core.pager"
])
.output
()
.ok
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录