diff options
| author | kennytm <kennytm@gmail.com> | 2018-01-18 01:57:27 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-01-18 01:57:27 +0800 |
| commit | 5e1f442ba1c440b08531d41aebaf4f4bc41c9c8f (patch) | |
| tree | 205c50b066abe141c574befd60dcf0b95f73ad07 | |
| parent | 350109503763c2d96a12a37299295ca5548cce0b (diff) | |
| parent | bd70f0fa66853125797bfa4cdea37b9ca2120159 (diff) | |
| download | rust-5e1f442ba1c440b08531d41aebaf4f4bc41c9c8f.tar.gz rust-5e1f442ba1c440b08531d41aebaf4f4bc41c9c8f.zip | |
Rollup merge of #47487 - Pulkit07:foo, r=kennytm
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 fixes #33581 and fixes #47459.
| -rw-r--r-- | src/tools/compiletest/src/header.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 1f736e33c8b..ff662736bdd 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -41,9 +41,13 @@ impl EarlyProps { 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 props.ignore = props.ignore || config.parse_cfg_name_directive(ln, "ignore") || + (config.has_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 +568,13 @@ impl Config { } } + fn has_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. + line.starts_with(prefix) && line.as_bytes().get(prefix.len()) == Some(&b'-') + } + 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". |
