]> git.lizzy.rs Git - rust.git/commitdiff
Support regexes in custom normalization in UI tests
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Sun, 10 Dec 2017 23:08:34 +0000 (02:08 +0300)
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Thu, 14 Dec 2017 20:26:40 +0000 (23:26 +0300)
21 files changed:
src/Cargo.lock
src/test/ui/changing-crates.rs
src/test/ui/changing-crates.stderr
src/test/ui/svh-change-lit.rs
src/test/ui/svh-change-lit.stderr
src/test/ui/svh-change-significant-cfg.rs
src/test/ui/svh-change-significant-cfg.stderr
src/test/ui/svh-change-trait-bound.rs
src/test/ui/svh-change-trait-bound.stderr
src/test/ui/svh-change-type-arg.rs
src/test/ui/svh-change-type-arg.stderr
src/test/ui/svh-change-type-ret.rs
src/test/ui/svh-change-type-ret.stderr
src/test/ui/svh-change-type-static.rs
src/test/ui/svh-change-type-static.stderr
src/test/ui/svh-use-trait.rs
src/test/ui/svh-use-trait.stderr
src/test/ui/transmute/main.rs
src/tools/compiletest/Cargo.toml
src/tools/compiletest/src/main.rs
src/tools/compiletest/src/runtest.rs

index 27e7438ddfd2602bf9a1de72a564bcc85ac536cf..00f556bf0b28f72643a5fb274ea591d3c0eb38bb 100644 (file)
@@ -375,6 +375,7 @@ dependencies = [
  "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
  "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
index 80a2998f3cddfd5f34c5308cb289a5095e15fbd5..5963a58a2d2f9fc2752a9195ca8b85b3780baec6 100644 (file)
@@ -14,6 +14,7 @@
 // aux-build:changing-crates-a1.rs
 // aux-build:changing-crates-b.rs
 // aux-build:changing-crates-a2.rs
+// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2"
 
 extern crate a;
 extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on
index e6c054183cbf4fa46fc2be1395d834f95231dbd7..50287fa3fde9f69bbdd178a4201d4a89a92b6408 100644 (file)
@@ -1,13 +1,13 @@
 error[E0460]: found possibly newer version of crate `a` which `b` depends on
-  --> $DIR/changing-crates.rs:19:1
+  --> $DIR/changing-crates.rs:20:1
    |
-19 | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on
+20 | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on
    | ^^^^^^^^^^^^^^^
    |
    = note: perhaps that crate needs to be recompiled?
    = note: the following crate versions were found:
-           crate `a`: /?/C:/msys64/home/we/rust/build/x86_64-pc-windows-gnu/test/ui/changing-crates.stage1-x86_64-pc-windows-gnu.aux/a.dll
-           crate `b`: /?/C:/msys64/home/we/rust/build/x86_64-pc-windows-gnu/test/ui/changing-crates.stage1-x86_64-pc-windows-gnu.aux/b.dll
+           crate `a`: $PATH_a
+           crate `b`: $PATH_b
 
 error: aborting due to previous error
 
index a4262eaff195b6ab1b21f08c1010796728586a85..c529873e732849a69d061f3f4641983b7d67284f 100644 (file)
@@ -14,6 +14,7 @@
 // aux-build:svh-a-base.rs
 // aux-build:svh-b.rs
 // aux-build:svh-a-change-lit.rs
+// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2"
 
 extern crate a;
 extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on
index 08c4809479eae3a25aa3b9c2f9ce8fd2f142e329..94e845c527c6a475789bbd67119a8b24d42ae631 100644 (file)
@@ -1,13 +1,13 @@
 error[E0460]: found possibly newer version of crate `a` which `b` depends on
-  --> $DIR/svh-change-lit.rs:19:1
+  --> $DIR/svh-change-lit.rs:20:1
    |
-19 | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on
+20 | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on
    | ^^^^^^^^^^^^^^^
    |
    = note: perhaps that crate needs to be recompiled?
    = note: the following crate versions were found:
-           crate `a`: /?/C:/msys64/home/we/rust/build/x86_64-pc-windows-gnu/test/ui/svh-change-lit.stage1-x86_64-pc-windows-gnu.aux/a.dll
-           crate `b`: /?/C:/msys64/home/we/rust/build/x86_64-pc-windows-gnu/test/ui/svh-change-lit.stage1-x86_64-pc-windows-gnu.aux/b.dll
+           crate `a`: $PATH_a
+           crate `b`: $PATH_b
 
 error: aborting due to previous error
 
index 32ec626036235688a3748e44eb75e5d1471290dd..ad51cbc5ec831bc758082cf1a6a8f72b29e0d58b 100644 (file)
@@ -14,6 +14,7 @@
 // aux-build:svh-a-base.rs
 // aux-build:svh-b.rs
 // aux-build:svh-a-change-significant-cfg.rs
+// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2"
 
 extern crate a;
 extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on
index 57c636d4aa5f0927f43e9efe4f3ed7a09a29a47e..d2744771ec7a33b18930741f7a0f32542a48d548 100644 (file)
@@ -1,13 +1,13 @@
 error[E0460]: found possibly newer version of crate `a` which `b` depends on
-  --> $DIR/svh-change-significant-cfg.rs:19:1
+  --> $DIR/svh-change-significant-cfg.rs:20:1
    |
-19 | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on
+20 | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on
    | ^^^^^^^^^^^^^^^
    |
    = note: perhaps that crate needs to be recompiled?
    = note: the following crate versions were found:
-           crate `a`: /?/C:/msys64/home/we/rust/build/x86_64-pc-windows-gnu/test/ui/svh-change-significant-cfg.stage1-x86_64-pc-windows-gnu.aux/a.dll
-           crate `b`: /?/C:/msys64/home/we/rust/build/x86_64-pc-windows-gnu/test/ui/svh-change-significant-cfg.stage1-x86_64-pc-windows-gnu.aux/b.dll
+           crate `a`: $PATH_a
+           crate `b`: $PATH_b
 
 error: aborting due to previous error
 
index 0069d930a2de551394c2bad84cff5d46e8d7f61b..ae17ff3feb79de8f5ffc7500ee0554ea383d4c8e 100644 (file)
@@ -14,6 +14,7 @@
 // aux-build:svh-a-base.rs
 // aux-build:svh-b.rs
 // aux-build:svh-a-change-trait-bound.rs
+// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2"
 
 extern crate a;
 extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on
index 40fb5aeaf148c6375acd905a4eeaafd598ce2b2f..e272f399f797f11440b40ac20d64b387f3f4b8ae 100644 (file)
@@ -1,13 +1,13 @@
 error[E0460]: found possibly newer version of crate `a` which `b` depends on
-  --> $DIR/svh-change-trait-bound.rs:19:1
+  --> $DIR/svh-change-trait-bound.rs:20:1
    |
-19 | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on
+20 | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on
    | ^^^^^^^^^^^^^^^
    |
    = note: perhaps that crate needs to be recompiled?
    = note: the following crate versions were found:
-           crate `a`: /?/C:/msys64/home/we/rust/build/x86_64-pc-windows-gnu/test/ui/svh-change-trait-bound.stage1-x86_64-pc-windows-gnu.aux/a.dll
-           crate `b`: /?/C:/msys64/home/we/rust/build/x86_64-pc-windows-gnu/test/ui/svh-change-trait-bound.stage1-x86_64-pc-windows-gnu.aux/b.dll
+           crate `a`: $PATH_a
+           crate `b`: $PATH_b
 
 error: aborting due to previous error
 
index e6685eb52601b38941f7052ffd097e2a30892a61..5b796a3f5c0bf5eff00ce8fcfb4f45c2b4204bf6 100644 (file)
@@ -14,6 +14,7 @@
 // aux-build:svh-a-base.rs
 // aux-build:svh-b.rs
 // aux-build:svh-a-change-type-arg.rs
+// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2"
 
 extern crate a;
 extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on
index 654d73d708565aaa5831106e451d4125d98abeaf..d94dd5e522e1d5ee5bdab9194396d3570d7625ca 100644 (file)
@@ -1,13 +1,13 @@
 error[E0460]: found possibly newer version of crate `a` which `b` depends on
-  --> $DIR/svh-change-type-arg.rs:19:1
+  --> $DIR/svh-change-type-arg.rs:20:1
    |
-19 | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on
+20 | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on
    | ^^^^^^^^^^^^^^^
    |
    = note: perhaps that crate needs to be recompiled?
    = note: the following crate versions were found:
-           crate `a`: /?/C:/msys64/home/we/rust/build/x86_64-pc-windows-gnu/test/ui/svh-change-type-arg.stage1-x86_64-pc-windows-gnu.aux/a.dll
-           crate `b`: /?/C:/msys64/home/we/rust/build/x86_64-pc-windows-gnu/test/ui/svh-change-type-arg.stage1-x86_64-pc-windows-gnu.aux/b.dll
+           crate `a`: $PATH_a
+           crate `b`: $PATH_b
 
 error: aborting due to previous error
 
index e5f833b9652c0a18a712e42c318ebb3d83e3aa92..88bf146760f9b3f1fc3641f2b4b7d42618ff3539 100644 (file)
@@ -14,6 +14,7 @@
 // aux-build:svh-a-base.rs
 // aux-build:svh-b.rs
 // aux-build:svh-a-change-type-ret.rs
+// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2"
 
 extern crate a;
 extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on
index c71c0288d8f402f17578e78a456fabad48252f76..4484faabbf45b5611f030ef5975e4e7e4cdb671c 100644 (file)
@@ -1,13 +1,13 @@
 error[E0460]: found possibly newer version of crate `a` which `b` depends on
-  --> $DIR/svh-change-type-ret.rs:19:1
+  --> $DIR/svh-change-type-ret.rs:20:1
    |
-19 | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on
+20 | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on
    | ^^^^^^^^^^^^^^^
    |
    = note: perhaps that crate needs to be recompiled?
    = note: the following crate versions were found:
-           crate `a`: /?/C:/msys64/home/we/rust/build/x86_64-pc-windows-gnu/test/ui/svh-change-type-ret.stage1-x86_64-pc-windows-gnu.aux/a.dll
-           crate `b`: /?/C:/msys64/home/we/rust/build/x86_64-pc-windows-gnu/test/ui/svh-change-type-ret.stage1-x86_64-pc-windows-gnu.aux/b.dll
+           crate `a`: $PATH_a
+           crate `b`: $PATH_b
 
 error: aborting due to previous error
 
index c374d26298c561876f5639c599acfe13f14c74ae..c9a167c5a02cfde170a0f0047e3293084dda7d9f 100644 (file)
@@ -14,6 +14,7 @@
 // aux-build:svh-a-base.rs
 // aux-build:svh-b.rs
 // aux-build:svh-a-change-type-static.rs
+// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2"
 
 extern crate a;
 extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on
index 05cc02d132303825d47a8196e702dc8c63ec5e46..24c5acbf6f2aa1481a103f3428a4537976e8211f 100644 (file)
@@ -1,13 +1,13 @@
 error[E0460]: found possibly newer version of crate `a` which `b` depends on
-  --> $DIR/svh-change-type-static.rs:19:1
+  --> $DIR/svh-change-type-static.rs:20:1
    |
-19 | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on
+20 | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on
    | ^^^^^^^^^^^^^^^
    |
    = note: perhaps that crate needs to be recompiled?
    = note: the following crate versions were found:
-           crate `a`: /?/C:/msys64/home/we/rust/build/x86_64-pc-windows-gnu/test/ui/svh-change-type-static.stage1-x86_64-pc-windows-gnu.aux/a.dll
-           crate `b`: /?/C:/msys64/home/we/rust/build/x86_64-pc-windows-gnu/test/ui/svh-change-type-static.stage1-x86_64-pc-windows-gnu.aux/b.dll
+           crate `a`: $PATH_a
+           crate `b`: $PATH_b
 
 error: aborting due to previous error
 
index ff79a7ad6a0efd7be02a47a63539b880f7cebf40..3a87f6bfc77e47bea7f801c09d5d9b70a8ed7a7b 100644 (file)
@@ -14,6 +14,7 @@
 // aux-build:svh-uta-base.rs
 // aux-build:svh-utb.rs
 // aux-build:svh-uta-change-use-trait.rs
+// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2"
 
 //! "compile-fail/svh-uta-trait.rs" is checking that we detect a
 //! change from `use foo::TraitB` to use `foo::TraitB` in the hash
index b12d173b6cbf109e11d4c5c824f2fb6f329f5230..e695d60e2a12725dc71826f0e9f14c74567f167f 100644 (file)
@@ -1,13 +1,13 @@
 error[E0460]: found possibly newer version of crate `uta` which `utb` depends on
-  --> $DIR/svh-use-trait.rs:24:1
+  --> $DIR/svh-use-trait.rs:25:1
    |
-24 | extern crate utb; //~ ERROR: found possibly newer version of crate `uta` which `utb` depends
+25 | extern crate utb; //~ ERROR: found possibly newer version of crate `uta` which `utb` depends
    | ^^^^^^^^^^^^^^^^^
    |
    = note: perhaps that crate needs to be recompiled?
    = note: the following crate versions were found:
-           crate `uta`: /?/C:/msys64/home/we/rust/build/x86_64-pc-windows-gnu/test/ui/svh-use-trait.stage1-x86_64-pc-windows-gnu.aux/uta.dll
-           crate `utb`: /?/C:/msys64/home/we/rust/build/x86_64-pc-windows-gnu/test/ui/svh-use-trait.stage1-x86_64-pc-windows-gnu.aux/utb.dll
+           crate `uta`: $PATH_uta
+           crate `utb`: $PATH_utb
 
 error: aborting due to previous error
 
index ab448de656e67334de347128bf874e8eec51a0c4..285b079cf96c80495a5c27925003ddeff4702bc2 100644 (file)
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// normalize-stderr-32bit: "&str (64 bits)" -> "&str ($STR bits)"
-// normalize-stderr-64bit: "&str (128 bits)" -> "&str ($STR bits)"
+// normalize-stderr-32bit: "&str \(64 bits\)" -> "&str ($$STR bits)"
+// normalize-stderr-64bit: "&str \(128 bits\)" -> "&str ($$STR bits)"
 
 
 
index 6fc9423a4139a47ab6a54ae7cc51ab25d333a3e7..494c57b161fea13e2ef81c4cda67022376086cbe 100644 (file)
@@ -9,6 +9,7 @@ env_logger = { version = "0.4", default-features = false }
 filetime = "0.1"
 getopts = "0.2"
 log = "0.3"
+regex = "0.2"
 rustc-serialize = "0.3"
 
 [target.'cfg(unix)'.dependencies]
index fac3b71f82cc444c5bcdd78312549dea3b047f4e..8546289fdec09c49ea0aa71852fba4e9e23955fb 100644 (file)
@@ -22,6 +22,7 @@
 #[macro_use]
 extern crate log;
 extern crate rustc_serialize;
+extern crate regex;
 extern crate test;
 
 use std::env;
index 74da774c6d55a2809a77157129b0d32599e4a0f2..06e798554167b9637b591b8b5039a8cc9aed99a8 100644 (file)
@@ -20,6 +20,7 @@
 use header::TestProps;
 use test::TestPaths;
 use util::logv;
+use regex::Regex;
 
 use std::collections::HashMap;
 use std::collections::HashSet;
@@ -2677,7 +2678,8 @@ fn normalize_output(&self, output: &str, custom_rules: &[(String, String)]) -> S
               .replace("\r\n", "\n") // normalize for linebreaks on windows
               .replace("\t", "\\t"); // makes tabs visible
         for rule in custom_rules {
-            normalized = normalized.replace(&rule.0, &rule.1);
+            let re = Regex::new(&rule.0).expect("bad regex in custom normalization rule");
+            normalized = re.replace_all(&normalized, &rule.1[..]).into_owned();
         }
         normalized
     }