diff options
| author | Pulkit Goyal <7895pulkit@gmail.com> | 2018-01-16 14:37:05 +0530 |
|---|---|---|
| committer | Pulkit Goyal <7895pulkit@gmail.com> | 2018-01-16 14:37:05 +0530 |
| commit | fd075c6f2144b33385a596b36eece02ed5d8be62 (patch) | |
| tree | 59a9bdeb5c463d143125e6b0986bd7b5af86ba4f | |
| parent | 79a521bb9a8ace1a6663578a4c409906adde620d (diff) | |
| download | rust-fd075c6f2144b33385a596b36eece02ed5d8be62.tar.gz rust-fd075c6f2144b33385a596b36eece02ed5d8be62.zip | |
implement "only-<platforms>" for test headers
This patch implements "only-<platforms>" for tests headers using which one can specify just the platforms on which the test should run rather than listing all the platforms to ignore using "ignore-<platforms>". This is a fix for issues #33581 and #47459.
| -rw-r--r-- | src/tools/compiletest/src/header.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 1f736e33c8b..475991d7b8b 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -44,6 +44,8 @@ impl EarlyProps { props.ignore = props.ignore || config.parse_cfg_name_directive(ln, "ignore") || + (config.parse_cfg_prefix(ln, "only") && + !config.parse_cfg_name_directive(ln, "only")) || ignore_gdb(config, ln) || ignore_lldb(config, ln) || ignore_llvm(config, ln); @@ -564,6 +566,17 @@ impl Config { } } + fn parse_cfg_prefix(&self, line: &str, prefix: &str) -> bool { + // returns whether this line contains this prefix or not. For prefix + // "ignore", returns true if line says "ignore-x86_64", "ignore-arch", + // "ignore-andorid" etc. + if line.starts_with(prefix) && line.as_bytes().get(prefix.len()) == Some(&b'-') { + true + } else { + false + } + } + fn parse_name_directive(&self, line: &str, directive: &str) -> bool { // Ensure the directive is a whole word. Do not match "ignore-x86" when // the line says "ignore-x86_64". |
