[PATCH] tests: print better diagnostics for one particular test failure

Jim Meyering jim at meyering.net
Tue Dec 6 10:54:55 UTC 2011


I saw a test failure last week that I was unable to reproduce,
and the logs were not reachable.  With this, the next time it
happens we'll have a clue:

>From 2c38dea9b0b46c124aa35ab528ea284c6377b1e1 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Tue, 6 Dec 2011 11:52:25 +0100
Subject: [PATCH] tests: print better diagnostics for one particular test
 failure

* t/basic: Adjust the diagnostic to print both expected and actual.
---
 t/basic |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/basic b/t/basic
index 9b71eb1..c098dc7 100644
--- a/t/basic
+++ b/t/basic
@@ -253,8 +253,8 @@ for attr in $attr_words; do
   esac

   printf whatever | curl -f -T - $bucket/rsvd_attr/$attr 2> bad_attr.err
-  grep " $exp$" bad_attr.err || { echo got this:; cat bad_attr.err;
-                                  fail_ "expected $exp"; }
+  grep " $exp$" bad_attr.err \
+    || fail_ "expected ...$exp; got this: $(cat bad_attr.err)"
 done

 # Ensure that an attempt to create a bucket with a reserved name fails.
--
1.7.8


More information about the iwhd-devel mailing list