]> git.lizzy.rs Git - rust.git/commitdiff
colored test output!
authorRalf Jung <post@ralfj.de>
Thu, 12 Jul 2018 09:26:09 +0000 (11:26 +0200)
committerRalf Jung <post@ralfj.de>
Thu, 12 Jul 2018 09:26:09 +0000 (11:26 +0200)
Cargo.toml
tests/compiletest.rs

index 86ac2c040fd1c73e1377da2b0bbd4f3ae93a0d40..d01ce4f5baf8cf524f35992a1ad8142ba48bb9f0 100644 (file)
@@ -31,3 +31,4 @@ cargo_miri = ["cargo_metadata"]
 
 [dev-dependencies]
 compiletest_rs = { version = "0.3.4", features = ["tmp"] }
+colored = "1.6"
index 9a2fd02f88cda73a04e8386f91034dbe2d65bb7a..cfbfa70d42eea9c4e94a90e4a249b708bf339630 100644 (file)
@@ -1,6 +1,9 @@
 #![feature(slice_concat_ext)]
 
 extern crate compiletest_rs as compiletest;
+extern crate colored;
+
+use colored::*;
 
 use std::slice::SliceConcatExt;
 use std::path::{PathBuf, Path};
@@ -37,19 +40,19 @@ fn have_fullmir() -> bool {
 
 fn compile_fail(sysroot: &Path, path: &str, target: &str, host: &str, need_fullmir: bool) {
     if need_fullmir && !have_fullmir() {
-        eprintln!(
+        eprintln!("{}", format!(
             "## Skipping compile-fail tests in {} against miri for target {} due to missing mir",
             path,
             target
-        );
+        ).yellow().bold());
         return;
     }
 
-    eprintln!(
+    eprintln!("{}", format!(
         "## Running compile-fail tests in {} against miri for target {}",
         path,
         target
-    );
+    ).green().bold());
     let mut config = compiletest::Config::default().tempdir();
     config.mode = "compile-fail".parse().expect("Invalid mode");
     config.rustc_path = miri_path();
@@ -68,7 +71,7 @@ fn compile_fail(sysroot: &Path, path: &str, target: &str, host: &str, need_fullm
 }
 
 fn rustc_pass(sysroot: &Path, path: &str) {
-    eprintln!("## Running run-pass tests in {} against rustc", path);
+    eprintln!("{}", format!("## Running run-pass tests in {} against rustc", path).green().bold());
     let mut config = compiletest::Config::default().tempdir();
     config.mode = "run-pass".parse().expect("Invalid mode");
     config.src_base = PathBuf::from(path);
@@ -86,21 +89,21 @@ fn rustc_pass(sysroot: &Path, path: &str) {
 
 fn miri_pass(sysroot: &Path, path: &str, target: &str, host: &str, need_fullmir: bool, opt: bool) {
     if need_fullmir && !have_fullmir() {
-        eprintln!(
+        eprintln!("{}", format!(
             "## Skipping run-pass tests in {} against miri for target {} due to missing mir",
             path,
             target
-        );
+        ).yellow().bold());
         return;
     }
 
     let opt_str = if opt { " with optimizations" } else { "" };
-    eprintln!(
+    eprintln!("{}", format!(
         "## Running run-pass tests in {} against miri for target {}{}",
         path,
         target,
         opt_str
-    );
+    ).green().bold());
     let mut config = compiletest::Config::default().tempdir();
     config.mode = "ui".parse().expect("Invalid mode");
     config.src_base = PathBuf::from(path);