All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Tulak <jtulak@redhat.com>
To: fstests@vger.kernel.org
Cc: Jan Tulak <jtulak@redhat.com>
Subject: [PATCH] xfstests: add a flag for direct printing of test output
Date: Thu, 23 Jul 2015 18:45:55 +0200	[thread overview]
Message-ID: <1437669955-18454-1-git-send-email-jtulak@redhat.com> (raw)

Add -d debug dump flag to ./check to directly print a test output
to stdout, instead of just saving it into a file and showing a diff
snippet.

Useful e.g. when writing a new test.

Signed-off-by: Jan Tulak <jtulak@redhat.com>
---
 check | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/check b/check
index a300130..a4ee224 100755
--- a/check
+++ b/check
@@ -37,6 +37,8 @@ randomize=false
 export here=`pwd`
 xfile=""
 
+DUMP_OUTPUT=false
+
 # start the initialisation work now
 iam=check
 
@@ -74,6 +76,7 @@ check options
     -n			show me, do not run tests
     -T			output timestamps
     -r			randomize test order
+    -d			dump test output to stdout
     --large-fs		optimise scratch device for large filesystems
     -s section		run only specified section from config file
 
@@ -237,6 +240,7 @@ while [ $# -gt 0 ]; do
         -r)	randomize=true ;;
 
 	-T)	timestamp=true ;;
+	-d)	DUMP_OUTPUT=true ;;
 
 	--large-fs) export LARGE_SCRATCH_DEV=yes ;;
 	--extra-space=*) export SCRATCH_DEV_EMPTY_SPACE=${r#*=} ;;
@@ -598,8 +602,14 @@ for section in $HOST_OPTIONS_SECTIONS; do
 			# _check_dmesg depends on this log in dmesg
 			touch ${RESULT_DIR}/check_dmesg
 		fi
-		./$seq >$tmp.rawout 2>&1
-		sts=$?
+		if [ "$DUMP_OUTPUT" = true ]; then
+			./$seq 2>&1 | tee $tmp.rawout
+			# Because $? would get tee's return code
+			sts=${PIPESTATUS[0]}
+		else
+			./$seq >$tmp.rawout 2>&1
+			sts=$?
+		fi
 		$timestamp && _timestamp
 		stop=`_wallclock`
 
-- 
2.4.3


                 reply	other threads:[~2015-07-23 16:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1437669955-18454-1-git-send-email-jtulak@redhat.com \
    --to=jtulak@redhat.com \
    --cc=fstests@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.