chiark / gitweb /
jstest: Improve debugging
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 10 Jul 2021 12:17:24 +0000 (13:17 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 10 Jul 2021 12:18:40 +0000 (13:18 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
jstest/jst-lower.rs
jstest/run1

index c4dbd8e67e3f7fb2c09392cba8d70f7ca9d8905f..c5ffcf8430517e788b770d8f9ca721cf14f3d97e 100644 (file)
@@ -61,7 +61,7 @@ pub struct TestsAccumulator {
 impl Test {
   #[throws(Explode)]
   pub fn check(&self) {
-    eprintln!("-------------------- {} --------------------", &self.name);
+    println!("-------------------- {} --------------------", &self.name);
 
     let mut updated: HashMap<Vpid, ZCoord>
       = default();
@@ -109,16 +109,16 @@ impl Test {
     let new = sorted(&|p: &PieceCollated| p.new_z);
     for (o, n) in izip!(&old, &new).rev() {
       let pr = |p: &PieceCollated| {
-        eprint!("    {:5} {}{}{} ",
+        print!("    {:5} {}{}{} ",
                 p.id.to_string(),
                 if p.target  { "T" } else { "_" },
                 if p.bottom  { "B" } else { "_" },
                 if p.updated { "U" } else { "_" });
       };
       pr(o);
-      eprint!("{:<20}    ", o.old_z.as_str());
+      print!("{:<20}    ", o.old_z.as_str());
       pr(n);
-      eprintln!("{}"        , n.new_z.as_str());
+      println!("{}"        , n.new_z.as_str());
     }
 
     // non-bottom targets are in same stacking order as before
@@ -266,9 +266,9 @@ impl TestsAccumulator {
       |s| s.try_into().map_err(|_|s).unwrap()
     ).collect();
 
-    eprintln!("-------------------- {} --------------------", name);
+    println!("-------------------- {} --------------------", name);
     for (id,p) in pieces.iter() {
-      eprintln!("    {:5} {}{}  {}",
+      println!("    {:5} {}{}  {}",
                 id.to_string(),
                 if targets.contains(id) { "T" } else { "_" },
                 if p.bottom()           { "B" } else { "_" },
@@ -303,7 +303,7 @@ impl Tests {
 fn main() {
   let opts = Opts::from_args();
 
-  eprintln!("==================== building ====================");
+  println!("==================== building ====================");
 
   let mut ta = TestsAccumulator::new(&opts)?;
 
@@ -339,14 +339,14 @@ fn main() {
   
   let tests = ta.finalise()?;
 
-  eprintln!("==================== running ====================");
+  println!("==================== running ====================");
 
   let mut cmd = Command::new(opts.nodejs);
   cmd.arg(opts.script);
   let status = cmd.status()?;
   assert!(status.success(), "{}", status);
 
-  eprintln!("==================== checking ====================");
+  println!("==================== checking ====================");
 
   for test in tests.tests.values() {
     test.check()?;
index c30fb92b81d1b51f2bffc64997121039896aa477..ca7ac6f659a263daa1afa571b3479609c744f691 100755 (executable)
@@ -47,8 +47,8 @@ $wrap nodejs run.js >output
 rc=$?
 set -e
 
-if [ $rc != 0 ]; then
-       egrep '' /dev/null output ||:
+if [ $rc != 0 ] || [ "$OTTER_JST_VERBOSE" ]; then
+       cat output ||:
 fi
 
 if test -f expect; then