All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcus Huewe <suse-tux@gmx.de>
To: tytso@mit.edu
Cc: linux-ext4@vger.kernel.org
Subject: [PATCH 1/2] tests: test "mke2fs -E offset=N" filesystem size calculation
Date: Thu, 12 May 2016 18:22:12 +0200	[thread overview]
Message-ID: <20160512162212.GA4627@linux> (raw)

If "mke2fs -E offset=N ..." is called without a specified filesystem size,
the offset should be subtracted from the default filesystem size (see
commit 87d9b2fb). If "mke2fs -E offset=N ..." is called with an
explicitly specified filesystem size, the specified filesystem size
should be used.

Also, call dd with the "iflag=fullblock" option, if it is going to read
from a pipe.

Signed-off-by: Marcus Huewe <suse-tux@gmx.de>
---
 tests/t_mke2fs_offset/script | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/tests/t_mke2fs_offset/script b/tests/t_mke2fs_offset/script
index 97b9bd1..e4bc3c4 100755
--- a/tests/t_mke2fs_offset/script
+++ b/tests/t_mke2fs_offset/script
@@ -1,20 +1,34 @@
 test_description="mke2fs with offset option (-E offset=N)"
 OUT="$test_name.log"
 
-echo "testing mke2fs with -E offset=524288 option" > "$OUT"
-yes a | dd of="$TMPFILE" bs=1k count=2048 2>/dev/null
+echo "testing mke2fs with -E offset=524288 option (no fssize)" > "$OUT"
+yes a | dd of="$TMPFILE" bs=1k count=2048 iflag=fullblock 2>>"$OUT"
+$MKE2FS -F -b 1024 -E offset=524288 "$TMPFILE" >> "$OUT" 2>&1
+# compute crc of the first 512 1k blocks
+crc_first1=`dd if="$TMPFILE" bs=1k count=512 2>/dev/null | $CRCSUM`
+
+echo "testing mke2fs with -E offset=524288 option (explicit fssize)" >> "$OUT"
+yes a | dd of="$TMPFILE" bs=1k count=2048 iflag=fullblock 2>>"$OUT"
 $MKE2FS -F -b 1024 -E offset=524288 "$TMPFILE" 1024 >> "$OUT" 2>&1
 # compute crc of the first and last 512 1k blocks
-crc_first=`dd if="$TMPFILE" bs=1k count=512 2>/dev/null | $CRCSUM`
-crc_last=`dd if="$TMPFILE" bs=1k count=512 skip=1536 2>/dev/null | $CRCSUM`
+crc_first2=`dd if="$TMPFILE" bs=1k count=512 2>/dev/null | $CRCSUM`
+crc_last2=`dd if="$TMPFILE" bs=1k count=512 skip=1536 2>/dev/null | $CRCSUM`
 crc_exp=`yes a | dd bs=1k count=512 2>/dev/null | $CRCSUM`
+# a warning should be only emitted by the first mke2fs call
+warning=`grep -c "offset specified without an explicit file system size." \
+	"$OUT"`
 
-if [ "$crc_first" = "$crc_last" -a "$crc_first" = "$crc_exp" ]; then
+if [ "$warning" -eq 1 -a \
+	 "$crc_first1" = "$crc_first2" -a \
+	 "$crc_first2" = "$crc_last2" -a \
+	 "$crc_first2" = "$crc_exp" ]; then
 	echo "$test_name: $test_description: ok"
 	touch "$test_name.ok"
 else
 	echo "$test_name: $test_description: failed"
-	echo "crc_first: $crc_first" > "$test_name.failed"
-	echo "crc_last: $crc_last" >> "$test_name.failed"
+	echo "warning: $warning" > "$test_name.failed"
+	echo "crc_first1: $crc_first1" >> "$test_name.failed"
+	echo "crc_first2: $crc_first2" >> "$test_name.failed"
+	echo "crc_last2: $crc_last2" >> "$test_name.failed"
 	echo "crc_exp: $crc_exp" >> "$test_name.failed"
 fi
-- 
2.6.3


                 reply	other threads:[~2016-05-12 16:22 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=20160512162212.GA4627@linux \
    --to=suse-tux@gmx.de \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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.