Skip to content

Commit ceb495b

Browse files
committed
Do not handle ignore-tidy directives in UI test mode
This is so the collection script can properly omit collecting tidy directives.
1 parent 3474e5c commit ceb495b

File tree

1 file changed

+32
-17
lines changed

1 file changed

+32
-17
lines changed

src/tools/compiletest/src/header.rs

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -999,26 +999,41 @@ pub fn make_test_description<R: Read>(
999999
}
10001000

10011001
macro_rules! decision {
1002-
($e:expr) => {
1003-
match $e {
1004-
IgnoreDecision::Ignore { reason } => {
1005-
ignore = true;
1006-
// The ignore reason must be a &'static str, so we have to leak memory to
1007-
// create it. This is fine, as the header is parsed only at the start of
1008-
// compiletest so it won't grow indefinitely.
1009-
ignore_message = Some(&*Box::leak(Box::<str>::from(reason)));
1002+
($e:expr) => {
1003+
match $e {
1004+
IgnoreDecision::Ignore { reason } => {
1005+
ignore = true;
1006+
// The ignore reason must be a &'static str, so we have to leak memory to
1007+
// create it. This is fine, as the header is parsed only at the start of
1008+
// compiletest so it won't grow indefinitely.
1009+
ignore_message = Some(&*Box::leak(Box::<str>::from(reason)));
1010+
}
1011+
IgnoreDecision::Error { message } => {
1012+
eprintln!("error: {}:{line_number}: {message}", path.display());
1013+
*poisoned = true;
1014+
return;
1015+
}
1016+
IgnoreDecision::Continue => {}
10101017
}
1011-
IgnoreDecision::Error { message } => {
1012-
eprintln!("error: {}:{line_number}: {message}", path.display());
1013-
*poisoned = true;
1014-
return;
1015-
}
1016-
IgnoreDecision::Continue => {}
1018+
};
1019+
}
1020+
1021+
// Do not handle `// ignore-tidy` or `// ignore-tidy-*` because they are tidy directives,
1022+
// not compiletest directives (which would begin with `//@` for UI tests).
1023+
if config.mode == Mode::Ui {
1024+
let split = og_ln.trim_start().split_once("//");
1025+
if !split
1026+
.map(|(pre, post)| {
1027+
pre.is_empty() && post.trim_start().starts_with("ignore-tidy")
1028+
})
1029+
.unwrap_or(false)
1030+
{
1031+
decision!(cfg::handle_ignore(config, ln));
10171032
}
1018-
};
1019-
}
1033+
} else {
1034+
decision!(cfg::handle_ignore(config, ln));
1035+
}
10201036

1021-
decision!(cfg::handle_ignore(config, ln));
10221037
decision!(cfg::handle_only(config, ln));
10231038
decision!(needs::handle_needs(&cache.needs, config, ln));
10241039
decision!(ignore_llvm(config, ln));

0 commit comments

Comments
 (0)