[Top] [All Lists]

[PATCH v2] xfstests: make length of diff output configurable

To: xfs@xxxxxxxxxxx
Subject: [PATCH v2] xfstests: make length of diff output configurable
From: David Sterba <dsterba@xxxxxxx>
Date: Wed, 23 Jan 2013 12:14:33 +0100
Cc: David Sterba <dsterba@xxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20130122214435.GM2498@dastard>
References: <20130122214435.GM2498@dastard>
In commit 11c1d79414e2571 "xfstests: Change the diff output of failed
tests", the diff output of a failed test was hardcoded to 10 lines to
avoid overly long output and user can get the full output by manually
running the diff. However this is not always possible and convenient,
eg. in repeated automated tests where the required information is lost
after the test round finished. Then the caputred logs do not contain
enough informatin for analysis.

Introduce the DIFF_LENGTH env variable to tune the diff size, keeping it
10 as deafult and 0 to disable the limit.

Signed-off-by: David Sterba <dsterba@xxxxxxx>

V1->V2: define DIFF_LENGTH in ./check

 README | 2 ++
 check  | 9 ++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/README b/README
index d81ede9..b70f75d 100644
--- a/README
+++ b/README
@@ -63,6 +63,8 @@ Preparing system for tests (IRIX and Linux):
              - if TEST_LOGDEV and/or TEST_RTDEV, these will always be used.
              - if SCRATCH_LOGDEV and/or SCRATCH_RTDEV, the USE_EXTERNAL
                environment variable set to "yes" will enable their use.
+             - setenv DIFF_LENGTH "number of diff lines to print from a failed 
+               by default 10, set to 0 to print the full diff
         - or add a case to the switch in common.config assigning
           these variables based on the hostname of your test
diff --git a/check b/check
index 75addb5..c20179c 100755
--- a/check
+++ b/check
@@ -30,6 +30,8 @@ notrun=""
 export QA_CHECK_FS=${QA_CHECK_FS:=true}
+# number of diff lines from a failed test, 0 for whole output
 # by default don't output timestamps
@@ -287,7 +289,12 @@ do
                    echo " - output mismatch (see $seq.out.bad)"
                    mv $tmp.out $seq.out.bad
-                   $diff $seq.out $seq.out.bad | head -n 10 | \
+                   $diff $seq.out $seq.out.bad | {
+                       if test "$DIFF_LENGTH" -le 0; then
+                               cat
+                       else
+                               head -n "$DIFF_LENGTH"
+                       fi; } | \
                        sed -e 's/^\(.\)/    \1/'
                    echo "     ..."
                    echo "     (Run '$diff $seq.out $seq.out.bad' to see the" \

<Prev in Thread] Current Thread [Next in Thread>