Skip to content

Commit

Permalink
compiletest: Allow for tests requiring profiler-rt or sanitizer-rt su…
Browse files Browse the repository at this point in the history
…pport.
  • Loading branch information
michaelwoerister committed Apr 18, 2019
1 parent 4269be3 commit 227be65
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/tools/compiletest/src/header.rs
Expand Up @@ -88,6 +88,9 @@ impl EarlyProps {
}
}

let rustc_has_profiler_support = env::var_os("RUSTC_PROFILER_SUPPORT").is_some();
let rustc_has_sanitizer_support = env::var_os("RUSTC_SANITIZER_SUPPORT").is_some();

iter_header(testfile, None, &mut |ln| {
// we should check if any only-<platform> exists and if it exists
// and does not matches the current platform, skip the test
Expand Down Expand Up @@ -116,6 +119,16 @@ impl EarlyProps {
config.parse_needs_matching_clang(ln) {
props.ignore = Ignore::Ignore;
}

if !rustc_has_profiler_support &&
config.parse_needs_profiler_support(ln) {
props.ignore = Ignore::Ignore;
}

if !rustc_has_sanitizer_support &&
config.parse_needs_sanitizer_support(ln) {
props.ignore = Ignore::Ignore;
}
}

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

fn parse_needs_profiler_support(&self, line: &str) -> bool {
self.parse_name_directive(line, "needs-profiler-support")
}

fn parse_needs_sanitizer_support(&self, line: &str) -> bool {
self.parse_name_directive(line, "needs-sanitizer-support")
}

/// Parses a name-value directive which contains config-specific information, e.g., `ignore-x86`
/// or `normalize-stderr-32bit`.
fn parse_cfg_name_directive(&self, line: &str, prefix: &str) -> ParsedNameDirective {
Expand Down

0 comments on commit 227be65

Please sign in to comment.