Skip to content

Commit 227be65

Browse files
compiletest: Allow for tests requiring profiler-rt or sanitizer-rt support.
1 parent 4269be3 commit 227be65

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/tools/compiletest/src/header.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ impl EarlyProps {
8888
}
8989
}
9090

91+
let rustc_has_profiler_support = env::var_os("RUSTC_PROFILER_SUPPORT").is_some();
92+
let rustc_has_sanitizer_support = env::var_os("RUSTC_SANITIZER_SUPPORT").is_some();
93+
9194
iter_header(testfile, None, &mut |ln| {
9295
// we should check if any only-<platform> exists and if it exists
9396
// and does not matches the current platform, skip the test
@@ -116,6 +119,16 @@ impl EarlyProps {
116119
config.parse_needs_matching_clang(ln) {
117120
props.ignore = Ignore::Ignore;
118121
}
122+
123+
if !rustc_has_profiler_support &&
124+
config.parse_needs_profiler_support(ln) {
125+
props.ignore = Ignore::Ignore;
126+
}
127+
128+
if !rustc_has_sanitizer_support &&
129+
config.parse_needs_sanitizer_support(ln) {
130+
props.ignore = Ignore::Ignore;
131+
}
119132
}
120133

121134
if (config.mode == common::DebugInfoGdb || config.mode == common::DebugInfoBoth) &&
@@ -748,6 +761,14 @@ impl Config {
748761
self.parse_name_directive(line, "needs-matching-clang")
749762
}
750763

764+
fn parse_needs_profiler_support(&self, line: &str) -> bool {
765+
self.parse_name_directive(line, "needs-profiler-support")
766+
}
767+
768+
fn parse_needs_sanitizer_support(&self, line: &str) -> bool {
769+
self.parse_name_directive(line, "needs-sanitizer-support")
770+
}
771+
751772
/// Parses a name-value directive which contains config-specific information, e.g., `ignore-x86`
752773
/// or `normalize-stderr-32bit`.
753774
fn parse_cfg_name_directive(&self, line: &str, prefix: &str) -> ParsedNameDirective {

0 commit comments

Comments
 (0)