From patchwork Wed May 2 04:25:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Dilger X-Patchwork-Id: 907290 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=dilger.ca Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40bQR96NdQz9s2k for ; Wed, 2 May 2018 14:34:29 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750965AbeEBEe2 (ORCPT ); Wed, 2 May 2018 00:34:28 -0400 Received: from smtp-out-so.shaw.ca ([64.59.136.137]:39492 "EHLO smtp-out-so.shaw.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750742AbeEBEe1 (ORCPT ); Wed, 2 May 2018 00:34:27 -0400 X-Greylist: delayed 487 seconds by postgrey-1.27 at vger.kernel.org; Wed, 02 May 2018 00:34:27 EDT Received: from cabot.adilger.int ([70.77.216.213]) by shaw.ca with ESMTP id DjLNfiF7x5wO5DjLPfV9Km; Tue, 01 May 2018 22:26:20 -0600 X-Authority-Analysis: v=2.3 cv=SJtsqtnH c=1 sm=1 tr=0 a=BQvS1EmAg2ttxjPVUuc1UQ==:117 a=BQvS1EmAg2ttxjPVUuc1UQ==:17 a=RPJ6JBhKAAAA:8 a=y8QtviyOAaWme89BWRMA:9 a=fa_un-3J20JGBB2Tu-mn:22 From: Andreas Dilger To: tytso@mit.edu Cc: linux-ext4@vger.kernel.org, Andreas Dilger Subject: [PATCH 01/10] tests: don't use a sparse test file Date: Tue, 1 May 2018 22:25:57 -0600 Message-Id: <1525235166-6448-2-git-send-email-adilger@dilger.ca> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1525235166-6448-1-git-send-email-adilger@dilger.ca> References: <1525235166-6448-1-git-send-email-adilger@dilger.ca> X-CMAE-Envelope: MS4wfMqFQUsF33+NSTi58MayhAd8HrQ9CXvSURLyYLdVMqqWypf2vnfHqEFdUxh20wfd3Nl3ZzOsryuwenMpsEh3If7baxGICh1x7Q5uXYRhP3SRWUPpD0Ln tEpyymTPHR1fvu2iU991JLSoTRINlND5jY2sXOlJvdI1DxGa4jQcfma+GjhHFVQ1Squ4CgJkce756Om7Jj529418fCUqTWjMm+j6s5iha91jja4AuUh9HWeY Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org If the TEST_BITS file is sparse, then the "debugfs -R write" command may skip holes in the file when copying it into the test image (depending on whether SEEK_HOLE/SEEK_DATA and/or FIEMAP are available in the copy_file() function). This was causing test failures on MacOS in the f_dup_resize and d_loaddump tests because the TEST_BITS file was the compiled "debugfs" binary, which apparently has holes when built on MacOS, and the number of blocks allocated in the test image was reduced as a result. This caused the expect output to differ in the summary line and resulted in failure. Instead of using the debugfs binary for TEST_BITS, generate a temporary file using /dev/urandom, if available. If not, fall back to the old behaviour or using debugfs. Signed-off-by: Andreas Dilger --- tests/test_config | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/test_config b/tests/test_config index c13aa74..cf9c79c 100644 --- a/tests/test_config +++ b/tests/test_config @@ -13,7 +13,14 @@ E2IMAGE="$USE_VALGRIND ../misc/e2image" E2IMAGE_EXE="../misc/e2image" DEBUGFS="$USE_VALGRIND ../debugfs/debugfs" DEBUGFS_EXE="../debugfs/debugfs" -TEST_BITS="../debugfs/debugfs" +TEST_BITS="test_data.tmp" +if [ ! -s $TEST_BITS ]; then + # create a non-sparse test file if possible, since debugfs may be + # sparse and cause "debugfs write" (using copy_file()) to skip holes + # during testing if SEEK_DATA/SEEK_HOLE or FS_IOC_FIEMAP are available + dd if=/dev/urandom of=$TEST_BITS bs=128k count=1 > /dev/null 2&>1 || + TEST_BITS="$DEFBUGFS_EXE" +fi RESIZE2FS_EXE="../resize/resize2fs" RESIZE2FS="$USE_VALGRIND $RESIZE2FS_EXE" E2UNDO_EXE="../misc/e2undo" From patchwork Wed May 2 04:25:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Dilger X-Patchwork-Id: 907291 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=dilger.ca Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40bQRC5pBkz9s37 for ; Wed, 2 May 2018 14:34:31 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751029AbeEBEe3 (ORCPT ); Wed, 2 May 2018 00:34:29 -0400 Received: from smtp-out-so.shaw.ca ([64.59.136.138]:39490 "EHLO smtp-out-so.shaw.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750849AbeEBEe1 (ORCPT ); Wed, 2 May 2018 00:34:27 -0400 Received: from cabot.adilger.int ([70.77.216.213]) by shaw.ca with ESMTP id DjLNfiF7x5wO5DjLQfV9Kq; Tue, 01 May 2018 22:26:20 -0600 X-Authority-Analysis: v=2.3 cv=SJtsqtnH c=1 sm=1 tr=0 a=BQvS1EmAg2ttxjPVUuc1UQ==:117 a=BQvS1EmAg2ttxjPVUuc1UQ==:17 a=RPJ6JBhKAAAA:8 a=jroqaK-RVxO9FaG9JDUA:9 a=fa_un-3J20JGBB2Tu-mn:22 From: Andreas Dilger To: tytso@mit.edu Cc: linux-ext4@vger.kernel.org, Andreas Dilger Subject: [PATCH 02/10] tests: don't unlink test image if SKIP_UNLINK set Date: Tue, 1 May 2018 22:25:58 -0600 Message-Id: <1525235166-6448-3-git-send-email-adilger@dilger.ca> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1525235166-6448-2-git-send-email-adilger@dilger.ca> References: <1525235166-6448-1-git-send-email-adilger@dilger.ca> <1525235166-6448-2-git-send-email-adilger@dilger.ca> X-CMAE-Envelope: MS4wfMqFQUsF33+NSTi58MayhAd8HrQ9CXvSURLyYLdVMqqWypf2vnfHqEFdUxh20wfd3Nl3ZzOsryuwenMpsEh3If7baxGICh1x7Q5uXYRhP3SRWUPpD0Ln tEpyymTPHR1fvu2iU991JLSoTRINlND5jY2sXOlJvdI1DxGa4jQcfma+GjhHFVQ1Squ4CgJkce756Om7Jj529418fCUqTWjMm+j6s5iha91jja4AuUh9HWeY Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Don't register a trap to unlink $TMPFILE at the test exit if SKIP_UNLINK is set. Otherwise, this makes it difficult to debug a failing test. Signed-off-by: Andreas Dilger --- tests/test_one.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_one.in b/tests/test_one.in index c1f18dc..664cf86 100644 --- a/tests/test_one.in +++ b/tests/test_one.in @@ -61,7 +61,7 @@ rm -f $test_name.ok $test_name.failed #echo -e -n "$test_name: $test_description:\r" TMPFILE=$(mktemp ${TMPDIR:-/tmp}/e2fsprogs-tmp-$test_name.XXXXXX) -trap 'rm -f $TMPFILE ; exit' 1 2 15 +[ "$SKIP_UNLINK" != "true" ] && trap 'rm -f $TMPFILE ; exit' 1 2 15 start=$SECONDS if [ -f $test_dir/script ]; then From patchwork Wed May 2 04:25:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Dilger X-Patchwork-Id: 907294 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=dilger.ca Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40bQRJ2xrGz9s37 for ; Wed, 2 May 2018 14:34:36 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751094AbeEBEef (ORCPT ); Wed, 2 May 2018 00:34:35 -0400 Received: from smtp-out-so.shaw.ca ([64.59.136.138]:39490 "EHLO smtp-out-so.shaw.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751007AbeEBEe3 (ORCPT ); Wed, 2 May 2018 00:34:29 -0400 Received: from cabot.adilger.int ([70.77.216.213]) by shaw.ca with ESMTP id DjLNfiF7x5wO5DjLQfV9Kz; Tue, 01 May 2018 22:26:21 -0600 X-Authority-Analysis: v=2.3 cv=SJtsqtnH c=1 sm=1 tr=0 a=BQvS1EmAg2ttxjPVUuc1UQ==:117 a=BQvS1EmAg2ttxjPVUuc1UQ==:17 a=RPJ6JBhKAAAA:8 a=jE2HsrK4WpJZ4QX-62kA:9 a=E-F_R4GQO5qPcxCJ:21 a=fa_un-3J20JGBB2Tu-mn:22 From: Andreas Dilger To: tytso@mit.edu Cc: linux-ext4@vger.kernel.org, Andreas Dilger Subject: [PATCH 03/10] tests: clean up $DEBUGFS_EXE usage in scripts Date: Tue, 1 May 2018 22:25:59 -0600 Message-Id: <1525235166-6448-4-git-send-email-adilger@dilger.ca> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1525235166-6448-3-git-send-email-adilger@dilger.ca> References: <1525235166-6448-1-git-send-email-adilger@dilger.ca> <1525235166-6448-2-git-send-email-adilger@dilger.ca> <1525235166-6448-3-git-send-email-adilger@dilger.ca> X-CMAE-Envelope: MS4wfMxKMJ75dBqI86Sec0SKsHTIq22iODqv0EEonfqWjj8T9LIG1IUvVW1A5u++PUUma9jv0P2fwvxgzIvIFduDgurKbMRPqZx1rlnO4J9gJFhk4yiqyuUX 4XNSekB+AFZPUNBkrbe/y85Xg+kodIbCUFMxVHX21nhdywdZeIVUvk9r72wCtLA93ZaXbsZ1mPhQXWM7y6oOYX6GZbSVS/Q3pdbAiQDp8VUGLfYKF+4x1Cb+ Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Instead of putting the entire test script under an implicit "if test -x $DEBUGFS_EXE" conditional (sometimes indenting the code, and sometimes not), rather check for the reverse and exit the test script early if $DEBUGFS_EXE is missing. In some places, tests were running $DEBUGFS_EXE directly, when they should be running $DEBUGFS (which will run with Fortify, or other options). Signed-off-by: Andreas Dilger --- tests/d_dumpe2fs_group_only/script | 9 ++-- tests/d_fallocate/script | 13 +++-- tests/d_fallocate_bigalloc/script | 13 +++-- tests/d_fallocate_blkmap/script | 13 +++-- tests/d_inline_dump/script | 59 +++++++++++----------- tests/d_loaddump/script | 15 +++--- tests/d_punch/script | 13 +++-- tests/d_punch_bigalloc/script | 13 +++-- tests/d_special_files/script | 9 ++-- tests/d_xattr_edits/script | 9 ++-- tests/d_xattr_sorting/script | 9 ++-- tests/f_badcluster/script | 47 ++++++++--------- tests/f_bigalloc_badinode/script | 9 ++-- tests/f_bigalloc_orphan_list/script | 9 ++-- tests/f_create_symlinks/script | 9 ++-- tests/f_desc_size_bad/script | 2 +- tests/f_detect_junk/script | 10 ++-- tests/f_detect_xfs/script | 2 +- tests/f_dup4/script | 9 ++-- tests/f_dup_de/script | 9 ++-- tests/f_dup_resize/script | 9 ++-- tests/f_extent_oobounds/script | 9 ++-- tests/f_imagic_fs/script | 9 ++-- tests/f_resize_inode/script | 11 ++-- tests/f_uninit_cat/script | 10 ++-- tests/f_uninit_last_uninit/script | 9 ++-- tests/j_corrupt_commit_csum/script | 11 ++-- tests/j_corrupt_commit_tid/script | 11 ++-- tests/j_corrupt_descr_csum/script | 11 ++-- tests/j_corrupt_descr_tid/script | 11 ++-- tests/j_corrupt_journal_block/script | 11 ++-- tests/j_corrupt_revoke_block/script | 11 ++-- tests/j_corrupt_revoke_csum/script | 11 ++-- tests/j_corrupt_sb_csum/script | 11 ++-- tests/j_corrupt_sb_magic/script | 11 ++-- tests/j_ext_long_revoke_trans/script | 13 +++-- tests/j_ext_long_trans/script | 13 +++-- tests/j_long_revoke_trans/script | 13 +++-- tests/j_long_revoke_trans_mcsum_32bit/script | 15 +++--- tests/j_long_revoke_trans_mcsum_64bit/script | 15 +++--- tests/j_long_trans/script | 13 +++-- tests/j_long_trans_mcsum_32bit/script | 13 +++-- tests/j_long_trans_mcsum_64bit/script | 13 +++-- tests/j_short_revoke_trans/script | 13 +++-- tests/j_short_revoke_trans_mcsum_64bit/script | 13 +++-- tests/j_short_trans/script | 13 +++-- tests/j_short_trans_64bit/script | 13 +++-- tests/j_short_trans_mcsum_64bit/script | 13 +++-- tests/j_short_trans_old_csum/script | 13 +++-- tests/j_short_trans_open_recover/script | 15 +++--- tests/j_short_trans_recover/script | 15 +++--- tests/j_short_trans_recover_mcsum_64bit/script | 15 +++--- tests/j_short_uncommitted_trans/script | 13 +++-- tests/j_short_uncommitted_trans_mcsum_64bit/script | 13 +++-- tests/m_devdir/script | 11 ++-- tests/m_minrootdir/script | 11 ++-- tests/m_rootdir/script | 11 ++-- tests/r_1024_small_bg/script | 11 ++-- tests/r_32to64bit/script | 10 ++-- tests/r_32to64bit_expand_full/script | 10 ++-- tests/r_32to64bit_meta/script | 10 ++-- tests/r_32to64bit_move_itable/script | 10 ++-- tests/r_64bit_big_expand/script | 12 ++--- tests/r_64to32bit/script | 10 ++-- tests/r_64to32bit_meta/script | 10 ++-- tests/r_bigalloc_big_expand/script | 12 ++--- tests/r_expand_full/script | 10 ++-- tests/r_ext4_big_expand/script | 12 ++--- tests/r_ext4_small_bg/script | 12 ++--- tests/r_fixup_lastbg/script | 9 ++-- tests/r_fixup_lastbg_big/script | 9 ++-- tests/r_inline_xattr/script | 10 ++-- tests/r_meta_bg_shrink/script | 12 ++--- tests/r_min_itable/script | 10 ++-- tests/r_move_itable/script | 9 ++-- tests/r_move_itable_nostride/script | 9 ++-- tests/r_move_itable_realloc/script | 9 ++-- tests/run_mke2fs | 2 +- tests/t_iexpand_full/script | 10 ++-- tests/t_iexpand_mcsum/script | 11 ++-- tests/t_replay_and_set/script | 11 ++-- tests/u_debugfs_opt/script | 6 ++- 82 files changed, 445 insertions(+), 528 deletions(-) diff --git a/tests/d_dumpe2fs_group_only/script b/tests/d_dumpe2fs_group_only/script index 50481f0..c3ab7e2 100644 --- a/tests/d_dumpe2fs_group_only/script +++ b/tests/d_dumpe2fs_group_only/script @@ -4,7 +4,10 @@ if [ $(uname -s) = "Darwin" ]; then return 0 fi -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi FSCK_OPT=-fy OUT=$test_name.log @@ -43,7 +46,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/d_fallocate/script b/tests/d_fallocate/script index b3982a3..b41eaaf 100644 --- a/tests/d_fallocate/script +++ b/tests/d_fallocate/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi FSCK_OPT=-fy OUT=$test_name.log @@ -143,8 +146,8 @@ sif /k size 9216000 ENDL echo "ex /k" >> $TMPFILE.cmd2 -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE > /dev/null 2>&1 -$DEBUGFS_EXE -f $TMPFILE.cmd2 $TMPFILE >> $OUT.new 2>&1 +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE > /dev/null 2>&1 +$DEBUGFS -f $TMPFILE.cmd2 $TMPFILE >> $OUT.new 2>&1 sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT rm -rf $OUT.new $TMPFILE.cmd $TMPFILE.cmd2 @@ -169,7 +172,3 @@ fi rm -f $EXP unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/d_fallocate_bigalloc/script b/tests/d_fallocate_bigalloc/script index 9022a2b..9c8fde8 100644 --- a/tests/d_fallocate_bigalloc/script +++ b/tests/d_fallocate_bigalloc/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi FSCK_OPT=-fy OUT=$test_name.log @@ -144,8 +147,8 @@ sif /k size 9216000 ENDL echo "ex /k" >> $TMPFILE.cmd2 -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE > /dev/null 2>&1 -$DEBUGFS_EXE -f $TMPFILE.cmd2 $TMPFILE >> $OUT.new 2>&1 +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE > /dev/null 2>&1 +$DEBUGFS -f $TMPFILE.cmd2 $TMPFILE >> $OUT.new 2>&1 sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT rm -rf $OUT.new $TMPFILE.cmd $TMPFILE.cmd2 @@ -170,7 +173,3 @@ fi rm -f $EXP unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/d_fallocate_blkmap/script b/tests/d_fallocate_blkmap/script index 9c48cbc..86d1dee 100644 --- a/tests/d_fallocate_blkmap/script +++ b/tests/d_fallocate_blkmap/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi FSCK_OPT=-fy OUT=$test_name.log @@ -53,8 +56,8 @@ ENDL echo "stat /a" >> $TMPFILE.cmd2 echo "stat /b" >> $TMPFILE.cmd2 -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE > /dev/null 2>&1 -$DEBUGFS_EXE -f $TMPFILE.cmd2 $TMPFILE >> $OUT.new 2>&1 +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE > /dev/null 2>&1 +$DEBUGFS -f $TMPFILE.cmd2 $TMPFILE >> $OUT.new 2>&1 sed -f $cmd_dir/filter.sed -e '/^.*time:.*$/d' < $OUT.new >> $OUT rm -rf $OUT.new $TMPFILE.cmd $TMPFILE.cmd2 @@ -79,7 +82,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/d_inline_dump/script b/tests/d_inline_dump/script index 6df34b6..3193f78 100644 --- a/tests/d_inline_dump/script +++ b/tests/d_inline_dump/script @@ -1,42 +1,43 @@ if ! test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -else - OUT=$test_name.log - EXP=$test_dir/expect - VERIFY_FSCK_OPT=-yf + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi + +OUT=$test_name.log +EXP=$test_dir/expect +VERIFY_FSCK_OPT=-yf - ZIMAGE=$test_dir/image.gz - gzip -d < $ZIMAGE > $TMPFILE +ZIMAGE=$test_dir/image.gz +gzip -d < $ZIMAGE > $TMPFILE - echo "*** long file" > $OUT - $DEBUGFS -R 'stat /file' $TMPFILE 2>&1 | $CLEAN_OUTPUT >> $OUT 2>&1 - echo "*** short file" >> $OUT - $DEBUGFS -R 'stat /shortfile' $TMPFILE 2>&1 | $CLEAN_OUTPUT >> $OUT 2>&1 - echo >> $OUT +echo "*** long file" > $OUT +$DEBUGFS -R 'stat /file' $TMPFILE 2>&1 | $CLEAN_OUTPUT >> $OUT 2>&1 +echo "*** short file" >> $OUT +$DEBUGFS -R 'stat /shortfile' $TMPFILE 2>&1 | $CLEAN_OUTPUT >> $OUT 2>&1 +echo >> $OUT - echo "*** long dir" >> $OUT - $DEBUGFS -R 'stat /dir' $TMPFILE 2>&1 | $CLEAN_OUTPUT >> $OUT 2>&1 - echo "*** short dir" >> $OUT - $DEBUGFS -R 'stat /shortdir' $TMPFILE 2>&1 | $CLEAN_OUTPUT >> $OUT 2>&1 - echo >> $OUT +echo "*** long dir" >> $OUT +$DEBUGFS -R 'stat /dir' $TMPFILE 2>&1 | $CLEAN_OUTPUT >> $OUT 2>&1 +echo "*** short dir" >> $OUT +$DEBUGFS -R 'stat /shortdir' $TMPFILE 2>&1 | $CLEAN_OUTPUT >> $OUT 2>&1 +echo >> $OUT - echo "*** long link" >> $OUT - $DEBUGFS -R 'stat /link' $TMPFILE 2>&1 | $CLEAN_OUTPUT >> $OUT 2>&1 - echo "*** short link" >> $OUT - $DEBUGFS -R 'stat /shortlink' $TMPFILE 2>&1 | $CLEAN_OUTPUT >> $OUT 2>&1 +echo "*** long link" >> $OUT +$DEBUGFS -R 'stat /link' $TMPFILE 2>&1 | $CLEAN_OUTPUT >> $OUT 2>&1 +echo "*** short link" >> $OUT +$DEBUGFS -R 'stat /shortlink' $TMPFILE 2>&1 | $CLEAN_OUTPUT >> $OUT 2>&1 - echo "*** end test" >> $OUT +echo "*** end test" >> $OUT - cmp -s $OUT $EXP - status=$? +cmp -s $OUT $EXP +status=$? - if [ "$status" = 0 ] ; then +if [ "$status" = 0 ] ; then echo "$test_name: $test_description: ok" touch $test_name.ok - else +else echo "$test_name: $test_description: failed" diff $DIFF_OPTS $EXP $OUT > $test_name.failed - fi - - unset VERIFY_FSCK_OPT NATIVE_FSCK_OPT OUT EXP TEST_DATA VERIFY_DATA ZIMAGE fi + +unset VERIFY_FSCK_OPT NATIVE_FSCK_OPT OUT EXP TEST_DATA VERIFY_DATA ZIMAGE diff --git a/tests/d_loaddump/script b/tests/d_loaddump/script index 04723f7..c91a6e9 100644 --- a/tests/d_loaddump/script +++ b/tests/d_loaddump/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi OUT=$test_name.log EXP=$test_dir/expect @@ -47,7 +50,11 @@ echo Exit status is $status >> $OUT # Do the verification # -rm -f $VERIFY_DATA $TEST_DATA $TMPFILE $OUT.new +if [ "$SKIP_UNLINK" != "true" ]; then + rm -f $VERIFY_DATA $TEST_DATA $TMPFILE $OUT.new +else + echo "TMPFILE=$TMPFILE" +fi cmp -s $OUT $EXP status=$? @@ -60,7 +67,3 @@ else fi unset VERIFY_FSCK_OPT NATIVE_FSCK_OPT OUT EXP TEST_DATA VERIFY_DATA - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/d_punch/script b/tests/d_punch/script index 7a77c69..5bb51cd 100644 --- a/tests/d_punch/script +++ b/tests/d_punch/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi FSCK_OPT=-fy OUT=$test_name.log @@ -97,8 +100,8 @@ punch /f 1 8998 ENDL echo "ex /f" >> $TMPFILE.cmd2 -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE > /dev/null 2>&1 -$DEBUGFS_EXE -f $TMPFILE.cmd2 $TMPFILE >> $OUT.new 2>&1 +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE > /dev/null 2>&1 +$DEBUGFS -f $TMPFILE.cmd2 $TMPFILE >> $OUT.new 2>&1 sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT rm -rf $OUT.new $TMPFILE.cmd $TMPFILE.cmd2 @@ -123,7 +126,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/d_punch_bigalloc/script b/tests/d_punch_bigalloc/script index 6eb0571..7d0c7fe 100644 --- a/tests/d_punch_bigalloc/script +++ b/tests/d_punch_bigalloc/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi FSCK_OPT=-fy OUT=$test_name.log @@ -98,8 +101,8 @@ punch /f 1 8998 ENDL echo "ex /f" >> $TMPFILE.cmd2 -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE > /dev/null 2>&1 -$DEBUGFS_EXE -f $TMPFILE.cmd2 $TMPFILE >> $OUT.new 2>&1 +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE > /dev/null 2>&1 +$DEBUGFS -f $TMPFILE.cmd2 $TMPFILE >> $OUT.new 2>&1 sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT rm -rf $OUT.new $TMPFILE.cmd $TMPFILE.cmd2 @@ -124,7 +127,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/d_special_files/script b/tests/d_special_files/script index a8c2858..746d724 100644 --- a/tests/d_special_files/script +++ b/tests/d_special_files/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi OUT=$test_name.log EXP=$test_dir/expect @@ -88,7 +91,3 @@ else fi unset VERIFY_FSCK_OPT NATIVE_FSCK_OPT OUT EXP TEST_DATA VERIFY_DATA - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/d_xattr_edits/script b/tests/d_xattr_edits/script index b6451ee..13550a1 100644 --- a/tests/d_xattr_edits/script +++ b/tests/d_xattr_edits/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi OUT=$test_name.log EXP=$test_dir/expect @@ -135,7 +138,3 @@ else fi unset VERIFY_FSCK_OPT NATIVE_FSCK_OPT OUT EXP TEST_DATA VERIFY_DATA - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/d_xattr_sorting/script b/tests/d_xattr_sorting/script index 9e6e362..a599f3c 100644 --- a/tests/d_xattr_sorting/script +++ b/tests/d_xattr_sorting/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi OUT=$test_name.log EXP=$test_dir/expect @@ -89,7 +92,3 @@ else fi unset VERIFY_FSCK_OPT NATIVE_FSCK_OPT OUT EXP TEST_DATA VERIFY_DATA - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/f_badcluster/script b/tests/f_badcluster/script index ea9e488..0012594 100644 --- a/tests/f_badcluster/script +++ b/tests/f_badcluster/script @@ -1,27 +1,28 @@ -if test -x $DEBUGFS_EXE; then - IMAGE=$test_dir/../f_badcluster/image.gz - OUT=$test_name.log - EXP=$test_dir/expect - gzip -d < $IMAGE > $TMPFILE - $FSCK -fy $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed > $OUT - $FSCK -fy $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT - $FSCK -fy $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT - for i in a b c d e f g; do echo "stat /$i"; done > $TMPFILE.tmp - echo "quit" >> $TMPFILE.tmp - $DEBUGFS_EXE -f $TMPFILE.tmp $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT - rm -f $TMPFILE.tmp +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi + +IMAGE=$test_dir/../f_badcluster/image.gz +OUT=$test_name.log +EXP=$test_dir/expect +gzip -d < $IMAGE > $TMPFILE +$FSCK -fy $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed > $OUT +$FSCK -fy $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +$FSCK -fy $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +for i in a b c d e f g; do echo "stat /$i"; done > $TMPFILE.tmp +echo "quit" >> $TMPFILE.tmp +$DEBUGFS -f $TMPFILE.tmp $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +rm -f $TMPFILE.tmp - cmp -s $OUT $EXP - status=$? +cmp -s $OUT $EXP +status=$? - if [ "$status" = 0 ]; then - echo "$test_name: $test_description: ok" - touch $test_name.ok - else - echo "$test_name: $test_description: failed" - diff $DIFF_OPTS $EXP $OUT > $test_name.failed - rm -f $test_name.tmp - fi +if [ "$status" = 0 ]; then + echo "$test_name: $test_description: ok" + touch $test_name.ok else - echo "$test_name: skipped" + echo "$test_name: $test_description: failed" + diff $DIFF_OPTS $EXP $OUT > $test_name.failed + rm -f $test_name.tmp fi diff --git a/tests/f_bigalloc_badinode/script b/tests/f_bigalloc_badinode/script index e58910f..c1dd454 100644 --- a/tests/f_bigalloc_badinode/script +++ b/tests/f_bigalloc_badinode/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi SKIP_GUNZIP="true" TEST_DATA="$test_name.tmp" @@ -18,7 +21,3 @@ EOF rm -f $TEST_DATA unset E2FSCK_TIME TEST_DATA - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/f_bigalloc_orphan_list/script b/tests/f_bigalloc_orphan_list/script index af9d753..63a0350 100644 --- a/tests/f_bigalloc_orphan_list/script +++ b/tests/f_bigalloc_orphan_list/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi SKIP_GUNZIP="true" TEST_DATA="$test_name.tmp" @@ -22,7 +25,3 @@ EOF rm -f $TEST_DATA unset E2FSCK_TIME TEST_DATA - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/f_create_symlinks/script b/tests/f_create_symlinks/script index 1a97216..7d712f5 100644 --- a/tests/f_create_symlinks/script +++ b/tests/f_create_symlinks/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi FSCK_OPT=-yf OUT=$test_name.log @@ -56,7 +59,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -a -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/f_desc_size_bad/script b/tests/f_desc_size_bad/script index 5440328..ae29627 100644 --- a/tests/f_desc_size_bad/script +++ b/tests/f_desc_size_bad/script @@ -1,5 +1,5 @@ if ! test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" + echo "$test_name: $test_description: skipped (no debugfs)" return 0 fi diff --git a/tests/f_detect_junk/script b/tests/f_detect_junk/script index 429ff00..ab2a38c 100644 --- a/tests/f_detect_junk/script +++ b/tests/f_detect_junk/script @@ -1,6 +1,8 @@ #!/bin/bash -if [ "$(grep -c 'define HAVE_MAGIC_H' ../lib/config.h)" -gt 0 ]; then +if [ "$(grep -c 'define HAVE_MAGIC_H' ../lib/config.h)" -eq 0 ]; then + echo "$test_name: skipped (no magic)" +fi FSCK_OPT=-fn IMAGE=$test_dir/image.bz2 @@ -20,7 +22,7 @@ rm -rf $test_name.failed $test_name.ok echo "*** e2fsck" > $OUT $FSCK $FSCK_OPT $TMPFILE >> $OUT 2>&1 echo "*** debugfs" >> $OUT -test -x $DEBUGFS_EXE && $DEBUGFS_EXE -R 'quit' $TMPFILE >> $OUT 2>&1 +test -x $DEBUGFS_EXE && $DEBUGFS -R 'quit' $TMPFILE >> $OUT 2>&1 echo "*** tune2fs" >> $OUT $TUNE2FS -i 0 $TMPFILE >> $OUT 2>&1 echo "*** mke2fs" >> $OUT @@ -38,7 +40,3 @@ else diff -u $EXP $OUT >> $test_name.failed fi unset EXP OUT FSCK_OPT IMAGE - -else #if HAVE_MAGIC_H - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/f_detect_xfs/script b/tests/f_detect_xfs/script index c80f0f7..4da1cd9 100644 --- a/tests/f_detect_xfs/script +++ b/tests/f_detect_xfs/script @@ -17,7 +17,7 @@ rm -rf $test_name.failed $test_name.ok echo "*** e2fsck" > $OUT $FSCK $FSCK_OPT $TMPFILE >> $OUT 2>&1 echo "*** debugfs" >> $OUT -test -x $DEBUGFS_EXE && $DEBUGFS_EXE -R 'quit' $TMPFILE >> $OUT 2>&1 +test -x $DEBUGFS_EXE && $DEBUGFS -R 'quit' $TMPFILE >> $OUT 2>&1 echo "*** tune2fs" >> $OUT $TUNE2FS -i 0 $TMPFILE >> $OUT 2>&1 echo "*** mke2fs" >> $OUT diff --git a/tests/f_dup4/script b/tests/f_dup4/script index 498f525..aec862d 100644 --- a/tests/f_dup4/script +++ b/tests/f_dup4/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi SKIP_GUNZIP="true" TEST_DATA="$test_name.tmp" @@ -50,7 +53,3 @@ export E2FSCK_TIME rm -f $TEST_DATA unset E2FSCK_TIME TEST_DATA - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/f_dup_de/script b/tests/f_dup_de/script index 60378cd..dcda9d8 100644 --- a/tests/f_dup_de/script +++ b/tests/f_dup_de/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi if test "$HTREE"x = x ; then gunzip < $test_dir/image.gz > $TMPFILE @@ -10,7 +13,3 @@ if test "$HTREE"x = x ; then fi . $cmd_dir/run_e2fsck rm -f "$TMPFILE".gz - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/f_dup_resize/script b/tests/f_dup_resize/script index 19fa120..52a1aed 100644 --- a/tests/f_dup_resize/script +++ b/tests/f_dup_resize/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi SKIP_GUNZIP="true" TEST_DATA="$test_name.tmp" @@ -24,7 +27,3 @@ export E2FSCK_TIME rm -f $TEST_DATA unset E2FSCK_TIME TEST_DATA - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/f_extent_oobounds/script b/tests/f_extent_oobounds/script index 54674ca..9c6117c 100644 --- a/tests/f_extent_oobounds/script +++ b/tests/f_extent_oobounds/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi SKIP_GUNZIP="true" TEST_DATA="$test_name.tmp" @@ -36,7 +39,3 @@ EOF rm -f $TEST_DATA unset E2FSCK_TIME TEST_DATA - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/f_imagic_fs/script b/tests/f_imagic_fs/script index 1060f04..511dcc7 100644 --- a/tests/f_imagic_fs/script +++ b/tests/f_imagic_fs/script @@ -1,9 +1,8 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi IMAGE=$test_dir/../f_imagic/image.gz PREP_CMD='$DEBUGFS -w -R "feature imagic_inodes" $TMPFILE > /dev/null 2>&1' . $cmd_dir/run_e2fsck - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/f_resize_inode/script b/tests/f_resize_inode/script index 190871b..0243bda 100644 --- a/tests/f_resize_inode/script +++ b/tests/f_resize_inode/script @@ -1,6 +1,9 @@ -if test -x $DEBUGFS_EXE; then - test_description="e2fsck with resize_inode" +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi + FSCK_OPT=-yf OUT=$test_name.log if [ -f $test_dir/expect.gz ]; then @@ -137,7 +140,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/f_uninit_cat/script b/tests/f_uninit_cat/script index 8877566..8d56e84 100755 --- a/tests/f_uninit_cat/script +++ b/tests/f_uninit_cat/script @@ -1,6 +1,9 @@ #!/bin/bash -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi FSCK_OPT=-fy IMAGE=$test_dir/image.gz @@ -18,7 +21,7 @@ echo "Exit status is $?" >> $OUT echo "debugfs cat uninit file" >> $OUT echo "ex /a" > $TMPFILE.cmd echo "cat /a" >> $TMPFILE.cmd -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE >> $OUT.new 2>&1 +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE >> $OUT.new 2>&1 echo >> $OUT.new sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT rm -rf $OUT.new $TMPFILE $TMPFILE.cmd @@ -32,6 +35,3 @@ else diff -u $EXP $OUT >> $test_name.failed fi unset EXP OUT FSCK_OPT IMAGE -else #if test -a -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/f_uninit_last_uninit/script b/tests/f_uninit_last_uninit/script index 376c978..53105a4 100644 --- a/tests/f_uninit_last_uninit/script +++ b/tests/f_uninit_last_uninit/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi SKIP_GUNZIP="true" @@ -20,7 +23,3 @@ export E2FSCK_TIME . $cmd_dir/run_e2fsck unset E2FSCK_TIME - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/j_corrupt_commit_csum/script b/tests/j_corrupt_commit_csum/script index 9c16975..57fc8fb 100644 --- a/tests/j_corrupt_commit_csum/script +++ b/tests/j_corrupt_commit_csum/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi IMAGE=$test_dir/image.gz FSCK_OPT=-fy @@ -28,7 +31,7 @@ rm -f $OUT.new echo "cat /a" > $TMPFILE.cmd echo >> $TMPFILE.cmd -$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT rm -f $TMPFILE.cmd rm -f $TMPFILE @@ -46,7 +49,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/j_corrupt_commit_tid/script b/tests/j_corrupt_commit_tid/script index 9c16975..57fc8fb 100644 --- a/tests/j_corrupt_commit_tid/script +++ b/tests/j_corrupt_commit_tid/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi IMAGE=$test_dir/image.gz FSCK_OPT=-fy @@ -28,7 +31,7 @@ rm -f $OUT.new echo "cat /a" > $TMPFILE.cmd echo >> $TMPFILE.cmd -$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT rm -f $TMPFILE.cmd rm -f $TMPFILE @@ -46,7 +49,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/j_corrupt_descr_csum/script b/tests/j_corrupt_descr_csum/script index 9c16975..57fc8fb 100644 --- a/tests/j_corrupt_descr_csum/script +++ b/tests/j_corrupt_descr_csum/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi IMAGE=$test_dir/image.gz FSCK_OPT=-fy @@ -28,7 +31,7 @@ rm -f $OUT.new echo "cat /a" > $TMPFILE.cmd echo >> $TMPFILE.cmd -$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT rm -f $TMPFILE.cmd rm -f $TMPFILE @@ -46,7 +49,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/j_corrupt_descr_tid/script b/tests/j_corrupt_descr_tid/script index 9c16975..57fc8fb 100644 --- a/tests/j_corrupt_descr_tid/script +++ b/tests/j_corrupt_descr_tid/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi IMAGE=$test_dir/image.gz FSCK_OPT=-fy @@ -28,7 +31,7 @@ rm -f $OUT.new echo "cat /a" > $TMPFILE.cmd echo >> $TMPFILE.cmd -$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT rm -f $TMPFILE.cmd rm -f $TMPFILE @@ -46,7 +49,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/j_corrupt_journal_block/script b/tests/j_corrupt_journal_block/script index 2bce973..a881bd1 100644 --- a/tests/j_corrupt_journal_block/script +++ b/tests/j_corrupt_journal_block/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi IMAGE=$test_dir/image.gz FSCK_OPT=-fy @@ -28,7 +31,7 @@ rm -f $OUT.new echo "cat /a" > $TMPFILE.cmd echo >> $TMPFILE.cmd -$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT echo >> $OUT rm -f $TMPFILE.cmd @@ -47,7 +50,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/j_corrupt_revoke_block/script b/tests/j_corrupt_revoke_block/script index 9c16975..57fc8fb 100644 --- a/tests/j_corrupt_revoke_block/script +++ b/tests/j_corrupt_revoke_block/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi IMAGE=$test_dir/image.gz FSCK_OPT=-fy @@ -28,7 +31,7 @@ rm -f $OUT.new echo "cat /a" > $TMPFILE.cmd echo >> $TMPFILE.cmd -$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT rm -f $TMPFILE.cmd rm -f $TMPFILE @@ -46,7 +49,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/j_corrupt_revoke_csum/script b/tests/j_corrupt_revoke_csum/script index 9c16975..57fc8fb 100644 --- a/tests/j_corrupt_revoke_csum/script +++ b/tests/j_corrupt_revoke_csum/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi IMAGE=$test_dir/image.gz FSCK_OPT=-fy @@ -28,7 +31,7 @@ rm -f $OUT.new echo "cat /a" > $TMPFILE.cmd echo >> $TMPFILE.cmd -$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT rm -f $TMPFILE.cmd rm -f $TMPFILE @@ -46,7 +49,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/j_corrupt_sb_csum/script b/tests/j_corrupt_sb_csum/script index 9c16975..57fc8fb 100644 --- a/tests/j_corrupt_sb_csum/script +++ b/tests/j_corrupt_sb_csum/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi IMAGE=$test_dir/image.gz FSCK_OPT=-fy @@ -28,7 +31,7 @@ rm -f $OUT.new echo "cat /a" > $TMPFILE.cmd echo >> $TMPFILE.cmd -$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT rm -f $TMPFILE.cmd rm -f $TMPFILE @@ -46,7 +49,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/j_corrupt_sb_magic/script b/tests/j_corrupt_sb_magic/script index 9c16975..57fc8fb 100644 --- a/tests/j_corrupt_sb_magic/script +++ b/tests/j_corrupt_sb_magic/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi IMAGE=$test_dir/image.gz FSCK_OPT=-fy @@ -28,7 +31,7 @@ rm -f $OUT.new echo "cat /a" > $TMPFILE.cmd echo >> $TMPFILE.cmd -$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT rm -f $TMPFILE.cmd rm -f $TMPFILE @@ -46,7 +49,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/j_ext_long_revoke_trans/script b/tests/j_ext_long_revoke_trans/script index fe45c72..21518ed 100644 --- a/tests/j_ext_long_revoke_trans/script +++ b/tests/j_ext_long_revoke_trans/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi FSCK_OPT=-fy OUT=$test_name.log @@ -39,14 +42,14 @@ echo "jc" >> $TMPFILE.cmd echo "jo -f $JNLFILE" >> $TMPFILE.cmd echo "jw -r 259-4356 /dev/zero" >> $TMPFILE.cmd echo "jc" >> $TMPFILE.cmd -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT rm -rf $OUT.new test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img" test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$JNLFILE" "$JOURNAL_DUMP_DIR/$test_name.img.jnl" echo "logdump -c -f $JNLFILE" > $TMPFILE.cmd -$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed -e 's/logdump -c -f.*/logdump -c/g' >> $OUT +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed -e 's/logdump -c -f.*/logdump -c/g' >> $OUT rm -rf $TMPFILE.cmd echo "debugfs fsck" >> $OUT @@ -71,7 +74,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP JNLFILE - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/j_ext_long_trans/script b/tests/j_ext_long_trans/script index f71e5a4..5f7fa53 100644 --- a/tests/j_ext_long_trans/script +++ b/tests/j_ext_long_trans/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi FSCK_OPT=-fy OUT=$test_name.log @@ -36,14 +39,14 @@ echo "debugfs write journal" >> $OUT echo "jo -f $JNLFILE" > $TMPFILE.cmd echo "jw -b 259-4356 /dev/zero" >> $TMPFILE.cmd echo "jc" >> $TMPFILE.cmd -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT rm -rf $OUT.new test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img" test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$JNLFILE" "$JOURNAL_DUMP_DIR/$test_name.img.jnl" echo "logdump -c -f $JNLFILE" > $TMPFILE.cmd -$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed -e 's/logdump -c -f.*/logdump -c/g' >> $OUT +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed -e 's/logdump -c -f.*/logdump -c/g' >> $OUT rm -rf $TMPFILE.cmd echo "debugfs fsck" >> $OUT @@ -68,7 +71,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP JNLFILE - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/j_long_revoke_trans/script b/tests/j_long_revoke_trans/script index 4a0c5d1..bc33025 100644 --- a/tests/j_long_revoke_trans/script +++ b/tests/j_long_revoke_trans/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi FSCK_OPT=-fy OUT=$test_name.log @@ -26,13 +29,13 @@ echo "jc" >> $TMPFILE.cmd echo "jo" >> $TMPFILE.cmd echo "jw -r 259-4356" >> $TMPFILE.cmd echo "jc" >> $TMPFILE.cmd -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT rm -rf $OUT.new test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img" echo "logdump -c" > $TMPFILE.cmd -$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT rm -rf $TMPFILE.cmd $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 @@ -56,7 +59,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/j_long_revoke_trans_mcsum_32bit/script b/tests/j_long_revoke_trans_mcsum_32bit/script index fc0d0ad..3e838ac 100644 --- a/tests/j_long_revoke_trans_mcsum_32bit/script +++ b/tests/j_long_revoke_trans_mcsum_32bit/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi FSCK_OPT=-fy OUT=$test_name.log @@ -28,8 +31,8 @@ echo "jc" >> $TMPFILE.cmd echo "jo" >> $TMPFILE.cmd echo "jw -r 260-4356" >> $TMPFILE.cmd echo "jc" >> $TMPFILE.cmd -#$DEBUGFS_EXE -w $TMPFILE -f $TMPFILE.cmd >> $OUT 2>&1 -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null +#$DEBUGFS -w $TMPFILE -f $TMPFILE.cmd >> $OUT 2>&1 +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT rm -rf $OUT.new @@ -37,7 +40,7 @@ $DUMPE2FS $TMPFILE 2>&1 | grep '^Journal features:' >> $OUT test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img" echo "logdump -c" > $TMPFILE.cmd -$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT rm -rf $TMPFILE.cmd $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 @@ -61,7 +64,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/j_long_revoke_trans_mcsum_64bit/script b/tests/j_long_revoke_trans_mcsum_64bit/script index e206f88..eef9f02 100644 --- a/tests/j_long_revoke_trans_mcsum_64bit/script +++ b/tests/j_long_revoke_trans_mcsum_64bit/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi FSCK_OPT=-fy OUT=$test_name.log @@ -28,8 +31,8 @@ echo "jc" >> $TMPFILE.cmd echo "jo" >> $TMPFILE.cmd echo "jw -r 262-4358" >> $TMPFILE.cmd echo "jc" >> $TMPFILE.cmd -#$DEBUGFS_EXE -w $TMPFILE -f $TMPFILE.cmd >> $OUT 2>&1 -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null +#$DEBUGFS -w $TMPFILE -f $TMPFILE.cmd >> $OUT 2>&1 +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT rm -rf $OUT.new @@ -37,7 +40,7 @@ $DUMPE2FS $TMPFILE 2>&1 | grep '^Journal features:' >> $OUT test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img" echo "logdump -c" > $TMPFILE.cmd -$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT rm -rf $TMPFILE.cmd $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 @@ -61,7 +64,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/j_long_trans/script b/tests/j_long_trans/script index 68172c4..425bf99 100644 --- a/tests/j_long_trans/script +++ b/tests/j_long_trans/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi FSCK_OPT=-fy OUT=$test_name.log @@ -23,13 +26,13 @@ echo "debugfs write journal" >> $OUT echo "jo" > $TMPFILE.cmd echo "jw -b 259-4356 /dev/zero" >> $TMPFILE.cmd echo "jc" >> $TMPFILE.cmd -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT rm -rf $OUT.new test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img" echo "logdump -c" > $TMPFILE.cmd -$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT rm -rf $TMPFILE.cmd $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 @@ -53,7 +56,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/j_long_trans_mcsum_32bit/script b/tests/j_long_trans_mcsum_32bit/script index 4722242..f0297a4 100644 --- a/tests/j_long_trans_mcsum_32bit/script +++ b/tests/j_long_trans_mcsum_32bit/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi FSCK_OPT=-fy OUT=$test_name.log @@ -25,7 +28,7 @@ echo "debugfs write journal" >> $OUT echo "jo -c" > $TMPFILE.cmd echo "jw -b 260-4356 /dev/zero" >> $TMPFILE.cmd echo "jc" >> $TMPFILE.cmd -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT rm -rf $OUT.new @@ -33,7 +36,7 @@ $DUMPE2FS $TMPFILE 2>&1 | grep '^Journal features:' >> $OUT test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img" echo "logdump -c" > $TMPFILE.cmd -$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT rm -rf $TMPFILE.cmd $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 @@ -57,7 +60,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/j_long_trans_mcsum_64bit/script b/tests/j_long_trans_mcsum_64bit/script index 65ca1b7..a72f6f1 100644 --- a/tests/j_long_trans_mcsum_64bit/script +++ b/tests/j_long_trans_mcsum_64bit/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi FSCK_OPT=-fy OUT=$test_name.log @@ -25,7 +28,7 @@ echo "debugfs write journal" >> $OUT echo "jo -c" > $TMPFILE.cmd echo "jw -b 262-4358 /dev/zero" >> $TMPFILE.cmd echo "jc" >> $TMPFILE.cmd -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT rm -rf $OUT.new @@ -33,7 +36,7 @@ $DUMPE2FS $TMPFILE 2>&1 | grep '^Journal features:' >> $OUT test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img" echo "logdump -c" > $TMPFILE.cmd -$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT rm -rf $TMPFILE.cmd $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 @@ -57,7 +60,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/j_short_revoke_trans/script b/tests/j_short_revoke_trans/script index 4eec436..9d3ee05 100644 --- a/tests/j_short_revoke_trans/script +++ b/tests/j_short_revoke_trans/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi FSCK_OPT=-fy OUT=$test_name.log @@ -28,13 +31,13 @@ echo "jc" >> $TMPFILE.cmd echo "jo" >> $TMPFILE.cmd echo "jw -r $bitmaps" >> $TMPFILE.cmd echo "jc" >> $TMPFILE.cmd -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT rm -rf $OUT.new test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img" echo "logdump -c" > $TMPFILE.cmd -$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT rm -rf $TMPFILE.cmd $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 @@ -58,7 +61,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/j_short_revoke_trans_mcsum_64bit/script b/tests/j_short_revoke_trans_mcsum_64bit/script index c943efa..c9cc7cd 100644 --- a/tests/j_short_revoke_trans_mcsum_64bit/script +++ b/tests/j_short_revoke_trans_mcsum_64bit/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi FSCK_OPT=-fy OUT=$test_name.log @@ -30,7 +33,7 @@ echo "jc" >> $TMPFILE.cmd echo "jo" >> $TMPFILE.cmd echo "jw -r $bitmaps" >> $TMPFILE.cmd echo "jc" >> $TMPFILE.cmd -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT rm -rf $OUT.new @@ -38,7 +41,7 @@ $DUMPE2FS $TMPFILE 2>&1 | grep '^Journal features:' >> $OUT test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img" echo "logdump -c" > $TMPFILE.cmd -$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT rm -rf $TMPFILE.cmd $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 @@ -62,7 +65,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/j_short_trans/script b/tests/j_short_trans/script index 852e7a5..8108ba8 100644 --- a/tests/j_short_trans/script +++ b/tests/j_short_trans/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi FSCK_OPT=-fy OUT=$test_name.log @@ -25,13 +28,13 @@ echo "debugfs write journal" >> $OUT echo "jo" > $TMPFILE.cmd echo "jw -b $bitmaps /dev/zero" >> $TMPFILE.cmd echo "jc" >> $TMPFILE.cmd -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT rm -rf $OUT.new test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img" echo "logdump -c" > $TMPFILE.cmd -$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT rm -rf $TMPFILE.cmd $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 @@ -55,7 +58,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/j_short_trans_64bit/script b/tests/j_short_trans_64bit/script index 994fa21..70649c2 100644 --- a/tests/j_short_trans_64bit/script +++ b/tests/j_short_trans_64bit/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi FSCK_OPT=-fy OUT=$test_name.log @@ -27,7 +30,7 @@ echo "debugfs write journal" >> $OUT echo "jo" > $TMPFILE.cmd echo "jw -b $bitmaps /dev/zero" >> $TMPFILE.cmd echo "jc" >> $TMPFILE.cmd -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT rm -rf $OUT.new @@ -35,7 +38,7 @@ $DUMPE2FS $TMPFILE 2>&1 | grep '^Journal features:' >> $OUT test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img" echo "logdump -c" > $TMPFILE.cmd -$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT rm -rf $TMPFILE.cmd $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 @@ -59,7 +62,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/j_short_trans_mcsum_64bit/script b/tests/j_short_trans_mcsum_64bit/script index 034b237..ad736eb 100644 --- a/tests/j_short_trans_mcsum_64bit/script +++ b/tests/j_short_trans_mcsum_64bit/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi FSCK_OPT=-fy OUT=$test_name.log @@ -27,7 +30,7 @@ echo "debugfs write journal" >> $OUT echo "jo -c" > $TMPFILE.cmd echo "jw -b $bitmaps /dev/zero" >> $TMPFILE.cmd echo "jc" >> $TMPFILE.cmd -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT rm -rf $OUT.new @@ -35,7 +38,7 @@ $DUMPE2FS $TMPFILE 2>&1 | grep '^Journal features:' >> $OUT test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img" echo "logdump -c" > $TMPFILE.cmd -$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT rm -rf $TMPFILE.cmd $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 @@ -59,7 +62,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/j_short_trans_old_csum/script b/tests/j_short_trans_old_csum/script index 56f8bcb..cb13acb 100644 --- a/tests/j_short_trans_old_csum/script +++ b/tests/j_short_trans_old_csum/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi FSCK_OPT=-fy OUT=$test_name.log @@ -27,7 +30,7 @@ echo "debugfs write journal" >> $OUT echo "jo -c" > $TMPFILE.cmd echo "jw -b $bitmaps /dev/zero" >> $TMPFILE.cmd echo "jc" >> $TMPFILE.cmd -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT rm -rf $OUT.new @@ -35,7 +38,7 @@ $DUMPE2FS $TMPFILE 2>&1 | grep '^Journal features:' >> $OUT test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img" echo "logdump -c" > $TMPFILE.cmd -$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT rm -rf $TMPFILE.cmd $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 @@ -59,7 +62,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/j_short_trans_open_recover/script b/tests/j_short_trans_open_recover/script index 67136fe..fe1d9e8 100644 --- a/tests/j_short_trans_open_recover/script +++ b/tests/j_short_trans_open_recover/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi FSCK_OPT=-fy OUT=$test_name.log @@ -25,20 +28,20 @@ echo "debugfs write journal" >> $OUT echo "jo" > $TMPFILE.cmd echo "jw -b $bitmaps /dev/zero" >> $TMPFILE.cmd echo "jc" >> $TMPFILE.cmd -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT rm -rf $OUT.new test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img" echo "logdump -c" > $TMPFILE.cmd -$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT rm -rf $TMPFILE.cmd echo "debugfs can't recover open journal" >> $OUT echo "jo" > $TMPFILE.cmd echo "jr" >> $TMPFILE.cmd echo "jc" >> $TMPFILE.cmd -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE > $OUT.new 2>&1 +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE > $OUT.new 2>&1 sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT rm -rf $OUT.new @@ -63,7 +66,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/j_short_trans_recover/script b/tests/j_short_trans_recover/script index e7b4943..a44111b 100644 --- a/tests/j_short_trans_recover/script +++ b/tests/j_short_trans_recover/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi FSCK_OPT=-fy OUT=$test_name.log @@ -28,18 +31,18 @@ echo "jc" >> $TMPFILE.cmd echo "jo" >> $TMPFILE.cmd echo "jw -r 333" >> $TMPFILE.cmd echo "jc" >> $TMPFILE.cmd -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT rm -rf $OUT.new test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img" echo "logdump -c" > $TMPFILE.cmd -$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT rm -rf $TMPFILE.cmd echo "debugfs recover journal" >> $OUT echo "jr" > $TMPFILE.cmd -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT rm -rf $OUT.new @@ -64,7 +67,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/j_short_trans_recover_mcsum_64bit/script b/tests/j_short_trans_recover_mcsum_64bit/script index 2c56e0f..9671b8c 100644 --- a/tests/j_short_trans_recover_mcsum_64bit/script +++ b/tests/j_short_trans_recover_mcsum_64bit/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi FSCK_OPT=-fy OUT=$test_name.log @@ -30,7 +33,7 @@ echo "jc" >> $TMPFILE.cmd echo "jo" >> $TMPFILE.cmd echo "jw -r 333" >> $TMPFILE.cmd echo "jc" >> $TMPFILE.cmd -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT rm -rf $OUT.new @@ -38,12 +41,12 @@ $DUMPE2FS $TMPFILE 2>&1 | grep '^Journal features:' >> $OUT test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img" echo "logdump -c" > $TMPFILE.cmd -$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT rm -rf $TMPFILE.cmd echo "debugfs recover journal" >> $OUT echo "jr" > $TMPFILE.cmd -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT rm -rf $OUT.new @@ -68,7 +71,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/j_short_uncommitted_trans/script b/tests/j_short_uncommitted_trans/script index a1fc3b4..ef0548b 100644 --- a/tests/j_short_uncommitted_trans/script +++ b/tests/j_short_uncommitted_trans/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi FSCK_OPT=-fy OUT=$test_name.log @@ -25,13 +28,13 @@ echo "debugfs write journal" >> $OUT echo "jo" > $TMPFILE.cmd echo "jw -b $bitmaps -c /dev/zero" >> $TMPFILE.cmd echo "jc" >> $TMPFILE.cmd -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT rm -rf $OUT.new test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img" echo "logdump -c" > $TMPFILE.cmd -$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT rm -rf $TMPFILE.cmd $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 @@ -55,7 +58,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/j_short_uncommitted_trans_mcsum_64bit/script b/tests/j_short_uncommitted_trans_mcsum_64bit/script index a0b8c7f..68965a9 100644 --- a/tests/j_short_uncommitted_trans_mcsum_64bit/script +++ b/tests/j_short_uncommitted_trans_mcsum_64bit/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi FSCK_OPT=-fy OUT=$test_name.log @@ -27,7 +30,7 @@ echo "debugfs write journal" >> $OUT echo "jo -c" > $TMPFILE.cmd echo "jw -b $bitmaps /dev/zero -c" >> $TMPFILE.cmd echo "jc" >> $TMPFILE.cmd -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT rm -rf $OUT.new @@ -35,7 +38,7 @@ $DUMPE2FS $TMPFILE 2>&1 | grep '^Journal features:' >> $OUT test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img" echo "logdump -c" > $TMPFILE.cmd -$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT rm -rf $TMPFILE.cmd $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 @@ -59,7 +62,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/m_devdir/script b/tests/m_devdir/script index 5f26699..3b1ef10 100644 --- a/tests/m_devdir/script +++ b/tests/m_devdir/script @@ -1,6 +1,9 @@ -if test -x $DEBUGFS_EXE; then - test_description="create fs image from /dev" +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi + MKFS_DIR=/dev OUT=$test_name.log @@ -27,7 +30,3 @@ fi rm -rf $TMPFILE.cmd $OUT.sed unset MKFS_DIR OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/m_minrootdir/script b/tests/m_minrootdir/script index 662e76f..3655993 100644 --- a/tests/m_minrootdir/script +++ b/tests/m_minrootdir/script @@ -1,6 +1,9 @@ -if test -x $DEBUGFS_EXE -a -x $RESIZE2FS_EXE; then - test_description="create fs image from dir, then minimize it" +if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" + return 0 +fi + MKFS_DIR=$TMPFILE.dir OUT=$test_name.log EXP=$test_dir/expect @@ -75,7 +78,3 @@ fi rm -rf $TMPFILE.cmd $MKFS_DIR $OUT.sed unset MKFS_DIR OUT EXP - -else #if test -x $DEBUGFS_EXE -a -x RESIZE2FS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/m_rootdir/script b/tests/m_rootdir/script index fbe1b31..86a0b10 100644 --- a/tests/m_rootdir/script +++ b/tests/m_rootdir/script @@ -1,6 +1,9 @@ -if test -x $DEBUGFS_EXE; then - test_description="create fs image from dir" +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi + MKFS_DIR=$TMPFILE.dir OUT=$test_name.log EXP=$test_dir/expect @@ -65,7 +68,3 @@ fi rm -rf $TMPFILE.cmd $MKFS_DIR $OUT.sed unset MKFS_DIR OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/r_1024_small_bg/script b/tests/r_1024_small_bg/script index 2038cb9..65276ab 100644 --- a/tests/r_1024_small_bg/script +++ b/tests/r_1024_small_bg/script @@ -1,6 +1,9 @@ -if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then - test_description="ext2 1024 blocksize with small block groups" +if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" + return 0 +fi + FEATURES="-t ext2 -O ^resize_inode -b 1024 -g 1024" SIZE_1=64M SIZE_2=2G @@ -25,7 +28,3 @@ fi unset FEATURES SIZE_1 SIZE_2 LOG E2FSCK -else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi - diff --git a/tests/r_32to64bit/script b/tests/r_32to64bit/script index de08bfb..6ecdf90 100644 --- a/tests/r_32to64bit/script +++ b/tests/r_32to64bit/script @@ -1,4 +1,7 @@ -if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then +if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" + return 0 +fi FSCK_OPT=-fn OUT=$test_name.log @@ -67,8 +70,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP CONF - -else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi - diff --git a/tests/r_32to64bit_expand_full/script b/tests/r_32to64bit_expand_full/script index 7a57084..ee888fe 100644 --- a/tests/r_32to64bit_expand_full/script +++ b/tests/r_32to64bit_expand_full/script @@ -1,4 +1,7 @@ -if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then +if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" + return 0 +fi FSCK_OPT=-fn OUT=$test_name.log @@ -76,8 +79,3 @@ fi rm $OUT.before $OUT.after unset IMAGE FSCK_OPT OUT EXP CONF - -else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi - diff --git a/tests/r_32to64bit_meta/script b/tests/r_32to64bit_meta/script index 25872c4..9711af0 100644 --- a/tests/r_32to64bit_meta/script +++ b/tests/r_32to64bit_meta/script @@ -1,4 +1,7 @@ -if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then +if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" + return 0 +fi FSCK_OPT=-fn OUT=$test_name.log @@ -67,8 +70,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP CONF - -else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi - diff --git a/tests/r_32to64bit_move_itable/script b/tests/r_32to64bit_move_itable/script index c188acd..6b339af 100644 --- a/tests/r_32to64bit_move_itable/script +++ b/tests/r_32to64bit_move_itable/script @@ -1,4 +1,7 @@ -if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then +if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" + return 0 +fi FSCK_OPT=-fn OUT=$test_name.log @@ -67,8 +70,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP CONF - -else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi - diff --git a/tests/r_64bit_big_expand/script b/tests/r_64bit_big_expand/script index 0319f0e..f514d50 100644 --- a/tests/r_64bit_big_expand/script +++ b/tests/r_64bit_big_expand/script @@ -1,6 +1,9 @@ -if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then - test_description="very large fs growth using ext4 w/64bit" +if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" + return 0 +fi + FEATURES="-t ext4 -O 64bit" SIZE_1=512M SIZE_2=2T @@ -29,8 +32,3 @@ else fi unset FEATURES SIZE_1 SIZE_2 LOG E2FSCK - -else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi - diff --git a/tests/r_64to32bit/script b/tests/r_64to32bit/script index 5d959f0..02718bd 100644 --- a/tests/r_64to32bit/script +++ b/tests/r_64to32bit/script @@ -1,4 +1,7 @@ -if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then +if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" + return 0 +fi FSCK_OPT=-fn OUT=$test_name.log @@ -69,8 +72,3 @@ fi rm $OUT.before $OUT.after unset IMAGE FSCK_OPT OUT EXP CONF - -else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi - diff --git a/tests/r_64to32bit_meta/script b/tests/r_64to32bit_meta/script index 5a02e26..69b33cc 100644 --- a/tests/r_64to32bit_meta/script +++ b/tests/r_64to32bit_meta/script @@ -1,4 +1,7 @@ -if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then +if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" + return 0 +fi FSCK_OPT=-fn OUT=$test_name.log @@ -69,8 +72,3 @@ fi rm $OUT.before $OUT.after unset IMAGE FSCK_OPT OUT EXP CONF - -else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi - diff --git a/tests/r_bigalloc_big_expand/script b/tests/r_bigalloc_big_expand/script index d939aea..0c9986b 100644 --- a/tests/r_bigalloc_big_expand/script +++ b/tests/r_bigalloc_big_expand/script @@ -1,6 +1,9 @@ -if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then - test_description="ext4 with bigalloc" +if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" + return 0 +fi + FEATURES="-t ext4 -O bigalloc" SIZE_1=512M SIZE_2=2T @@ -30,8 +33,3 @@ else fi unset FEATURES SIZE_1 SIZE_2 LOG E2FSCK - -else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi - diff --git a/tests/r_expand_full/script b/tests/r_expand_full/script index 672829f..4a751f7 100644 --- a/tests/r_expand_full/script +++ b/tests/r_expand_full/script @@ -1,4 +1,7 @@ -if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then +if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" + return 0 +fi FSCK_OPT=-fn OUT=$test_name.log @@ -78,8 +81,3 @@ fi rm $OUT.before $OUT.after unset IMAGE FSCK_OPT OUT EXP CONF - -else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi - diff --git a/tests/r_ext4_big_expand/script b/tests/r_ext4_big_expand/script index 1b8c823..266c903 100644 --- a/tests/r_ext4_big_expand/script +++ b/tests/r_ext4_big_expand/script @@ -1,6 +1,9 @@ -if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then - test_description="very large fs growth using ext4" +if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" + return 0 +fi + FEATURES="-t ext4" SIZE_1=512M SIZE_2=2T @@ -29,8 +32,3 @@ else fi unset FEATURES SIZE_1 SIZE_2 LOG E2FSCK - -else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi - diff --git a/tests/r_ext4_small_bg/script b/tests/r_ext4_small_bg/script index cdc6e4a..87f5084 100644 --- a/tests/r_ext4_small_bg/script +++ b/tests/r_ext4_small_bg/script @@ -1,6 +1,9 @@ -if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then - test_description="ext4 1024 blocksize with small block groups" +if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" + return 0 +fi + FEATURES="-t ext4 -O ^resize_inode -b 1024 -g 512" SIZE_1=64M SIZE_2=2G @@ -24,8 +27,3 @@ else fi unset FEATURES SIZE_1 SIZE_2 LOG E2FSCK - -else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi - diff --git a/tests/r_fixup_lastbg/script b/tests/r_fixup_lastbg/script index 6a5c5af..0451421 100755 --- a/tests/r_fixup_lastbg/script +++ b/tests/r_fixup_lastbg/script @@ -1,5 +1,8 @@ -if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then test_description="fix up last bg when expanding within the last bg" +if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" + return 0 +fi EXP=$test_dir/expect OUT=$test_name.out @@ -31,7 +34,3 @@ else fi unset EXP LOG OUT E2FSCK - -else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/r_fixup_lastbg_big/script b/tests/r_fixup_lastbg_big/script index 97d9fd4..a12fb16 100755 --- a/tests/r_fixup_lastbg_big/script +++ b/tests/r_fixup_lastbg_big/script @@ -1,5 +1,8 @@ -if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then test_description="fix up last bg when expanding beyond the last bg" +if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" + return 0 +fi EXP=$test_dir/expect OUT=$test_name.out @@ -31,7 +34,3 @@ else fi unset EXP LOG OUT E2FSCK - -else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/r_inline_xattr/script b/tests/r_inline_xattr/script index eb2085d..04baac8 100644 --- a/tests/r_inline_xattr/script +++ b/tests/r_inline_xattr/script @@ -1,4 +1,7 @@ -if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then +if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" + return 0 +fi IMAGE=$test_dir/image.gz FSCK_OPT=-yf @@ -46,8 +49,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi - diff --git a/tests/r_meta_bg_shrink/script b/tests/r_meta_bg_shrink/script index de77777..c47d4ff 100644 --- a/tests/r_meta_bg_shrink/script +++ b/tests/r_meta_bg_shrink/script @@ -1,6 +1,9 @@ -if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then - test_description="meta_bg shrink" +if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" + return 0 +fi + FEATURES="-t ext4 -O 64bit,meta_bg,^resize_inode -b 1024" SIZE_1=1G SIZE_2=48M @@ -27,8 +30,3 @@ else fi unset FEATURES SIZE_1 SIZE_2 LOG E2FSCK - -else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi - diff --git a/tests/r_min_itable/script b/tests/r_min_itable/script index beb6cf9..e778736 100644 --- a/tests/r_min_itable/script +++ b/tests/r_min_itable/script @@ -1,4 +1,7 @@ -if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then +if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" + return 0 +fi IMAGE=$test_dir/image.gz FSCK_OPT=-yf @@ -38,8 +41,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi - diff --git a/tests/r_move_itable/script b/tests/r_move_itable/script index 3f02a79..6109f35 100644 --- a/tests/r_move_itable/script +++ b/tests/r_move_itable/script @@ -1,4 +1,7 @@ -if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then +if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" + return 0 +fi FSCK_OPT=-yf OUT=$test_name.log @@ -110,7 +113,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/r_move_itable_nostride/script b/tests/r_move_itable_nostride/script index 261ef53..d3b95b1 100644 --- a/tests/r_move_itable_nostride/script +++ b/tests/r_move_itable_nostride/script @@ -10,7 +10,10 @@ if [ $(uname -s) = "Darwin" ]; then return 0 fi -if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then +if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" + return 0 +fi FSCK_OPT=-yf OUT=$test_name.log @@ -63,7 +66,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/r_move_itable_realloc/script b/tests/r_move_itable_realloc/script index c42ec04..7005bf8 100644 --- a/tests/r_move_itable_realloc/script +++ b/tests/r_move_itable_realloc/script @@ -10,7 +10,10 @@ if [ $(uname -s) = "Darwin" ]; then return 0 fi -if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then +if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" + return 0 +fi FSCK_OPT=-yf OUT=$test_name.log @@ -63,7 +66,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/run_mke2fs b/tests/run_mke2fs index 82eca41..2a784fe 100644 --- a/tests/run_mke2fs +++ b/tests/run_mke2fs @@ -20,7 +20,7 @@ AFTER_CMD='$DUMPE2FS $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT1' else #if test -x $DEBUGFS_EXE; then rm -f $test_name.ok $test_name.failed - echo "skipped" + echo "skipped (no debugfs)" fi unset DESCRIPTION FS_SIZE MKE2FS_OPTS MKE2FS_SKIP_PROGRESS \ diff --git a/tests/t_iexpand_full/script b/tests/t_iexpand_full/script index f8565a7..875c70e 100644 --- a/tests/t_iexpand_full/script +++ b/tests/t_iexpand_full/script @@ -1,4 +1,7 @@ -if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then +if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" + return 0 +fi if [ $(uname -s) = "Darwin" ]; then # creates a 3GB filesystem @@ -78,8 +81,3 @@ fi rm $OUT.before $OUT.after unset IMAGE FSCK_OPT OUT EXP CONF - -else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi - diff --git a/tests/t_iexpand_mcsum/script b/tests/t_iexpand_mcsum/script index 4b584d3..116cad9 100644 --- a/tests/t_iexpand_mcsum/script +++ b/tests/t_iexpand_mcsum/script @@ -1,4 +1,8 @@ -if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then +if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" + return 0 +fi + if [ $(uname -s) = "Darwin" ]; then # creates a 3GB filesystem echo "$test_name: $DESCRIPTION: skipped for HFS+ (no sparse files)" @@ -78,8 +82,3 @@ fi rm $OUT.before $OUT.after unset IMAGE FSCK_OPT OUT EXP CONF - -else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi - diff --git a/tests/t_replay_and_set/script b/tests/t_replay_and_set/script index 36411fc..bec9108 100644 --- a/tests/t_replay_and_set/script +++ b/tests/t_replay_and_set/script @@ -1,4 +1,7 @@ -if test -x $DEBUGFS_EXE; then +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi FSCK_OPT=-fy OUT=$test_name.log @@ -25,7 +28,7 @@ echo "debugfs write journal" >> $OUT echo "jo" > $TMPFILE.cmd echo "jw -b $bitmaps /dev/zero" >> $TMPFILE.cmd echo "jc" >> $TMPFILE.cmd -$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null +$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT rm -rf $OUT.new @@ -54,7 +57,3 @@ else fi unset IMAGE FSCK_OPT OUT EXP - -else #if test -x $DEBUGFS_EXE; then - echo "$test_name: $test_description: skipped" -fi diff --git a/tests/u_debugfs_opt/script b/tests/u_debugfs_opt/script index bb93917..b5a65ec 100644 --- a/tests/u_debugfs_opt/script +++ b/tests/u_debugfs_opt/script @@ -1,5 +1,8 @@ test_description="e2undo with debugfs -z" -if test -x $E2UNDO_EXE -a -x $DEBUGFS_EXE; then +if ! test -x $E2UNDO_EXE -o ! -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs/e2undo)" + return 0 +fi TDB_FILE=${TMPDIR:-/tmp}/tune2fs-$(basename $TMPFILE).e2undo OUT=$test_name.log @@ -29,4 +32,3 @@ else echo "$test_name: $test_description: failed" fi rm -f $TDB_FILE $TMPFILE -fi From patchwork Wed May 2 04:26:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Dilger X-Patchwork-Id: 907293 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=dilger.ca Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40bQRG0dmWz9s37 for ; Wed, 2 May 2018 14:34:34 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751069AbeEBEed (ORCPT ); Wed, 2 May 2018 00:34:33 -0400 Received: from smtp-out-so.shaw.ca ([64.59.136.137]:39492 "EHLO smtp-out-so.shaw.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751025AbeEBEe3 (ORCPT ); Wed, 2 May 2018 00:34:29 -0400 X-Greylist: delayed 487 seconds by postgrey-1.27 at vger.kernel.org; Wed, 02 May 2018 00:34:27 EDT Received: from cabot.adilger.int ([70.77.216.213]) by shaw.ca with ESMTP id DjLNfiF7x5wO5DjLSfV9LE; Tue, 01 May 2018 22:26:22 -0600 X-Authority-Analysis: v=2.3 cv=SJtsqtnH c=1 sm=1 tr=0 a=BQvS1EmAg2ttxjPVUuc1UQ==:117 a=BQvS1EmAg2ttxjPVUuc1UQ==:17 a=RPJ6JBhKAAAA:8 a=QK6B1R8K4-xcOQmZNCYA:9 a=fa_un-3J20JGBB2Tu-mn:22 From: Andreas Dilger To: tytso@mit.edu Cc: linux-ext4@vger.kernel.org, Andreas Dilger Subject: [PATCH 04/10] tests: replace perl usage with shell built-in Date: Tue, 1 May 2018 22:26:00 -0600 Message-Id: <1525235166-6448-5-git-send-email-adilger@dilger.ca> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1525235166-6448-4-git-send-email-adilger@dilger.ca> References: <1525235166-6448-1-git-send-email-adilger@dilger.ca> <1525235166-6448-2-git-send-email-adilger@dilger.ca> <1525235166-6448-3-git-send-email-adilger@dilger.ca> <1525235166-6448-4-git-send-email-adilger@dilger.ca> X-CMAE-Envelope: MS4wfMxKMJ75dBqI86Sec0SKsHTIq22iODqv0EEonfqWjj8T9LIG1IUvVW1A5u++PUUma9jv0P2fwvxgzIvIFduDgurKbMRPqZx1rlnO4J9gJFhk4yiqyuUX 4XNSekB+AFZPUNBkrbe/y85Xg+kodIbCUFMxVHX21nhdywdZeIVUvk9r72wCtLA93ZaXbsZ1mPhQXWM7y6oOYX6GZbSVS/Q3pdbAiQDp8VUGLfYKF+4x1Cb+ Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org A couple of tests use perl only for generating a string of N characters long. Instead, expand an environment variable to the required length. Signed-off-by: Andreas Dilger --- tests/d_xattr_sorting/script | 3 ++- tests/f_create_symlinks/script | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/d_xattr_sorting/script b/tests/d_xattr_sorting/script index a599f3c..dc92751 100644 --- a/tests/d_xattr_sorting/script +++ b/tests/d_xattr_sorting/script @@ -22,7 +22,8 @@ echo Exit status is $status >> $OUT B=$(mktemp ${TMPDIR:-/tmp}/b.XXXXXX) -perl -e 'print "x" x 256;' > $B +F="xxxxxxxx"; F+=$F; F+=$F; F+=$F; F+=$F; F+=$F +echo "$F" | dd of=$B bs=256 count=1 2> /dev/null echo "ea_set -f /tmp/b / security.SMEG64" > $OUT.new $DEBUGFS -w -R "ea_set -f $B / security.SMEG64" $TMPFILE >> $OUT.new 2>&1 diff --git a/tests/f_create_symlinks/script b/tests/f_create_symlinks/script index 7d712f5..b7c22d3 100644 --- a/tests/f_create_symlinks/script +++ b/tests/f_create_symlinks/script @@ -26,11 +26,13 @@ echo Exit status is $status >> $OUT.new sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT rm -f $OUT.new +B="xxxxxxx"; B+=$B; B+=$B; B+=$B; B+=$B; B+=$B; B+=$B; B+=$B; B+=$B for i in 30 60 70 500 1023 1024 1500; do - echo "debugfs -R \"symlink /l_$i $(perl -e "print 'x' x $i;")\" test.img" >> $OUT - $DEBUGFS -w -R "symlink /l_$i $(perl -e "print 'x' x $i;")" $TMPFILE \ - 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT + echo "debugfs -R \"symlink /l_$i ${B:1:i}\" test.img" >> $OUT + $DEBUGFS -w -R "symlink /l_$i ${B:1:i}" $TMPFILE 2>&1 | + sed -f $cmd_dir/filter.sed >> $OUT done +unset B for i in 30 60 70 500 1023 1024 1500; do echo "debugfs -R \"stat /l_$i\" test.img" >> $OUT From patchwork Wed May 2 04:26:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Dilger X-Patchwork-Id: 907295 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=dilger.ca Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40bQRL0w0Rz9s3G for ; Wed, 2 May 2018 14:34:38 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751128AbeEBEeg (ORCPT ); Wed, 2 May 2018 00:34:36 -0400 Received: from smtp-out-so.shaw.ca ([64.59.136.139]:39488 "EHLO smtp-out-so.shaw.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750849AbeEBEea (ORCPT ); Wed, 2 May 2018 00:34:30 -0400 Received: from cabot.adilger.int ([70.77.216.213]) by shaw.ca with ESMTP id DjLNfiF7x5wO5DjLSfV9LI; Tue, 01 May 2018 22:26:23 -0600 X-Authority-Analysis: v=2.3 cv=SJtsqtnH c=1 sm=1 tr=0 a=BQvS1EmAg2ttxjPVUuc1UQ==:117 a=BQvS1EmAg2ttxjPVUuc1UQ==:17 a=RPJ6JBhKAAAA:8 a=EYTF3ReEYkuOGValxIUA:9 a=4oH0OIel7UuW_QmG:21 a=7WQn-rHaWmnA5xZw:21 a=fa_un-3J20JGBB2Tu-mn:22 From: Andreas Dilger To: tytso@mit.edu Cc: linux-ext4@vger.kernel.org, Andreas Dilger Subject: [PATCH 05/10] ext2fs: annotate superblock/inode offsets Date: Tue, 1 May 2018 22:26:01 -0600 Message-Id: <1525235166-6448-6-git-send-email-adilger@dilger.ca> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1525235166-6448-5-git-send-email-adilger@dilger.ca> References: <1525235166-6448-1-git-send-email-adilger@dilger.ca> <1525235166-6448-2-git-send-email-adilger@dilger.ca> <1525235166-6448-3-git-send-email-adilger@dilger.ca> <1525235166-6448-4-git-send-email-adilger@dilger.ca> <1525235166-6448-5-git-send-email-adilger@dilger.ca> X-CMAE-Envelope: MS4wfNkw7NwFQDW0A4eXiOjkh6g+j6LMbyVo9no2oCnGqecPkA8lCGxkZpcSKCs4emg3cdBzbqvlYgNLEEHp9PuTxMaMwsH80+4FxPnVXTfVIdAGOTFVCB0s Jj9WmeztofWmXdh9u4LaqeaeLRtlmppKwCZ0EIYDBZ8gGVNFcnc0NEAycdBw45VIoiybH4UFFJZ1KrCZh/6gNMmN4MVMoohb+P9apHhFeVAxW0oJphdxEthe Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Add byte offsets for the fields in ext2_super_block and ext2_inode for convenience when debugging on-disk structures. Signed-off-by: Andreas Dilger --- lib/ext2fs/ext2_fs.h | 115 +++++++++++++++++++++++++-------------------------- 1 file changed, 57 insertions(+), 58 deletions(-) diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h index 7d62694..55fa78e 100644 --- a/lib/ext2fs/ext2_fs.h +++ b/lib/ext2fs/ext2_fs.h @@ -378,17 +378,17 @@ struct ext4_new_group_input { * Structure of an inode on the disk */ struct ext2_inode { - __u16 i_mode; /* File mode */ +/*00*/ __u16 i_mode; /* File mode */ __u16 i_uid; /* Low 16 bits of Owner Uid */ __u32 i_size; /* Size in bytes */ __u32 i_atime; /* Access time */ __u32 i_ctime; /* Inode change time */ - __u32 i_mtime; /* Modification time */ +/*10*/ __u32 i_mtime; /* Modification time */ __u32 i_dtime; /* Deletion Time */ __u16 i_gid; /* Low 16 bits of Group Id */ __u16 i_links_count; /* Links count */ __u32 i_blocks; /* Blocks count */ - __u32 i_flags; /* File flags */ +/*20*/ __u32 i_flags; /* File flags */ union { struct { __u32 l_i_version; /* was l_i_reserved1 */ @@ -397,11 +397,11 @@ struct ext2_inode { __u32 h_i_translator; } hurd1; } osd1; /* OS dependent 1 */ - __u32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */ - __u32 i_generation; /* File version (for NFS) */ +/*28*/ __u32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */ +/*64*/ __u32 i_generation; /* File version (for NFS) */ __u32 i_file_acl; /* File ACL */ __u32 i_size_high; - __u32 i_faddr; /* Fragment address */ +/*70*/ __u32 i_faddr; /* Fragment address */ union { struct { __u16 l_i_blocks_hi; @@ -426,17 +426,17 @@ struct ext2_inode { * Permanent part of an large inode on the disk */ struct ext2_inode_large { - __u16 i_mode; /* File mode */ +/*00*/ __u16 i_mode; /* File mode */ __u16 i_uid; /* Low 16 bits of Owner Uid */ __u32 i_size; /* Size in bytes */ __u32 i_atime; /* Access time */ __u32 i_ctime; /* Inode Change time */ - __u32 i_mtime; /* Modification time */ +/*10*/ __u32 i_mtime; /* Modification time */ __u32 i_dtime; /* Deletion Time */ __u16 i_gid; /* Low 16 bits of Group Id */ __u16 i_links_count; /* Links count */ __u32 i_blocks; /* Blocks count */ - __u32 i_flags; /* File flags */ +/*20*/ __u32 i_flags; /* File flags */ union { struct { __u32 l_i_version; /* was l_i_reserved1 */ @@ -445,11 +445,11 @@ struct ext2_inode_large { __u32 h_i_translator; } hurd1; } osd1; /* OS dependent 1 */ - __u32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */ - __u32 i_generation; /* File version (for NFS) */ +/*28*/ __u32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */ +/*64*/ __u32 i_generation; /* File version (for NFS) */ __u32 i_file_acl; /* File ACL */ __u32 i_size_high; - __u32 i_faddr; /* Fragment address */ +/*70*/ __u32 i_faddr; /* Fragment address */ union { struct { __u16 l_i_blocks_hi; @@ -468,15 +468,15 @@ struct ext2_inode_large { __u32 h_i_author; } hurd2; } osd2; /* OS dependent 2 */ - __u16 i_extra_isize; +/*80*/ __u16 i_extra_isize; __u16 i_checksum_hi; /* crc32c(uuid+inum+inode) */ __u32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */ __u32 i_mtime_extra; /* extra Modification time (nsec << 2 | epoch) */ __u32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */ - __u32 i_crtime; /* File creation time */ +/*90*/ __u32 i_crtime; /* File creation time */ __u32 i_crtime_extra; /* extra File creation time (nsec << 2 | epoch)*/ __u32 i_version_hi; /* high 32 bits for 64-bit version */ - __u32 i_projid; /* Project ID */ +/*9c*/ __u32 i_projid; /* Project ID */ }; #define EXT4_INODE_CSUM_HI_EXTRA_END \ @@ -626,30 +626,30 @@ struct ext4_encryption_key { * Structure of the super block */ struct ext2_super_block { - __u32 s_inodes_count; /* Inodes count */ +/*000*/ __u32 s_inodes_count; /* Inodes count */ __u32 s_blocks_count; /* Blocks count */ __u32 s_r_blocks_count; /* Reserved blocks count */ __u32 s_free_blocks_count; /* Free blocks count */ - __u32 s_free_inodes_count; /* Free inodes count */ +/*010*/ __u32 s_free_inodes_count; /* Free inodes count */ __u32 s_first_data_block; /* First Data Block */ __u32 s_log_block_size; /* Block size */ __u32 s_log_cluster_size; /* Allocation cluster size */ - __u32 s_blocks_per_group; /* # Blocks per group */ +/*020*/ __u32 s_blocks_per_group; /* # Blocks per group */ __u32 s_clusters_per_group; /* # Fragments per group */ __u32 s_inodes_per_group; /* # Inodes per group */ __u32 s_mtime; /* Mount time */ - __u32 s_wtime; /* Write time */ +/*030*/ __u32 s_wtime; /* Write time */ __u16 s_mnt_count; /* Mount count */ __s16 s_max_mnt_count; /* Maximal mount count */ __u16 s_magic; /* Magic signature */ __u16 s_state; /* File system state */ __u16 s_errors; /* Behaviour when detecting errors */ __u16 s_minor_rev_level; /* minor revision level */ - __u32 s_lastcheck; /* time of last check */ +/*040*/ __u32 s_lastcheck; /* time of last check */ __u32 s_checkinterval; /* max. time between checks */ __u32 s_creator_os; /* OS */ __u32 s_rev_level; /* Revision level */ - __u16 s_def_resuid; /* Default uid for reserved blocks */ +/*050*/ __u16 s_def_resuid; /* Default uid for reserved blocks */ __u16 s_def_resgid; /* Default gid for reserved blocks */ /* * These fields are for EXT2_DYNAMIC_REV superblocks only. @@ -668,12 +668,12 @@ struct ext2_super_block { __u16 s_inode_size; /* size of inode structure */ __u16 s_block_group_nr; /* block group # of this superblock */ __u32 s_feature_compat; /* compatible feature set */ - __u32 s_feature_incompat; /* incompatible feature set */ +/*060*/ __u32 s_feature_incompat; /* incompatible feature set */ __u32 s_feature_ro_compat; /* readonly-compatible feature set */ - __u8 s_uuid[16]; /* 128-bit uuid for volume */ - char s_volume_name[EXT2_LABEL_LEN]; /* volume name */ - char s_last_mounted[64]; /* directory where last mounted */ - __u32 s_algorithm_usage_bitmap; /* For compression */ +/*068*/ __u8 s_uuid[16]; /* 128-bit uuid for volume */ +/*078*/ char s_volume_name[EXT2_LABEL_LEN]; /* volume name */ +/*088*/ char s_last_mounted[64]; /* directory where last mounted */ +/*0c8*/ __u32 s_algorithm_usage_bitmap; /* For compression */ /* * Performance hints. Directory preallocation should only * happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on. @@ -684,63 +684,62 @@ struct ext2_super_block { /* * Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set. */ - __u8 s_journal_uuid[16]; /* uuid of journal superblock */ - __u32 s_journal_inum; /* inode number of journal file */ +/*0d0*/ __u8 s_journal_uuid[16]; /* uuid of journal superblock */ +/*0e0*/ __u32 s_journal_inum; /* inode number of journal file */ __u32 s_journal_dev; /* device number of journal file */ __u32 s_last_orphan; /* start of list of inodes to delete */ - __u32 s_hash_seed[4]; /* HTREE hash seed */ - __u8 s_def_hash_version; /* Default hash version to use */ - __u8 s_jnl_backup_type; /* Default type of journal backup */ +/*0ec*/ __u32 s_hash_seed[4]; /* HTREE hash seed */ +/*0fc*/ __u8 s_def_hash_version; /* Default hash version to use */ + __u8 s_jnl_backup_type; /* Default type of journal backup */ __u16 s_desc_size; /* Group desc. size: INCOMPAT_64BIT */ - __u32 s_default_mount_opts; +/*100*/ __u32 s_default_mount_opts; /* default EXT2_MOUNT_* flags used */ __u32 s_first_meta_bg; /* First metablock group */ __u32 s_mkfs_time; /* When the filesystem was created */ - __u32 s_jnl_blocks[17]; /* Backup of the journal inode */ - __u32 s_blocks_count_hi; /* Blocks count high 32bits */ +/*10c*/ __u32 s_jnl_blocks[17]; /* Backup of the journal inode */ +/*150*/ __u32 s_blocks_count_hi; /* Blocks count high 32bits */ __u32 s_r_blocks_count_hi; /* Reserved blocks count high 32 bits*/ - __u32 s_free_blocks_hi; /* Free blocks count */ + __u32 s_free_blocks_hi; /* Free blocks count */ __u16 s_min_extra_isize; /* All inodes have at least # bytes */ - __u16 s_want_extra_isize; /* New inodes should reserve # bytes */ - __u32 s_flags; /* Miscellaneous flags */ - __u16 s_raid_stride; /* RAID stride */ - __u16 s_mmp_update_interval; /* # seconds to wait in MMP checking */ - __u64 s_mmp_block; /* Block for multi-mount protection */ - __u32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/ + __u16 s_want_extra_isize; /* New inodes should reserve # bytes */ +/*160*/ __u32 s_flags; /* Miscellaneous flags */ + __u16 s_raid_stride; /* RAID stride in blocks */ + __u16 s_mmp_update_interval; /* # seconds to wait in MMP checking */ + __u64 s_mmp_block; /* Block for multi-mount protection */ +/*170*/ __u32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/ __u8 s_log_groups_per_flex; /* FLEX_BG group size */ - __u8 s_checksum_type; /* metadata checksum algorithm */ + __u8 s_checksum_type; /* metadata checksum algorithm */ __u8 s_encryption_level; /* versioning level for encryption */ __u8 s_reserved_pad; /* Padding to next 32bits */ __u64 s_kbytes_written; /* nr of lifetime kilobytes written */ - __u32 s_snapshot_inum; /* Inode number of active snapshot */ +/*180*/ __u32 s_snapshot_inum; /* Inode number of active snapshot */ __u32 s_snapshot_id; /* sequential ID of active snapshot */ - __u64 s_snapshot_r_blocks_count; /* reserved blocks for active - snapshot's future use */ - __u32 s_snapshot_list; /* inode number of the head of the on-disk snapshot list */ + __u64 s_snapshot_r_blocks_count; /* active snapshot reserved blocks */ +/*190*/ __u32 s_snapshot_list; /* inode number of disk snapshot list */ #define EXT4_S_ERR_START ext4_offsetof(struct ext2_super_block, s_error_count) __u32 s_error_count; /* number of fs errors */ __u32 s_first_error_time; /* first time an error happened */ __u32 s_first_error_ino; /* inode involved in first error */ - __u64 s_first_error_block; /* block involved of first error */ +/*1a0*/ __u64 s_first_error_block; /* block involved in first error */ __u8 s_first_error_func[32]; /* function where the error happened */ - __u32 s_first_error_line; /* line number where error happened */ +/*1c8*/ __u32 s_first_error_line; /* line number where error happened */ __u32 s_last_error_time; /* most recent time of an error */ - __u32 s_last_error_ino; /* inode involved in last error */ +/*1d0*/ __u32 s_last_error_ino; /* inode involved in last error */ __u32 s_last_error_line; /* line number where error happened */ __u64 s_last_error_block; /* block involved of last error */ - __u8 s_last_error_func[32]; /* function where the error happened */ +/*1e0*/ __u8 s_last_error_func[32]; /* function where the error happened */ #define EXT4_S_ERR_END ext4_offsetof(struct ext2_super_block, s_mount_opts) - __u8 s_mount_opts[64]; - __u32 s_usr_quota_inum; /* inode number of user quota file */ +/*200*/ __u8 s_mount_opts[64]; +/*240*/ __u32 s_usr_quota_inum; /* inode number of user quota file */ __u32 s_grp_quota_inum; /* inode number of group quota file */ __u32 s_overhead_blocks; /* overhead blocks/clusters in fs */ - __u32 s_backup_bgs[2]; /* If sparse_super2 enabled */ - __u8 s_encrypt_algos[4]; /* Encryption algorithms in use */ - __u8 s_encrypt_pw_salt[16]; /* Salt used for string2key algorithm */ - __le32 s_lpf_ino; /* Location of the lost+found inode */ +/*24c*/ __u32 s_backup_bgs[2]; /* If sparse_super2 enabled */ +/*254*/ __u8 s_encrypt_algos[4]; /* Encryption algorithms in use */ +/*258*/ __u8 s_encrypt_pw_salt[16]; /* Salt used for string2key algorithm */ +/*268*/ __le32 s_lpf_ino; /* Location of the lost+found inode */ __le32 s_prj_quota_inum; /* inode for tracking project quota */ - __le32 s_checksum_seed; /* crc32c(orig_uuid) if csum_seed set */ +/*270*/ __le32 s_checksum_seed; /* crc32c(orig_uuid) if csum_seed set */ __le32 s_reserved[98]; /* Padding to the end of the block */ - __u32 s_checksum; /* crc32c(superblock) */ +/*3fc*/ __u32 s_checksum; /* crc32c(superblock) */ }; #define EXT4_S_ERR_LEN (EXT4_S_ERR_END - EXT4_S_ERR_START) From patchwork Wed May 2 04:26:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Dilger X-Patchwork-Id: 907296 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=dilger.ca Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40bQRM5nbZz9s2k for ; Wed, 2 May 2018 14:34:39 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751127AbeEBEej (ORCPT ); Wed, 2 May 2018 00:34:39 -0400 Received: from smtp-out-so.shaw.ca ([64.59.136.137]:39492 "EHLO smtp-out-so.shaw.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751084AbeEBEef (ORCPT ); Wed, 2 May 2018 00:34:35 -0400 X-Greylist: delayed 487 seconds by postgrey-1.27 at vger.kernel.org; Wed, 02 May 2018 00:34:27 EDT Received: from cabot.adilger.int ([70.77.216.213]) by shaw.ca with ESMTP id DjLNfiF7x5wO5DjLTfV9LL; Tue, 01 May 2018 22:26:27 -0600 X-Authority-Analysis: v=2.3 cv=SJtsqtnH c=1 sm=1 tr=0 a=BQvS1EmAg2ttxjPVUuc1UQ==:117 a=BQvS1EmAg2ttxjPVUuc1UQ==:17 a=RPJ6JBhKAAAA:8 a=etEAcqNI3SESZHH4gUYA:9 a=TKMz-rzWDmoCmCUr:21 a=Yf8N2Km0uzNZHE3I:21 a=QUyov-AU4YHFE0J7:21 a=fa_un-3J20JGBB2Tu-mn:22 From: Andreas Dilger To: tytso@mit.edu Cc: linux-ext4@vger.kernel.org, Andreas Dilger Subject: [PATCH 06/10] tests: remove redundant sed filtering Date: Tue, 1 May 2018 22:26:02 -0600 Message-Id: <1525235166-6448-7-git-send-email-adilger@dilger.ca> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1525235166-6448-6-git-send-email-adilger@dilger.ca> References: <1525235166-6448-1-git-send-email-adilger@dilger.ca> <1525235166-6448-2-git-send-email-adilger@dilger.ca> <1525235166-6448-3-git-send-email-adilger@dilger.ca> <1525235166-6448-4-git-send-email-adilger@dilger.ca> <1525235166-6448-5-git-send-email-adilger@dilger.ca> <1525235166-6448-6-git-send-email-adilger@dilger.ca> X-CMAE-Envelope: MS4wfPP9nyLlcyaFa6VKFyMslLf6nPuRA9geIBmFkDz+hox7gBEpfi7uVmmhI1uCqA/i20Gg4tj67fjHI3kCQhAx8/u+v7+SUYhRqlSVUYGFTdpcq3Qbtpyt Mre3K8QOJCm9+UD99DZvlRGkU7aAL+j0zy2TZmftDtKYuyXlpXN1fgLxJ/6ZyASx5qQA0ynTX3g++KjUh9otrw6C9V7ru1DYYhev3EvJq7yZfmKpFxKRFvMO Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Now that the majority of device name filtering is in filter.sed, it does not need to be specified explicitly for every test. Fix the error message printed in debugfs when opening the device to match that used in other tools. This simplifies the filtering, and will be helpful if debugfs messages are internationalized. Signed-off-by: Andreas Dilger --- debugfs/debugfs.c | 3 ++- lib/support/plausible.c | 4 ++-- tests/d_dumpe2fs_group_only/script | 2 +- tests/d_fallocate/script | 4 ++-- tests/d_fallocate_bigalloc/script | 4 ++-- tests/d_fallocate_blkmap/script | 4 ++-- tests/d_punch/script | 4 ++-- tests/d_punch_bigalloc/script | 4 ++-- tests/f_collapse_extent_tree/script | 4 ++-- tests/f_compress_extent_tree_level/script | 4 ++-- tests/f_convert_bmap/script | 4 ++-- tests/f_convert_bmap_and_extent/script | 4 ++-- tests/f_convert_bmap_sparse/script | 4 ++-- tests/f_create_symlinks/script | 6 +++--- tests/f_detect_junk/expect | 2 +- tests/f_detect_junk/script | 2 +- tests/f_detect_xfs/expect | 2 +- tests/f_detect_xfs/script | 2 +- tests/f_extent_too_deep/script | 4 ++-- tests/f_opt_extent/script | 2 +- tests/f_opt_extent_ext3/script | 2 +- tests/f_readonly_fsck/script | 2 +- tests/f_resize_inode/script | 4 ++-- tests/filter.sed | 10 ++++++++++ tests/j_short_trans/script | 4 ++-- tests/j_short_trans_64bit/script | 4 ++-- tests/j_short_trans_mcsum_64bit/script | 4 ++-- tests/j_short_trans_old_csum/script | 4 ++-- tests/j_short_trans_open_recover/script | 4 ++-- tests/j_short_trans_recover/script | 4 ++-- tests/j_short_uncommitted_trans/script | 4 ++-- tests/j_short_uncommitted_trans_mcsum_64bit/script | 4 ++-- tests/m_devdir/script | 2 +- tests/m_hugefile/script | 2 +- tests/r_inline_xattr/script | 2 +- tests/r_min_itable/script | 2 +- tests/r_move_itable/script | 19 +++++++++---------- tests/r_move_itable_nostride/script | 6 +++--- tests/r_move_itable_realloc/script | 6 +++--- tests/r_resize_inode/script | 19 ++++++++----------- tests/run_e2fsck | 4 ++-- tests/run_mke2fs | 4 ++-- tests/t_dangerous/script | 2 +- tests/t_iexpand_full/script | 2 +- tests/t_iexpand_mcsum/script | 2 +- tests/t_replay_and_set/script | 4 ++-- tests/t_uninit_bg_rm/script | 2 +- tests/test_one.in | 2 +- 48 files changed, 103 insertions(+), 96 deletions(-) diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c index 905c8cd..8fc3b44 100644 --- a/debugfs/debugfs.c +++ b/debugfs/debugfs.c @@ -182,7 +182,8 @@ try_open_again: goto try_open_again; } if (retval) { - com_err(device, retval, "while opening filesystem"); + com_err(debug_prog_name, retval, + "while trying to open %s", device); if (retval == EXT2_ET_BAD_MAGIC) check_plausibility(device, CHECK_FS_EXIST, NULL); current_fs = NULL; diff --git a/lib/support/plausible.c b/lib/support/plausible.c index 0636061..a726898 100644 --- a/lib/support/plausible.c +++ b/lib/support/plausible.c @@ -246,8 +246,8 @@ int check_plausibility(const char *device, int flags, int *ret_is_dev) if (fs_type) { if (fs_label) - printf(_("%s contains a %s file system " - "labelled '%s'\n"), device, fs_type, fs_label); + printf(_("%s contains a %s file system labelled '%s'\n"), + device, fs_type, fs_label); else printf(_("%s contains a %s file system\n"), device, fs_type); diff --git a/tests/d_dumpe2fs_group_only/script b/tests/d_dumpe2fs_group_only/script index c3ab7e2..f0ddcdb 100644 --- a/tests/d_dumpe2fs_group_only/script +++ b/tests/d_dumpe2fs_group_only/script @@ -25,7 +25,7 @@ $MKE2FS -F -o Linux -b 4096 -O has_journal -T ext4 $TMPFILE 1048576 2>&1 | sed - $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new echo "dumpe2fs output" >> $OUT diff --git a/tests/d_fallocate/script b/tests/d_fallocate/script index b41eaaf..bb1ded2 100644 --- a/tests/d_fallocate/script +++ b/tests/d_fallocate/script @@ -29,7 +29,7 @@ rm -rf $TMPFILE.conf $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new echo "debugfs write files" >> $OUT @@ -154,7 +154,7 @@ rm -rf $OUT.new $TMPFILE.cmd $TMPFILE.cmd2 $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new rm -f $TMPFILE diff --git a/tests/d_fallocate_bigalloc/script b/tests/d_fallocate_bigalloc/script index 9c8fde8..ec79cd8 100644 --- a/tests/d_fallocate_bigalloc/script +++ b/tests/d_fallocate_bigalloc/script @@ -30,7 +30,7 @@ rm -rf $TMPFILE.conf $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new echo "debugfs write files" >> $OUT @@ -155,7 +155,7 @@ rm -rf $OUT.new $TMPFILE.cmd $TMPFILE.cmd2 $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new rm -f $TMPFILE diff --git a/tests/d_fallocate_blkmap/script b/tests/d_fallocate_blkmap/script index 86d1dee..fc262c6 100644 --- a/tests/d_fallocate_blkmap/script +++ b/tests/d_fallocate_blkmap/script @@ -29,7 +29,7 @@ rm -rf $TMPFILE.conf $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new echo "debugfs write files" >> $OUT @@ -64,7 +64,7 @@ rm -rf $OUT.new $TMPFILE.cmd $TMPFILE.cmd2 $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new rm -f $TMPFILE diff --git a/tests/d_punch/script b/tests/d_punch/script index 5bb51cd..ba7270b 100644 --- a/tests/d_punch/script +++ b/tests/d_punch/script @@ -29,7 +29,7 @@ rm -rf $TMPFILE.conf $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new echo "debugfs write files" >> $OUT @@ -108,7 +108,7 @@ rm -rf $OUT.new $TMPFILE.cmd $TMPFILE.cmd2 $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new rm -f $TMPFILE diff --git a/tests/d_punch_bigalloc/script b/tests/d_punch_bigalloc/script index 7d0c7fe..e184cd4 100644 --- a/tests/d_punch_bigalloc/script +++ b/tests/d_punch_bigalloc/script @@ -30,7 +30,7 @@ rm -rf $TMPFILE.conf $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new echo "debugfs write files" >> $OUT @@ -109,7 +109,7 @@ rm -rf $OUT.new $TMPFILE.cmd $TMPFILE.cmd2 $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new rm -f $TMPFILE diff --git a/tests/f_collapse_extent_tree/script b/tests/f_collapse_extent_tree/script index ee18438..b489200 100644 --- a/tests/f_collapse_extent_tree/script +++ b/tests/f_collapse_extent_tree/script @@ -53,7 +53,7 @@ rm -rf $TMPFILE.cmd $FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT1.new 2>&1 status=$? echo Exit status is $status >> $OUT1.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT1.new >> $OUT1 +sed -f $cmd_dir/filter.sed $OUT1.new >> $OUT1 rm -f $OUT1.new if [ "$ONE_PASS_ONLY" != "true" ]; then @@ -63,7 +63,7 @@ if [ "$ONE_PASS_ONLY" != "true" ]; then echo 'ex /a' > $TMPFILE.cmd $DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT2.new 2>&1 rm -rf $TMPFILE.cmd - sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT2.new > $OUT2 + sed -f $cmd_dir/filter.sed $OUT2.new > $OUT2 rm -f $OUT2.new fi diff --git a/tests/f_compress_extent_tree_level/script b/tests/f_compress_extent_tree_level/script index ee18438..b489200 100644 --- a/tests/f_compress_extent_tree_level/script +++ b/tests/f_compress_extent_tree_level/script @@ -53,7 +53,7 @@ rm -rf $TMPFILE.cmd $FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT1.new 2>&1 status=$? echo Exit status is $status >> $OUT1.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT1.new >> $OUT1 +sed -f $cmd_dir/filter.sed $OUT1.new >> $OUT1 rm -f $OUT1.new if [ "$ONE_PASS_ONLY" != "true" ]; then @@ -63,7 +63,7 @@ if [ "$ONE_PASS_ONLY" != "true" ]; then echo 'ex /a' > $TMPFILE.cmd $DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT2.new 2>&1 rm -rf $TMPFILE.cmd - sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT2.new > $OUT2 + sed -f $cmd_dir/filter.sed $OUT2.new > $OUT2 rm -f $OUT2.new fi diff --git a/tests/f_convert_bmap/script b/tests/f_convert_bmap/script index f6b6f62..79dd79c 100644 --- a/tests/f_convert_bmap/script +++ b/tests/f_convert_bmap/script @@ -54,7 +54,7 @@ $TUNE2FS -O extent $TMPFILE >> $OUT1.new 2>&1 $FSCK $FSCK_OPT -E bmap2extent -N test_filesys $TMPFILE >> $OUT1.new 2>&1 status=$? echo Exit status is $status >> $OUT1.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT1.new >> $OUT1 +sed -f $cmd_dir/filter.sed $OUT1.new >> $OUT1 rm -f $OUT1.new $FSCK $SECOND_FSCK_OPT -N test_filesys $TMPFILE > $OUT2.new 2>&1 @@ -63,7 +63,7 @@ echo Exit status is $status >> $OUT2.new echo 'ex /a' > $TMPFILE.cmd $DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT2.new 2>&1 rm -rf $TMPFILE.cmd -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT2.new > $OUT2 +sed -f $cmd_dir/filter.sed $OUT2.new > $OUT2 rm -f $OUT2.new eval $AFTER_CMD diff --git a/tests/f_convert_bmap_and_extent/script b/tests/f_convert_bmap_and_extent/script index 203ab25..33f177a 100644 --- a/tests/f_convert_bmap_and_extent/script +++ b/tests/f_convert_bmap_and_extent/script @@ -55,7 +55,7 @@ $TUNE2FS -O extent $TMPFILE >> $OUT1.new 2>&1 $FSCK $FSCK_OPT -E bmap2extent -N test_filesys $TMPFILE >> $OUT1.new 2>&1 status=$? echo Exit status is $status >> $OUT1.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT1.new >> $OUT1 +sed -f $cmd_dir/filter.sed $OUT1.new >> $OUT1 rm -f $OUT1.new $FSCK $SECOND_FSCK_OPT -N test_filesys $TMPFILE > $OUT2.new 2>&1 @@ -65,7 +65,7 @@ echo 'ex /a' > $TMPFILE.cmd echo 'ex /zero' >> $TMPFILE.cmd $DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT2.new 2>&1 rm -rf $TMPFILE.cmd -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT2.new > $OUT2 +sed -f $cmd_dir/filter.sed $OUT2.new > $OUT2 rm -f $OUT2.new eval $AFTER_CMD diff --git a/tests/f_convert_bmap_sparse/script b/tests/f_convert_bmap_sparse/script index 89b7ed7..4315929 100644 --- a/tests/f_convert_bmap_sparse/script +++ b/tests/f_convert_bmap_sparse/script @@ -54,7 +54,7 @@ $TUNE2FS -O extent $TMPFILE >> $OUT1.new 2>&1 $FSCK $FSCK_OPT -E bmap2extent -N test_filesys $TMPFILE >> $OUT1.new 2>&1 status=$? echo Exit status is $status >> $OUT1.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT1.new >> $OUT1 +sed -f $cmd_dir/filter.sed $OUT1.new >> $OUT1 rm -f $OUT1.new $FSCK $SECOND_FSCK_OPT -N test_filesys $TMPFILE > $OUT2.new 2>&1 @@ -63,7 +63,7 @@ echo Exit status is $status >> $OUT2.new echo 'ex /realmode.bin' > $TMPFILE.cmd $DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT2.new 2>&1 rm -rf $TMPFILE.cmd -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT2.new > $OUT2 +sed -f $cmd_dir/filter.sed $OUT2.new > $OUT2 rm -f $OUT2.new eval $AFTER_CMD diff --git a/tests/f_create_symlinks/script b/tests/f_create_symlinks/script index b7c22d3..59424a5 100644 --- a/tests/f_create_symlinks/script +++ b/tests/f_create_symlinks/script @@ -18,12 +18,12 @@ dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1 echo mke2fs -q -F -o Linux -b 1024 -g 256 -O inline_data,extents -I 256 test.img 1024 >> $OUT $MKE2FS -q -F -o Linux -b 1024 -g 256 -O inline_data,extents -I 256 $TMPFILE 1024 2>&1 | - sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" >> $OUT + sed -f $cmd_dir/filter.sed >> $OUT $FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new B="xxxxxxx"; B+=$B; B+=$B; B+=$B; B+=$B; B+=$B; B+=$B; B+=$B; B+=$B @@ -43,7 +43,7 @@ done $FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new rm -f $TMPFILE diff --git a/tests/f_detect_junk/expect b/tests/f_detect_junk/expect index 8febb84..59f34b8 100644 --- a/tests/f_detect_junk/expect +++ b/tests/f_detect_junk/expect @@ -12,7 +12,7 @@ is corrupt, and you might try running e2fsck with an alternate superblock: e2fsck -b 32768 *** debugfs -test.img: Bad magic number in super-block while opening filesystem +debugfs: Bad magic number in super-block while trying to open test.img Checksum errors in superblock! Retrying... *** tune2fs ../misc/tune2fs: Bad magic number in super-block while trying to open test.img diff --git a/tests/f_detect_junk/script b/tests/f_detect_junk/script index ab2a38c..73980d6 100644 --- a/tests/f_detect_junk/script +++ b/tests/f_detect_junk/script @@ -28,7 +28,7 @@ $TUNE2FS -i 0 $TMPFILE >> $OUT 2>&1 echo "*** mke2fs" >> $OUT $MKE2FS -n $TMPFILE >> $OUT 2>&1 -sed -f $cmd_dir/filter.sed -e "s|$TMPFILE|test.img|g" < $OUT > $OUT.new +sed -f $cmd_dir/filter.sed < $OUT > $OUT.new mv $OUT.new $OUT # Figure out what happened diff --git a/tests/f_detect_xfs/expect b/tests/f_detect_xfs/expect index d0ece6a..fb510d9 100644 --- a/tests/f_detect_xfs/expect +++ b/tests/f_detect_xfs/expect @@ -13,7 +13,7 @@ is corrupt, and you might try running e2fsck with an alternate superblock: test.img contains a xfs file system labelled 'test_filsys' *** debugfs -test.img: Bad magic number in super-block while opening filesystem +debugfs: Bad magic number in super-block while trying to open test.img Checksum errors in superblock! Retrying... test.img contains a xfs file system labelled 'test_filsys' *** tune2fs diff --git a/tests/f_detect_xfs/script b/tests/f_detect_xfs/script index 4da1cd9..abd5da8 100644 --- a/tests/f_detect_xfs/script +++ b/tests/f_detect_xfs/script @@ -23,7 +23,7 @@ $TUNE2FS -i 0 $TMPFILE >> $OUT 2>&1 echo "*** mke2fs" >> $OUT $MKE2FS -n -b 1024 $TMPFILE >> $OUT 2>&1 -sed -f $cmd_dir/filter.sed -e "s|$TMPFILE|test.img|g" < $OUT > $OUT.new +sed -f $cmd_dir/filter.sed < $OUT > $OUT.new mv $OUT.new $OUT # Figure out what happened diff --git a/tests/f_extent_too_deep/script b/tests/f_extent_too_deep/script index ee18438..b489200 100644 --- a/tests/f_extent_too_deep/script +++ b/tests/f_extent_too_deep/script @@ -53,7 +53,7 @@ rm -rf $TMPFILE.cmd $FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT1.new 2>&1 status=$? echo Exit status is $status >> $OUT1.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT1.new >> $OUT1 +sed -f $cmd_dir/filter.sed $OUT1.new >> $OUT1 rm -f $OUT1.new if [ "$ONE_PASS_ONLY" != "true" ]; then @@ -63,7 +63,7 @@ if [ "$ONE_PASS_ONLY" != "true" ]; then echo 'ex /a' > $TMPFILE.cmd $DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT2.new 2>&1 rm -rf $TMPFILE.cmd - sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT2.new > $OUT2 + sed -f $cmd_dir/filter.sed $OUT2.new > $OUT2 rm -f $OUT2.new fi diff --git a/tests/f_opt_extent/script b/tests/f_opt_extent/script index 2da5e91..f2228dc 100644 --- a/tests/f_opt_extent/script +++ b/tests/f_opt_extent/script @@ -47,7 +47,7 @@ rm $TMPFILE $OUT.before $OUT.after # Do the verification # -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" -e 's/test_filesys:.*//g' < $OUT > $OUT.new +sed -f $cmd_dir/filter.sed -e 's/test_filesys:.*//g' < $OUT > $OUT.new mv $OUT.new $OUT cmp -s $OUT $EXP diff --git a/tests/f_opt_extent_ext3/script b/tests/f_opt_extent_ext3/script index 931eae7..4dace4e 100644 --- a/tests/f_opt_extent_ext3/script +++ b/tests/f_opt_extent_ext3/script @@ -48,7 +48,7 @@ rm $TMPFILE $OUT.before $OUT.after # Do the verification # -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" -e 's/test_filesys:.*//g' < $OUT > $OUT.new +sed -f $cmd_dir/filter.sed -e 's/test_filesys:.*//g' < $OUT > $OUT.new mv $OUT.new $OUT cmp -s $OUT $EXP diff --git a/tests/f_readonly_fsck/script b/tests/f_readonly_fsck/script index d46c5a8..8e67e1f 100644 --- a/tests/f_readonly_fsck/script +++ b/tests/f_readonly_fsck/script @@ -18,7 +18,7 @@ old="$($CRCSUM < $TMPFILE)" $FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new new="$($CRCSUM < $TMPFILE)" diff --git a/tests/f_resize_inode/script b/tests/f_resize_inode/script index 0243bda..a4f1949 100644 --- a/tests/f_resize_inode/script +++ b/tests/f_resize_inode/script @@ -19,12 +19,12 @@ dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1 echo mke2fs -F -O resize_inode -o Linux -b 1024 -g 1024 test.img 16384 > $OUT $MKE2FS -F -O resize_inode -o Linux -b 1024 -g 1024 $TMPFILE 16384 2>&1 | - sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" >> $OUT + sed -f $cmd_dir/filter.sed >> $OUT $FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new echo ----------------------------------------------- >> $OUT diff --git a/tests/filter.sed b/tests/filter.sed index 628309d..f37986c 100644 --- a/tests/filter.sed +++ b/tests/filter.sed @@ -27,3 +27,13 @@ s/\\015//g s/, csum 0x\([0-9a-f]*\)//g s/ csum 0x\([0-9a-f]*\)//g /^Checksum:/d +s/while trying to open [^ ]*/while trying to open test.img/ +s/he filesystem on [^ ]* /he filesystem on test.img / +s/^[^ ]* contains a \([a-z]*\) file system /test.img contains a \1 file system / +s/MMP block [0-9]* from [^ ]*/MMP block from test.img/ +s/safe to mount '.*', MMP/safe to mount 'test.img', MMP/ +s/mmp_device_name: .*/mmp_device_name: test.img/ +s/mmp_node_name: .*/mmp_node_name: test_node/ +s/mmp_update_date: .*/mmp_update_date: test date/ +s/mmp_update_time: .*/mmp_update_time: test_time/ +s/MMP last updated by '.*' on .*/MMP last updated by 'test_node' on test date/ diff --git a/tests/j_short_trans/script b/tests/j_short_trans/script index 8108ba8..ff2322c 100644 --- a/tests/j_short_trans/script +++ b/tests/j_short_trans/script @@ -19,7 +19,7 @@ $MKE2FS -F -o Linux -b 4096 -O has_journal -T ext4 $TMPFILE 65536 2>&1 | sed -f $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new bitmaps="$($DUMPE2FS $TMPFILE 2>&1 | grep 'bitmap at' | sed -e 's/^.*bitmap at \([0-9]*\).*$/\1/g' | tr '\n' ',')" @@ -40,7 +40,7 @@ rm -rf $TMPFILE.cmd $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new rm -f $TMPFILE diff --git a/tests/j_short_trans_64bit/script b/tests/j_short_trans_64bit/script index 70649c2..b7525fb 100644 --- a/tests/j_short_trans_64bit/script +++ b/tests/j_short_trans_64bit/script @@ -19,7 +19,7 @@ $MKE2FS -F -o Linux -b 4096 -O 64bit,has_journal -T ext4 $TMPFILE 65536 2>&1 | s $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new bitmaps="$($DUMPE2FS $TMPFILE 2>&1 | grep 'bitmap at' | sed -e 's/^.*bitmap at \([0-9]*\).*$/\1/g' | tr '\n' ',')" @@ -44,7 +44,7 @@ rm -rf $TMPFILE.cmd $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new rm -f $TMPFILE diff --git a/tests/j_short_trans_mcsum_64bit/script b/tests/j_short_trans_mcsum_64bit/script index ad736eb..a8f4e93 100644 --- a/tests/j_short_trans_mcsum_64bit/script +++ b/tests/j_short_trans_mcsum_64bit/script @@ -19,7 +19,7 @@ $MKE2FS -F -o Linux -b 4096 -O 64bit,has_journal,metadata_csum -T ext4 $TMPFILE $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new bitmaps="$($DUMPE2FS $TMPFILE 2>&1 | grep 'bitmap at' | sed -e 's/^.*bitmap at \([0-9]*\).*$/\1/g' | tr '\n' ',')" @@ -44,7 +44,7 @@ rm -rf $TMPFILE.cmd $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new rm -f $TMPFILE $TMPFILE.cmd diff --git a/tests/j_short_trans_old_csum/script b/tests/j_short_trans_old_csum/script index cb13acb..46d0336 100644 --- a/tests/j_short_trans_old_csum/script +++ b/tests/j_short_trans_old_csum/script @@ -19,7 +19,7 @@ $MKE2FS -F -o Linux -b 4096 -O has_journal -T ext4 $TMPFILE 65536 2>&1 | sed -f $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new bitmaps="$($DUMPE2FS $TMPFILE 2>&1 | grep 'bitmap at' | sed -e 's/^.*bitmap at \([0-9]*\).*$/\1/g' | tr '\n' ',')" @@ -44,7 +44,7 @@ rm -rf $TMPFILE.cmd $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new rm -f $TMPFILE diff --git a/tests/j_short_trans_open_recover/script b/tests/j_short_trans_open_recover/script index fe1d9e8..b0cc790 100644 --- a/tests/j_short_trans_open_recover/script +++ b/tests/j_short_trans_open_recover/script @@ -19,7 +19,7 @@ $MKE2FS -F -o Linux -b 4096 -O has_journal -T ext4 $TMPFILE 65536 2>&1 | sed -f $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new bitmaps="$($DUMPE2FS $TMPFILE 2>&1 | grep 'bitmap at' | sed -e 's/^.*bitmap at \([0-9]*\).*$/\1/g' | tr '\n' ',')" @@ -48,7 +48,7 @@ rm -rf $OUT.new $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new rm -f $TMPFILE $TMPFILE.cmd diff --git a/tests/j_short_trans_recover/script b/tests/j_short_trans_recover/script index a44111b..ce82c87 100644 --- a/tests/j_short_trans_recover/script +++ b/tests/j_short_trans_recover/script @@ -19,7 +19,7 @@ $MKE2FS -F -o Linux -b 4096 -O has_journal -T ext4 $TMPFILE 65536 2>&1 | sed -f $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new bitmaps="$($DUMPE2FS $TMPFILE 2>&1 | grep 'bitmap at' | sed -e 's/^.*bitmap at \([0-9]*\).*$/\1/g' | tr '\n' ',')" @@ -49,7 +49,7 @@ rm -rf $OUT.new $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new rm -f $TMPFILE $TMPFILE.cmd diff --git a/tests/j_short_uncommitted_trans/script b/tests/j_short_uncommitted_trans/script index ef0548b..694d0c9 100644 --- a/tests/j_short_uncommitted_trans/script +++ b/tests/j_short_uncommitted_trans/script @@ -19,7 +19,7 @@ $MKE2FS -F -o Linux -b 4096 -O has_journal -T ext4 $TMPFILE 65536 2>&1 | sed -f $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new bitmaps="$($DUMPE2FS $TMPFILE 2>&1 | grep 'bitmap at' | sed -e 's/^.*bitmap at \([0-9]*\).*$/\1/g' | tr '\n' ',')" @@ -40,7 +40,7 @@ rm -rf $TMPFILE.cmd $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new rm -f $TMPFILE diff --git a/tests/j_short_uncommitted_trans_mcsum_64bit/script b/tests/j_short_uncommitted_trans_mcsum_64bit/script index 68965a9..87e4c27 100644 --- a/tests/j_short_uncommitted_trans_mcsum_64bit/script +++ b/tests/j_short_uncommitted_trans_mcsum_64bit/script @@ -19,7 +19,7 @@ $MKE2FS -F -o Linux -b 4096 -O 64bit,has_journal,metadata_csum -T ext4 $TMPFILE $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new bitmaps="$($DUMPE2FS $TMPFILE 2>&1 | grep 'bitmap at' | sed -e 's/^.*bitmap at \([0-9]*\).*$/\1/g' | tr '\n' ',')" @@ -44,7 +44,7 @@ rm -rf $TMPFILE.cmd $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new rm -f $TMPFILE diff --git a/tests/m_devdir/script b/tests/m_devdir/script index 3b1ef10..ef365b3 100644 --- a/tests/m_devdir/script +++ b/tests/m_devdir/script @@ -16,7 +16,7 @@ $DEBUGFS -R 'ls /' $TMPFILE >> $OUT 2>&1 $FSCK -f -n $TMPFILE >> $OUT 2>&1 fsck_status=$? -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" < $OUT > $OUT.tmp +sed -f $cmd_dir/filter.sed < $OUT > $OUT.tmp mv $OUT.tmp $OUT if [ $mkfs_status -ne 0 ]; then diff --git a/tests/m_hugefile/script b/tests/m_hugefile/script index 68d26fb..846e4c6 100644 --- a/tests/m_hugefile/script +++ b/tests/m_hugefile/script @@ -102,7 +102,7 @@ rm $TMPFILE # Do the verification # -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" -e 's/test_filesys:.*//g' < $OUT > $OUT.new +sed -f $cmd_dir/filter.sed < $OUT > $OUT.new mv $OUT.new $OUT cmp -s $OUT $EXP diff --git a/tests/r_inline_xattr/script b/tests/r_inline_xattr/script index 04baac8..7f0fb23 100644 --- a/tests/r_inline_xattr/script +++ b/tests/r_inline_xattr/script @@ -23,7 +23,7 @@ echo "resize2fs test.img 5M" >> $OUT $RESIZE2FS $TMPFILE 5M 2>&1 >> $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT # Look at inline extended attribute in resized fs echo "debugfs -R ''stat file'' test.img 2>&1 | grep ''^Inode\|in inode body\|user.name (''" >> $OUT diff --git a/tests/r_min_itable/script b/tests/r_min_itable/script index e778736..b889adc 100644 --- a/tests/r_min_itable/script +++ b/tests/r_min_itable/script @@ -22,7 +22,7 @@ echo fsck $FSCK_OPT -N test_filesys test.img >> $OUT.new $FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1 echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm $TMPFILE $OUT.new # diff --git a/tests/r_move_itable/script b/tests/r_move_itable/script index 6109f35..c017efc 100644 --- a/tests/r_move_itable/script +++ b/tests/r_move_itable/script @@ -18,16 +18,15 @@ dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1 echo mke2fs -q -F -o Linux -b 1024 -g 256 test.img 1024 > $OUT $MKE2FS -q -F -o Linux -b 1024 -g 256 $TMPFILE 1024 2>&1 | - sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" >> $OUT + sed -f $cmd_dir/filter.sed >> $OUT echo resize2fs -p test.img 10000 >> $OUT -$RESIZE2FS -p $TMPFILE 10000 2>&1 | - sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" >> $OUT +$RESIZE2FS -p $TMPFILE 10000 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT $FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new $DEBUGFS -R "set_super_value lastcheck 0" -w $TMPFILE >/dev/null 2>&1 @@ -42,12 +41,12 @@ echo "--------------------------------" >> $OUT echo resize2fs -p test.img 20000 >> $OUT $RESIZE2FS -p $TMPFILE 20000 2>&1 | - sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" >> $OUT + sed -f $cmd_dir/filter.sed >> $OUT $FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new $DEBUGFS -R "set_super_value lastcheck 0" -w $TMPFILE >/dev/null 2>&1 @@ -62,12 +61,12 @@ echo "--------------------------------" >> $OUT echo resize2fs -p test.img 30000 >> $OUT $RESIZE2FS -p $TMPFILE 30000 2>&1 | - sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" >> $OUT + sed -f $cmd_dir/filter.sed >> $OUT $FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new $DEBUGFS -R "set_super_value lastcheck 0" -w $TMPFILE >/dev/null 2>&1 @@ -82,12 +81,12 @@ echo "--------------------------------" >> $OUT echo resize2fs -p test.img 40000 >> $OUT $RESIZE2FS -p $TMPFILE 40000 2>&1 | - sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" >> $OUT + sed -f $cmd_dir/filter.sed >> $OUT $FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new $DEBUGFS -R "set_super_value lastcheck 0" -w $TMPFILE >/dev/null 2>&1 diff --git a/tests/r_move_itable_nostride/script b/tests/r_move_itable_nostride/script index d3b95b1..ec4665e 100644 --- a/tests/r_move_itable_nostride/script +++ b/tests/r_move_itable_nostride/script @@ -31,16 +31,16 @@ dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1 echo mke2fs -q -F -o Linux -b 1024 -i 1024 -E stride=8192 -t ext4 test.img 1024000 > $OUT $MKE2FS -q -F -o Linux -b 1024 -i 1024 -E stride=8192 -t ext4 \ $TMPFILE 1024000 2>&1 | - sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" >> $OUT + sed -f $cmd_dir/filter.sed >> $OUT echo resize2fs -p test.img 10240000 >> $OUT $RESIZE2FS -p $TMPFILE 100000000 2>&1 | - sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" >> $OUT + sed -f $cmd_dir/filter.sed >> $OUT $FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new $DEBUGFS -R "set_super_value lastcheck 0" -w $TMPFILE >/dev/null 2>&1 diff --git a/tests/r_move_itable_realloc/script b/tests/r_move_itable_realloc/script index 7005bf8..7d4b5ba 100644 --- a/tests/r_move_itable_realloc/script +++ b/tests/r_move_itable_realloc/script @@ -31,16 +31,16 @@ dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1 echo mke2fs -q -F -o Linux -b 1024 -i 1024 -O ^resize_inode -t ext4 test.img 1024000 > $OUT $MKE2FS -q -F -o Linux -b 1024 -i 1024 -O ^resize_inode -t ext4 \ $TMPFILE 1024000 2>&1 | - sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" >> $OUT + sed -f $cmd_dir/filter.sed >> $OUT echo resize2fs -p test.img 10240000 >> $OUT $RESIZE2FS -p $TMPFILE 100000000 2>&1 | - sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" >> $OUT + sed -f $cmd_dir/filter.sed >> $OUT $FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new $DEBUGFS -R "set_super_value lastcheck 0" -w $TMPFILE >/dev/null 2>&1 diff --git a/tests/r_resize_inode/script b/tests/r_resize_inode/script index 4e3eb19..8b586d3 100644 --- a/tests/r_resize_inode/script +++ b/tests/r_resize_inode/script @@ -15,16 +15,15 @@ dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1 echo mke2fs -q -F -O resize_inode -o Linux -b 1024 -g 1024 test.img 16384 > $OUT $MKE2FS -q -F -O resize_inode -o Linux -b 1024 -g 1024 $TMPFILE 16384 2>&1 | - sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" >> $OUT + sed -f $cmd_dir/filter.sed >> $OUT echo resize2fs test.img 65536 >> $OUT -$RESIZE2FS $TMPFILE 65536 2>&1 | - sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" >> $OUT +$RESIZE2FS $TMPFILE 65536 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT $FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new $DEBUGFS -R "set_super_value lastcheck 0" -w $TMPFILE >/dev/null 2>&1 @@ -41,16 +40,15 @@ dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1 echo mke2fs -q -F -O resize_inode -o Linux -b 1024 -g 1024 test.img 65536 >> $OUT $MKE2FS -q -F -O resize_inode -o Linux -b 1024 -g 1024 $TMPFILE 65536 2>&1 | - sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" >> $OUT + sed -f $cmd_dir/filter.sed >> $OUT echo resize2fs test.img 16384 >> $OUT -$RESIZE2FS $TMPFILE 16384 2>&1 | - sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" >> $OUT +$RESIZE2FS $TMPFILE 16384 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT $FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new $DEBUGFS -R "set_super_value lastcheck 0" -w $TMPFILE >/dev/null 2>&1 @@ -64,13 +62,12 @@ $DUMPE2FS $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed -e '/Block bitmap.*$/N;s/\n echo "--------------------------------" >> $OUT echo resize2fs test.img 165536 >> $OUT -$RESIZE2FS $TMPFILE 165536 2>&1 | - sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" >> $OUT +$RESIZE2FS $TMPFILE 165536 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT $FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new $DEBUGFS -R "set_super_value lastcheck 0" -w $TMPFILE >/dev/null 2>&1 diff --git a/tests/run_e2fsck b/tests/run_e2fsck index 5f28d92..f965179 100644 --- a/tests/run_e2fsck +++ b/tests/run_e2fsck @@ -50,14 +50,14 @@ eval $PREP_CMD $FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT1.new 2>&1 status=$? echo Exit status is $status >> $OUT1.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT1.new >> $OUT1 +sed -f $cmd_dir/filter.sed $OUT1.new >> $OUT1 rm -f $OUT1.new if [ "$ONE_PASS_ONLY" != "true" ]; then $FSCK $SECOND_FSCK_OPT -N test_filesys $TMPFILE > $OUT2.new 2>&1 status=$? echo Exit status is $status >> $OUT2.new - sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT2.new > $OUT2 + sed -f $cmd_dir/filter.sed $OUT2.new > $OUT2 rm -f $OUT2.new fi diff --git a/tests/run_mke2fs b/tests/run_mke2fs index 2a784fe..7a47f56 100644 --- a/tests/run_mke2fs +++ b/tests/run_mke2fs @@ -12,9 +12,9 @@ MKE2FS_SKIP_CHECK_MSG=true export MKE2FS_SKIP_PROGRESS MKE2FS_SKIP_CHECK_MSG > $TMPFILE PREP_CMD='$MKE2FS -F -o Linux $MKE2FS_OPTS $TMPFILE $FS_SIZE 2>&1 | - sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" > $OUT1; + sed -f $cmd_dir/filter.sed >> $OUT1; $DEBUGFS -R features $TMPFILE 2>&1 | - sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" >> $OUT1' + sed -f $cmd_dir/filter.sed >> $OUT1' AFTER_CMD='$DUMPE2FS $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT1' . $cmd_dir/run_e2fsck diff --git a/tests/t_dangerous/script b/tests/t_dangerous/script index dc70ad2..b714218 100644 --- a/tests/t_dangerous/script +++ b/tests/t_dangerous/script @@ -117,7 +117,7 @@ rm $TMPFILE $OUT.before $OUT.after $CONF # Do the verification # -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" -e 's/test_filesys:.*//g' < $OUT > $OUT.new +sed -f $cmd_dir/filter.sed -e 's/test_filesys:.*//g' < $OUT > $OUT.new mv $OUT.new $OUT cmp -s $OUT $EXP diff --git a/tests/t_iexpand_full/script b/tests/t_iexpand_full/script index 875c70e..63302c8 100644 --- a/tests/t_iexpand_full/script +++ b/tests/t_iexpand_full/script @@ -64,7 +64,7 @@ rm $TMPFILE # Do the verification # -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" -e 's/test_filesys:.*//g' < $OUT > $OUT.new +sed -f $cmd_dir/filter.sed -e 's/test_filesys:.*//g' < $OUT > $OUT.new mv $OUT.new $OUT cmp -s $OUT $EXP diff --git a/tests/t_iexpand_mcsum/script b/tests/t_iexpand_mcsum/script index 116cad9..d9cd28f 100644 --- a/tests/t_iexpand_mcsum/script +++ b/tests/t_iexpand_mcsum/script @@ -65,7 +65,7 @@ rm $TMPFILE # Do the verification # -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" -e 's/test_filesys:.*//g' < $OUT > $OUT.new +sed -f $cmd_dir/filter.sed -e 's/test_filesys:.*//g' < $OUT > $OUT.new mv $OUT.new $OUT cmp -s $OUT $EXP diff --git a/tests/t_replay_and_set/script b/tests/t_replay_and_set/script index bec9108..2663af2 100644 --- a/tests/t_replay_and_set/script +++ b/tests/t_replay_and_set/script @@ -19,7 +19,7 @@ $MKE2FS -F -o Linux -b 4096 -O has_journal,metadata_csum -T ext4 $TMPFILE 65536 $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new bitmaps="$($DUMPE2FS $TMPFILE 2>&1 | grep 'bitmap at' | sed -e 's/^.*bitmap at \([0-9]*\).*$/\1/g' | tr '\n' ',')" @@ -39,7 +39,7 @@ echo "fsck the whole mess" >> $OUT $FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 status=$? echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT +sed -f $cmd_dir/filter.sed $OUT.new >> $OUT rm -f $OUT.new rm -f $TMPFILE $TMPFILE.cmd diff --git a/tests/t_uninit_bg_rm/script b/tests/t_uninit_bg_rm/script index 308ef25..1bb0358 100644 --- a/tests/t_uninit_bg_rm/script +++ b/tests/t_uninit_bg_rm/script @@ -34,7 +34,7 @@ echo " " >> $OUT.new echo fsck $FSCK_OPT -N test_filesys test.img >> $OUT.new $FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1 -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new > $OUT +sed -f $cmd_dir/filter.sed $OUT.new > $OUT rm -f $OUT.new $TMPFILE diff --git a/tests/test_one.in b/tests/test_one.in index 664cf86..7c5f464 100644 --- a/tests/test_one.in +++ b/tests/test_one.in @@ -57,7 +57,7 @@ if [ -n "$SKIP_SLOW_TESTS" -a -f $test_dir/is_slow_test ]; then exit 0 fi -rm -f $test_name.ok $test_name.failed +rm -f $test_name.ok $test_name.failed $test_name.log $test_name.slow #echo -e -n "$test_name: $test_description:\r" TMPFILE=$(mktemp ${TMPDIR:-/tmp}/e2fsprogs-tmp-$test_name.XXXXXX) From patchwork Wed May 2 04:26:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Dilger X-Patchwork-Id: 907297 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=dilger.ca Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40bQRS4d0mz9s21 for ; Wed, 2 May 2018 14:34:44 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751063AbeEBEeo (ORCPT ); Wed, 2 May 2018 00:34:44 -0400 Received: from smtp-out-so.shaw.ca ([64.59.136.139]:39512 "EHLO smtp-out-so.shaw.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751121AbeEBEef (ORCPT ); Wed, 2 May 2018 00:34:35 -0400 Received: from cabot.adilger.int ([70.77.216.213]) by shaw.ca with ESMTP id DjLNfiF7x5wO5DjLYfV9Lx; Tue, 01 May 2018 22:26:28 -0600 X-Authority-Analysis: v=2.3 cv=SJtsqtnH c=1 sm=1 tr=0 a=BQvS1EmAg2ttxjPVUuc1UQ==:117 a=BQvS1EmAg2ttxjPVUuc1UQ==:17 a=RPJ6JBhKAAAA:8 a=le_6E12BuN8gy6MH8SAA:9 a=fa_un-3J20JGBB2Tu-mn:22 From: Andreas Dilger To: tytso@mit.edu Cc: linux-ext4@vger.kernel.org, Andreas Dilger Subject: [PATCH 08/10] tests: remove pre-generated f_extent_htree image Date: Tue, 1 May 2018 22:26:04 -0600 Message-Id: <1525235166-6448-9-git-send-email-adilger@dilger.ca> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1525235166-6448-8-git-send-email-adilger@dilger.ca> References: <1525235166-6448-1-git-send-email-adilger@dilger.ca> <1525235166-6448-2-git-send-email-adilger@dilger.ca> <1525235166-6448-3-git-send-email-adilger@dilger.ca> <1525235166-6448-4-git-send-email-adilger@dilger.ca> <1525235166-6448-5-git-send-email-adilger@dilger.ca> <1525235166-6448-6-git-send-email-adilger@dilger.ca> <1525235166-6448-7-git-send-email-adilger@dilger.ca> <1525235166-6448-8-git-send-email-adilger@dilger.ca> X-CMAE-Envelope: MS4wfMuvK0KPwFoyqdKG+I8Zg2/ljM7IHWnjfbdZOFRwE+eVYMRU+HK1AqlI9hQMo6HtvM48SVQI/RYMq7m9q62du/nm//DBxwwHPIm8MWhHCFeBCqgn12ak xSRIzx5tsAW7VwmlqgFW40YqfpOJJ88U3IMrFGPa+pzTwxdJ389azdiIP74mnFRfvwwOVY8dmcEgs7LHqf4t7zzkpEfgh6lLD/+o0fOjSv6KCtN71BpWo8Kb Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org The f_extent_htree test depends on the "mke2fs -d" functionality that did not exist in the maint branch when the patch was landed. On master this functionality exists and should be used instead of a pre-generated image. That exercises the "mke2fs -d" functionality as well as e2fsck better. Signed-off-by: Andreas Dilger --- tests/f_extent_htree/image.gz | Bin 10101 -> 0 bytes tests/f_extent_htree/script | 14 -------------- tests/f_uninit_cat/script | 2 +- 3 files changed, 1 insertion(+), 15 deletions(-) delete mode 100644 tests/f_extent_htree/image.gz diff --git a/tests/f_extent_htree/image.gz b/tests/f_extent_htree/image.gz deleted file mode 100644 index 284207efb12a04136c9f26c33f2197fed97cbd99..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10101 zcmbVRcR&-_*G2ugao1I>sGtd=t_{Tk0vd=2tZkLGA{HVFBBEd@5)3f9xS~Le*ib34 zV0egyp|$0gb{04Mb7ZIc z#y>Zn8*VmcK!NSp*|$%em@#AiF1Km%5AEmuRIn@f_K_p;$I7Au>B49mE!xDzBUci$ z9rbvHztHR9oUZh2WqP>Bgpnpii!--2jgM}-rV7+;T{mK;K}&nRtD?*pDx5&i!K~k` zT0D2|TVrTAKwseD2#=5k-sP?CJpbihbeGuQ`rSVul{=g}FGy#Xt#i)#*nw2+y$kA4 zeZzy%)1x&1K3l^*tms@h`Hf<4|Q!o%oj6N4H-83?ZX6( z%L7^1rX{?`iex@(&UoGPc8VN%a=7&ARr-$h%3_+>+n~Ourr*_L66Sb}r;2d)k!Iy-pG;kL&dc+W# z7`nt(6R5RVu}Mp4C3(m{E(POTaSuB?u0x%KYKGZ1YUn>7WaXo45=LD%Oe zTv{>OrOsHjNFN+S*j9;;AT=WN(k8?XvBzD5_&S5KycOhK{-E10T}MaCiS{wkIi=2= zP5!hg%Z+J-%VjeguGp6DyyPWPb_v)Lucc?J=f zsHO)R2#&3gR?8$x#>**zso*CWj-;wI!L~vqn?Y<#R7>}zB83d%XMr}@J`*fqt37Pf zK|x{(lB?28x8MM>%z&GVz()8nLC)QiisY+Q_z{)Hf4m&zFo?KBHEn+?a*IJMhgWc} z3n~$}B(Ve>V-W8JTEssU%#;~I;n;!gh-kbVsbLb_g+lNbgBZtFqrOoF{;pK8NoL?p zK!F-Qm(L(*<3)hNR*UR~0M47s=AaRYYBZ1vFbg?&>Hy*dTG|33c*r0;64l6_R1hjN z(BX1kIRLRhi_RB<2MhvB6iYF73Hr_fjFK5><2ErXq7>IQmef5ib%--!h4m337S~lMvgH z!C`?`Y%fHws`O|QgJ84e$Of4qWr7HN7RaP;9KdFQHg}N_g^Mv0Xt$Y*rCsp%XAa<$ zK#iVNX(ASpkwBT@K%yM+lo<*p$fXhoq|yP|8D&^5(C(IL;qH>za+)0(DP|hl5=+oH zl?JyJqPZ#qwwp>sv(=bC73g7-Ok^sGFO`Uei9f+0UL>k1L8)MfOopw11AeJsuS|>W zr4nleT8^Di3b)OGSN1~W8iP2SsOIiZ1!H7fL;|yZmqApq-0yRzG0Jg}qsL%ln6KG2&$k9p%P$4J* zbKr#44uB~$j82q-I<{IGKn0`W2i#PU%y1TBg9TU3V-R-)T5O?^R-w_P1W^f6VhQa9 z(||4#g3}PB5KOj007J7JUP0(wWDwI6)uKg&R=-51qWMt?M}d|LQQ;4P3R&VP!@*#g z!3F|7!H8MjmO!pFjR%#~%=?uaY;t?X|D1+dz6=1YX zh3xx=P8871<)GF9*b6YQ3=TkIuw+`gZz^(r6aeC`4l+u=b{+P&?At zQcxq%M$8wY_aMAeRGK<-4!Sp$HZL8#W*XppFPX$@fy{$lLZ43tyhJtTlZtrA3@ixa z5{*VGc0l0vq*4a}5n>9rVY-M6CJSV=w+`T=K#f3o7!E(qsWhBLLL`yVi_P~M4Nb^2 zlvv1V&zOYA0wI#6GDJYoR={tNa{&TvfrT8t4E!pS@iJ5zm`()l-dms***O!!g=B;x zGekoOb5$A=)I6Au(<(huq|(^T6Czht22;4+VyKw&h2Ov#XCX(+9l$4nmIv>Eo4?0K z2yaNRBnaFIa>@ayq43S&aNIr}GDp@8&NWak=f{9xJ0X&yGI-1*gEk027@d=FyvzYi z?FOe5KycC^c{f1BLaO2x94Ma}$~+;sqB3-&!BwCJ7Bba0bV|+TT)!xT6O=TDOv^ox z3L@b64V4D64}o`Ma7KT22}orSawwjA4Fn2VpA0YeQ2`I4CR3%MLy4n69X$@8vXCQH z4qzLECq!^2gTNs?ccubY8J9K`UP9WBmKnI_6od;kWGDn>0F~gu`PnMXI7s^?GK17Y z-UCsn`LPV*ra+qvc}s&x{+CI3Ldh+LACSf8RhmGEty-pG{ecv8XDa&20U0DS3}dSy z`lL{TYauwHn!@riNoJ^Et9kyZNVLpgVMu5PG#Y>~5eT&Q5N($jL}!dsy52l zH&$-qH5f^c9IxX~)%gYJ^aW`Cx=r9{MmX&rC6r{y2-MNPAd#Jyb)*j`fBIvrB%&xVZK!kGWr`pz=p*`7tCfyY&b%kgG<+AY<6Ryq>0 zxN30Is|kFTy^q;{4?d-^huZx;w6J>7oR*0lcT?i3okgw_r&>)3CtuJwnXWT`NPK%+ zGYEZ$4bBAE#;--dbh~uh4Ztb;S<$-yf);1=p7z@D$ytIn@ zVQI1W-^>1_Jk4*>cCQ-iI&wCfNk7I2eN|JVAEXs;sOL^jz>@8x%Uc^s@S&C44HnT4 z&K9H9o@(ou?R3Q+)mhzEn*<5=PmQQi-kIZKhTi85%VuUi!R+ay(W^Xmwq{QBfiuNe zOJJ3?_Z416mS#irf%Ibfm%s#T@7ugN+03M($FCZ1>S`A!AaBHryb9OT>-MPjLATU6 zOY*3^@%Q}qa}!dU_vo#IGE*jHF$YOnFBYdX-`Zprd^II4i)kTgO)ai#xfO1f`=(;9 zS7Aa>tuJGnr1f&~)u2OVjc0;t_o#Sb*(@_`)0WV-(+PEo-%5Akp?2ksuHmEo7$nI{ zuc*YJGuF!cDeKL+S5iXEBC6M1F3xDVb*9+A`Lm~2)Z?I9KUHM@`zZiK@R`_ZuOM|XEW8g`#X42>d4 z&EO6KvG^1N)Iz0uO1bCI20Cd|2w%HEMc~L)4;1V+k~D^HynfgQuyAS0lhAU!oppM~ z%#-E!3y2a-{_KJm_=fJhHegh;%G{IeFU8Gx9r@&_9{KCE`Wx_%)OP`IF2CYC z`;qU@M4p&ki=Vm)IIpO{^c$h!Sd2})`ze3&E_>6ugGOZh`M%I}fXG(x;#%p_&y(j~ zaEtE%K2Np1a$rQ9F~D(m_9s7IWtBxTB3qga-)WjG2MJ@7q+%x^Qegbq%MV)@KF7iN zT{YhypUY#Jj!sIs7*}c>xO0PwFd*x#v%c$qn#qrFG>c@b!8AMvmqHW$3*7F1f&^2> zSK_0@Sep=Y*@g3Q-cTtRH?=ohM+&<@49;IUBV^A}xn;hE6f6al!DJ_sBb}5F>h47z z35HT32a-@MvkA9ccR4=wxf;ZVlV})~r6Y8}@|4?LvvfdT`9ntVdUXS-3XmRl@g*%lHgA{l zn=HQua@Aq%#?&{rSKV;&IWHEu)Nkhe{V5$M&cEi>`uB2TDZr{CgK+~o#Su_$+$sIz zqYhl`1w4e>_H^}{*;Z+n;v8lrM8U|7ZRw4B2gsvhlYX))SYXP?vkEa20n=4v$)Kk? z)34f|^%K$zJ&=qu$$ZfXd`2bg{|#30^*+7pYsvvUl|B+%Orngr7?&k{5f?58#`L&R zeSyn0q7eA^PLy8ghp+)4pa{Kvqgqp863j8*TZj}WwE5r4J&J}p7R?S{O8+p=zlRO+d^OM~mexpeT(6-{ck}5lZ%f%C^ zu7GmRp?^S7&y#NJA+yiBlgDNPPX8>ovSe<)18`6faQayXV9ejsn?ksg_Q+trBwh=c zA_mfBfO0;s7rINKl<2|r_|l*2;j7B5k}JXTvHhY9^+HSl2OYR_U;U505h?E@6kI4( zy6qSDMZ3snc1>+RAW;Kjk*Sq$zqhI*gHM*~VBpSPD;-hp5KW(m;<{ltA^LkL8M2n7H6Ne4DT=W?mPu*TTTyx^9(lYDKX9;|)d3D*7HJ9=77 zNENVY!k^%int|+*b^8>kl56|89N7k(Fnn2(BNU0jR_ z?*f~BFT`0-scsKT-9BoOn)xWrk^K zeVfO02v5(?(m%(4f)CCd6?vRMC-#-5kUGGMk+3X7MnasGSWP*GfqTr3p(ZuR5mC=8 ziaJ3I4bbbnBRSGow_-QnZE&Ac(gEq4e+HsY#s(!kNvZ@TF0+EUG}lKsI0|1MZZW}e>UoEh-PM}Vu0?`iA$AsU?7O%>%R^GOm zGw9O2l(k-l<3Xn?8gs*|922DCHObb*3i}d2m4CjYa{~IN;%6_zgP^tLjm7znGZT_q zJ~vqtUiLe(H6Hnn(-H#1tL7x!yXUsHqA|zTc}_ygzNo`yyn77Xy5Ub5*{kr5z~5JO z!JK=kxNcwl!h~GjR`rf6a~oF5va_GC1#(}N(j0%)xIz}1{p7wX(yM;0tih`=R}h`W zq_OpTR4(RtS>p>^CAWC_KB{HHl6};92?cwpGZH-BG7p+@uc@?NQTc*#zN$;+^ozyv zy;1AT@EYa{GhD1`v?kwIP4kLM61ZkFZwr$5sD`lP{8Z=7O`#FCBPSK_wk@(w2!5?; zw=VLM&CX&L3Ox6y(#+}Siz5P~!p)@jRCZp}HL}2L=5fK4Y>f|lxu5E~IY-zy-Ijc| z*du_tD1lq4$+wPiktwn@W7)x_jgjV@vPRmzsNK*StJXlPEU*_-fVp%%VhD^1?EdjU z_m46K2VqZt+dbmlJ+i!eB&~a7w1NZnB^5wZ&7NM}J-!1mc=94o1xnx@PThBG_yX^M z=CT94r9lvUz!Abo*qm@9`;f0WjM1)NYCb;fQOgo&L}go=W~GCXZc$+RH-ik-RxFPyQ);=>Au%#B z2`r3>PWc0VFl}-i1WF4=;wHx!UQN>>ubdVeMg1!EJ*a{1r@95vfd2hl`@K|l`d)zm4g|KgpB+!fTk9Lt8ZAUtuCuqZ0_inqpK&1mt4!~Z)xgAGE zp45ZYhpc*81W3JypvuljRdy6p{tPFIg0)dJ5-5O?!fzY(!S1ijyN1c1zkbkwa!Dl|sW| zdHbL5b`557)A}SmJbb$4LT=I_c;JX$^))df!+ER-5!kj0Q1VL}Dz3u4sgS-z6)L(5 z&%lTV{o8?JmvaeL(ZzZNkX`8uYERz~jVWK^qdrgmV@lGtCxA9YLwqxHaQeA=zMGz( z3pM!X&MgNyMQWn~x%0Art^xgR3^ou}rd?@qWaxLAzq`4-R{UCsb^A~15rdOTs~V#L z#l5esfa&y?ZW|f!g8CAQJO!%w`5zBPq_~od9~y5&CT3W1)J7x#y7s<;d#*9%Ae*;9lg#p^ZENsnavHCDF>DUsZ%}}_p_U4Z7 zrL@~e@GXbC*W4Wy@aL9Kot;4GIHb%8C0*Ozajy$j^uGS}El6IU1P{SYcRQKg`b7$o ze`x2tasD(sJXo$~oqp$p2MvYH-_0rdv7r+iz1PFo)x*?Gy;C~xqXC)L-?yp?BSyqq zL%;H89rFI98u&=u`k^8;qG8F5_%L5`;}*Hk?CySUcK_IZ(l%I*$~&e2gCeB*-?~@X z-`H|-Z?j8fRJWtT7p~z@#&DO7QMzA#;9(l};Fy)n5m27UE%#eO#CpW1_S(>%D9#B$ z?TGuVyS>ocLw_L2B>9U)c6*o@Jhj2u$tmn3QiuH1fkGBKha zM&z#1+aG%P6@!wlcTW*LqMuY6B)C$@qCKO!ty}49YedfVxAM+Be64#-G4$P=sXlwQjxPywcJ>4Q1+%dH^c zXzAc`*X_T$Z-&p3od{0fc|n8`VM|3Uv7^H|f_7@QRdx#~>&stLF0@Blq~li-=76M9k@MX0XOo*cA4TZ9Uc^oOWxfti*qr2xO?qw6xf)gM<`z#qn}*zOVFjH;6G@Y*>yK zT#6jBL&iD*$-Tb6khc>czOmwCS^7**&{j}&1HXIO4&W`py~kX7Y6M4F1US1L z(C7B|jPLP$MFYAMo&i~hEP&Mz9@_SuD^)2PHYCX|#yPBVyL)##Kwl}a*ggcpnDJBv zSheGLD7BkbSs5JwW$MV@64G;&YxI6NBV-XQhBucsEr*16?H@3GL;Rwsh=r!>?#x&a zOQ6eoy(rYd0BA)cuYE8^kGP|+)kDs{I09SZ|4y@EoqmtGCzVcx7>Pf*f(~oL)qXUD zScC1JQ@QK88&={sfaLQ-8Ad(Vx-EkZ^Kz@1@R;m>{Xk3Yu@)a;7%K_s4qeepTpIhj z7kbS=9f?M)^qm2>!dTZd2A;MkzKgmRo~Z0aBZk3dVzb-aCb*!r{XhxN-{64<17&x^{s^11F%mXfGY)Umueo4%Zmk#9oxb&_EWeymzE|M`!G>%miH(&t zrr8zI@%*zp?rA6d^6i8~NBW9oK9r)^%mS=%|K#mp!_RJ~K58j0uhg{fM|Q>{kTE_1 zo;Go>+%_Uh0p+JY^VhRj){rSlIk4Yx(>HJ<3I8n}ZKS1xlCJ7#5p+>xS?$J6Einac zYablS?Yv*ha>*eMv@E(C`Qms!cS-o4FMiLbzuCX@dQKQsf6XfHjUa^Q;o!6_C?JuF<>q8PsIzzzL?Xk9S>q4J*hj-1Zllv2vUw#O;?fGGTV z&Z1DHfzq%)FHgzQW|j@#)*KVJ=FmIFY6)Ioe4dv3#^}Lc8^q61=3Z3Q&#h~YS%3ZC z1COht?{ujpTc04jy7I?!!lmK$uNn{KgRsx-2U!x)gs^1+BwUVF=4M?_;gCEZ2j0}X zob7raI$Z(|g%^s2`SgE?yV2Veg!VidjHOR|%P%4Hxs}E@F>R*rs*Mq5=)n&``P>}! z5>igJ@$_a7N>+g~L&$8M7f~pAvq$yus8X88+)u(g7Y1+7%8DhnoEe)FI7yc2VgB{~ z`AHJLnH8o*&F{`A@%Js4h06JM9Q3P~Kd!jzXcMkj&rmbmm~VJtsHfDzBPc_EKB6W} z;)=IPnUCwz^U(t@l^NJgy?bS~Q&)}gi+dn9kE6sud;UVa+9*!=y<RE0q;eW!4jCtml7Ebvo#k-++k}0o^SVR0dNDa|+7rKi#Z5{Dd*weBsAmarvc1AG#JwRHJeWuV*Y# zCI>sJtnHPaXue{?Ya9RDqN+)?9P`+L7Cxjz(iL~39Ojh*KQHIQ%Wou$9V zL_E?vRt6BP-SynyT)y*o#VOhEo=8-h{*MK_h110ff=^nE9FEn?*Iv@Ucd(~%CTfb= zO8N8nuVpD=NJZ8&x}=rRI$tl!E3RNAm<Qwo`A&NNZ+JkCl z>1`}1LOrUmT{0=3%lGZLwnW06PA>GlR)!1xS1Utg(IKsGRt6Ob*Cb0G=*@-=-{Sm! z5_h+UMn(3_UCq_~E3wG~FK&)idjDJPQS{`EWV&Oa{3R`qHFZgJ?cq*i)T96XKmLw; S1hD`^CoQ(LFj+Co> $OUT | awk '/yyyyy/ { print "rm '$SUB'/"$4 }' > $DELETE_LIST $DEBUGFS -w -f $DELETE_LIST $TMPFILE >> $OUT 2>&1 rm $DELETE_LIST -cp $TMPFILE $TMPFILE.sav . $cmd_dir/run_e2fsck diff --git a/tests/f_uninit_cat/script b/tests/f_uninit_cat/script index f2443fa..31a1988 100755 --- a/tests/f_uninit_cat/script +++ b/tests/f_uninit_cat/script @@ -14,7 +14,7 @@ gzip -d < $IMAGE > $TMPFILE EXP=$test_dir/expect OUT=$test_name.log -$FSCK $FSCK_OPT -N test_filesys $TMPFILE 2>&1 > $OUT.new +$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1 echo "Exit status is $?" >> $OUT.new echo "debugfs cat uninit file" >> $OUT.new From patchwork Wed May 2 04:26:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Dilger X-Patchwork-Id: 907298 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=dilger.ca Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40bQRV57NJz9s21 for ; Wed, 2 May 2018 14:34:46 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751079AbeEBEeq (ORCPT ); Wed, 2 May 2018 00:34:46 -0400 Received: from smtp-out-so.shaw.ca ([64.59.136.139]:39488 "EHLO smtp-out-so.shaw.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751025AbeEBEeg (ORCPT ); Wed, 2 May 2018 00:34:36 -0400 Received: from cabot.adilger.int ([70.77.216.213]) by shaw.ca with ESMTP id DjLNfiF7x5wO5DjLYfV9M2; Tue, 01 May 2018 22:26:28 -0600 X-Authority-Analysis: v=2.3 cv=SJtsqtnH c=1 sm=1 tr=0 a=BQvS1EmAg2ttxjPVUuc1UQ==:117 a=BQvS1EmAg2ttxjPVUuc1UQ==:17 a=VwQbUJbxAAAA:8 a=RPJ6JBhKAAAA:8 a=iXcJ4diVBN7PhL8Ygc4A:9 a=AjGcO6oz07-iQ99wixmX:22 a=fa_un-3J20JGBB2Tu-mn:22 From: Andreas Dilger To: tytso@mit.edu Cc: linux-ext4@vger.kernel.org, Andreas Dilger Subject: [PATCH 09/10] e2fsck: set dir_nlink feature if large dir exists Date: Tue, 1 May 2018 22:26:05 -0600 Message-Id: <1525235166-6448-10-git-send-email-adilger@dilger.ca> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1525235166-6448-9-git-send-email-adilger@dilger.ca> References: <1525235166-6448-1-git-send-email-adilger@dilger.ca> <1525235166-6448-2-git-send-email-adilger@dilger.ca> <1525235166-6448-3-git-send-email-adilger@dilger.ca> <1525235166-6448-4-git-send-email-adilger@dilger.ca> <1525235166-6448-5-git-send-email-adilger@dilger.ca> <1525235166-6448-6-git-send-email-adilger@dilger.ca> <1525235166-6448-7-git-send-email-adilger@dilger.ca> <1525235166-6448-8-git-send-email-adilger@dilger.ca> <1525235166-6448-9-git-send-email-adilger@dilger.ca> X-CMAE-Envelope: MS4wfMuvK0KPwFoyqdKG+I8Zg2/ljM7IHWnjfbdZOFRwE+eVYMRU+HK1AqlI9hQMo6HtvM48SVQI/RYMq7m9q62du/nm//DBxwwHPIm8MWhHCFeBCqgn12ak xSRIzx5tsAW7VwmlqgFW40YqfpOJJ88U3IMrFGPa+pzTwxdJ389azdiIP74mnFRfvwwOVY8dmcEgs7LHqf4t7zzkpEfgh6lLD/+o0fOjSv6KCtN71BpWo8Kb Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org If there is a directory with more than EXT2_LINK_MAX (65000) subdirectories, but the DIR_NLINK feature is not set in the superblock, the feature should be set before continuing on to change the on-disk directory link count to 1. While most filesystems should have DIR_NLINK set (it was set by default for all ext4 filesystems, and all kernels between 2.6.23 and 4.12 automatically set it if the directory link count grew too large), it is possible that this flag is lost due to disk corruption or for an upgraded filesystem. We no longer want kernels to automatically enable features. Addresses: https://bugzilla.kernel.org/show_bug.cgi?id=196405 Signed-off-by: Andreas Dilger --- e2fsck/pass4.c | 12 ++++++++- e2fsck/problem.c | 5 ++++ e2fsck/problem.h | 3 +++ tests/f_large_dir/expect | 15 +++++++++-- tests/f_large_dir/script | 67 ++++++++++++++++++++++++++++++++---------------- 5 files changed, 77 insertions(+), 25 deletions(-) diff --git a/e2fsck/pass4.c b/e2fsck/pass4.c index 9a491b1..10be7f8 100644 --- a/e2fsck/pass4.c +++ b/e2fsck/pass4.c @@ -145,6 +145,7 @@ void e2fsck_pass4(e2fsck_t ctx) #endif struct problem_context pctx; __u16 link_count, link_counted; + int dir_nlink_fs; char *buf = 0; dgrp_t group, maxgroup; @@ -168,6 +169,8 @@ void e2fsck_pass4(e2fsck_t ctx) if (!(ctx->options & E2F_OPT_PREEN)) fix_problem(ctx, PR_4_PASS_HEADER, &pctx); + dir_nlink_fs = ext2fs_has_feature_dir_nlink(fs->super); + group = 0; maxgroup = fs->group_desc_count; if (ctx->progress) @@ -224,8 +227,15 @@ void e2fsck_pass4(e2fsck_t ctx) &link_counted); } isdir = ext2fs_test_inode_bitmap2(ctx->inode_dir_map, i); - if (isdir && (link_counted > EXT2_LINK_MAX)) + if (isdir && (link_counted > EXT2_LINK_MAX)) { + if (!dir_nlink_fs && + fix_problem(ctx, PR_4_DIR_NLINK_FEATURE, &pctx)) { + ext2fs_set_feature_dir_nlink(fs->super); + ext2fs_mark_super_dirty(fs); + dir_nlink_fs = 1; + } link_counted = 1; + } if (link_counted != link_count) { e2fsck_read_inode_full(ctx, i, EXT2_INODE(inode), inode_size, "pass4"); diff --git a/e2fsck/problem.c b/e2fsck/problem.c index edc9d51..ff289b4 100644 --- a/e2fsck/problem.c +++ b/e2fsck/problem.c @@ -1878,6 +1878,11 @@ static struct e2fsck_problem problem_table[] = { N_("@a @i %i ref count is %N, @s %n. "), PROMPT_FIX, PR_PREEN_OK }, + /* directory exceeds max links, but no DIR_NLINK feature in superblock*/ + { PR_4_DIR_NLINK_FEATURE, + N_("@d exceeds max links, but no DIR_NLINK feature in @S.\n"), + PROMPT_FIX, 0 }, + /* Pass 5 errors */ /* Pass 5: Checking group summary information */ diff --git a/e2fsck/problem.h b/e2fsck/problem.h index 482d111..96e04bb 100644 --- a/e2fsck/problem.h +++ b/e2fsck/problem.h @@ -1137,6 +1137,9 @@ struct problem_context { /* Extended attribute inode ref count wrong */ #define PR_4_EA_INODE_REF_COUNT 0x040005 +/* directory exceeds max links, but no DIR_NLINK feature in superblock */ +#define PR_4_DIR_NLINK_FEATURE 0x040006 + /* * Pass 5 errors */ diff --git a/tests/f_large_dir/expect b/tests/f_large_dir/expect index b099460..8f7d99d 100644 --- a/tests/f_large_dir/expect +++ b/tests/f_large_dir/expect @@ -1,12 +1,23 @@ +Creating filesystem with 108341 1k blocks and 65072 inodes +Superblock backups stored on blocks: + 8193, 24577, 40961, 57345, 73729 + +Allocating group tables: done +Writing inode tables: done +Writing superblocks and filesystem accounting information: done + Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 3A: Optimizing directories Pass 4: Checking reference counts -Inode 13 ref count is 1, should be 47245. Fix? yes +Directory exceeds max links, but no DIR_NLINK feature in superblock. +Fix? yes + +Inode 12 ref count is 65012, should be 1. Fix? yes Pass 5: Checking group summary information test.img: ***** FILE SYSTEM WAS MODIFIED ***** -test.img: 13/115368 files (0.0% non-contiguous), 32817/460800 blocks +test.img: 65023/65072 files (0.0% non-contiguous), 96666/108341 blocks Exit status is 1 diff --git a/tests/f_large_dir/script b/tests/f_large_dir/script index e315181..9af042c 100644 --- a/tests/f_large_dir/script +++ b/tests/f_large_dir/script @@ -5,42 +5,65 @@ E2FSCK=../e2fsck/e2fsck NAMELEN=255 DIRENT_SZ=8 BLOCKSZ=1024 +INODESZ=128 DIRENT_PER_LEAF=$((BLOCKSZ / (NAMELEN + DIRENT_SZ))) HEADER=32 INDEX_SZ=8 INDEX_L1=$(((BLOCKSZ - HEADER) / INDEX_SZ)) INDEX_L2=$(((BLOCKSZ - DIRENT_SZ) / INDEX_SZ)) -ENTRIES=$((INDEX_L1 * INDEX_L2 * DIRENT_PER_LEAF)) +DIRBLK=$((2 + INDEX_L1 * INDEX_L2)) +ENTRIES=$((DIRBLK * DIRENT_PER_LEAF)) +EXT4_LINK_MAX=65000 +if [ $ENTRIES -lt $((EXT4_LINK_MAX + 10)) ]; then + ENTRIES=$((EXT4_LINK_MAX + 10)) + DIRBLK=$((ENTRIES / DIRENT_PER_LEAF + 3)) +fi +# directory leaf blocks plus inode count and 25% for the rest of the fs +FSIZE=$(((DIRBLK + EXT4_LINK_MAX * ((BLOCKSZ + INODESZ) / BLOCKSZ)) * 5 / 4)) -$MKE2FS -b 1024 -O large_dir,uninit_bg,dir_nlink -F $TMPFILE 460800 \ - > /dev/null 2>&1 +$MKE2FS -b 1024 -O large_dir,uninit_bg -N $((ENTRIES + 50)) \ + -I $INODESZ -F $TMPFILE $FSIZE > $OUT.new 2>&1 +RC=$? +if [ $RC -eq 0 ]; then { - echo "feature large_dir" + START=$SECONDS echo "mkdir /foo" echo "cd /foo" - touch foofile - echo "write foofile foofile" + touch $TMPFILE.tmp + echo "write $TMPFILE.tmp foofile" i=0 - while test $i -lt $ENTRIES ; do - if test $(( i % DIRENT_PER_LEAF )) -eq 0 ; then - echo "expand ./" + last=0 + while test $i -lt $ENTRIES ; do + if test $((i % DIRENT_PER_LEAF)) -eq 0; then + echo "expand ./" fi - if test $(( i % 5000 )) -eq 0 -a $i -gt 0 ; then - >&2 echo "$test_name: $i/$ENTRIES processed" + ELAPSED=$((SECONDS - START)) + if test $((i % 5000)) -eq 0 -a $ELAPSED -gt 10; then + RATE=$(((i - last) / ELAPSED)) + echo "$test_name: $i/$ENTRIES links, ${ELAPSED}s @ $RATE/s" >&2 + START=$SECONDS + last=$i fi - printf "ln foofile %0255X\n" $i - i=$(($i + 1)) + if test $i -lt $((EXT4_LINK_MAX + 10)); then + printf "mkdir d%0254u\n" $i + else + printf "ln foofile f%0254u\n" $i + fi + i=$((i + 1)) done -} | $DEBUGFS -w $TMPFILE > /dev/null 2>&1 - -$E2FSCK -yfD $TMPFILE > $OUT.new 2>&1 -status=$? -echo Exit status is $status >> $OUT.new -sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new > $OUT -rm -f $OUT.new +} | $DEBUGFS -w $TMPFILE > /dev/null 2>> $OUT.new + RC=$? +fi +if [ $RC -eq 0 ]; then + $E2FSCK -yfD $TMPFILE >> $OUT.new 2>&1 + status=$? + echo Exit status is $status >> $OUT.new + sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new > $OUT + rm -f $OUT.new -cmp -s $OUT $EXP -RC=$? + cmp -s $OUT $EXP + RC=$? +fi if [ $RC -eq 0 ]; then echo "$test_name: $test_description: ok" touch $test_name.ok From patchwork Wed May 2 04:26:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Dilger X-Patchwork-Id: 907299 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=dilger.ca Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40bQRX3mG9z9s21 for ; Wed, 2 May 2018 14:34:48 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751133AbeEBEer (ORCPT ); Wed, 2 May 2018 00:34:47 -0400 Received: from smtp-out-so.shaw.ca ([64.59.136.137]:39492 "EHLO smtp-out-so.shaw.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750849AbeEBEej (ORCPT ); Wed, 2 May 2018 00:34:39 -0400 X-Greylist: delayed 487 seconds by postgrey-1.27 at vger.kernel.org; Wed, 02 May 2018 00:34:27 EDT Received: from cabot.adilger.int ([70.77.216.213]) by shaw.ca with ESMTP id DjLNfiF7x5wO5DjLZfV9M6; Tue, 01 May 2018 22:26:31 -0600 X-Authority-Analysis: v=2.3 cv=SJtsqtnH c=1 sm=1 tr=0 a=BQvS1EmAg2ttxjPVUuc1UQ==:117 a=BQvS1EmAg2ttxjPVUuc1UQ==:17 a=lB0dNpNiAAAA:8 a=RPJ6JBhKAAAA:8 a=FP58Ms26AAAA:8 a=SACpksVIAVkj1QJjovgA:9 a=4pHvesqWVZzIespw:21 a=4b8hItTDAhnjBMOs:21 a=DfxFEbPxxEHzGJS6:21 a=c-ZiYqmG3AbHTdtsH08C:22 a=fa_un-3J20JGBB2Tu-mn:22 From: Andreas Dilger To: tytso@mit.edu Cc: linux-ext4@vger.kernel.org, Shuichi Ihara , Li Xi , Wang Shilong , Andreas Dilger Subject: [PATCH 10/10] misc: add e2mmpstatus utility via debugfs Date: Tue, 1 May 2018 22:26:06 -0600 Message-Id: <1525235166-6448-11-git-send-email-adilger@dilger.ca> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1525235166-6448-10-git-send-email-adilger@dilger.ca> References: <1525235166-6448-1-git-send-email-adilger@dilger.ca> <1525235166-6448-2-git-send-email-adilger@dilger.ca> <1525235166-6448-3-git-send-email-adilger@dilger.ca> <1525235166-6448-4-git-send-email-adilger@dilger.ca> <1525235166-6448-5-git-send-email-adilger@dilger.ca> <1525235166-6448-6-git-send-email-adilger@dilger.ca> <1525235166-6448-7-git-send-email-adilger@dilger.ca> <1525235166-6448-8-git-send-email-adilger@dilger.ca> <1525235166-6448-9-git-send-email-adilger@dilger.ca> <1525235166-6448-10-git-send-email-adilger@dilger.ca> X-CMAE-Envelope: MS4wfGZibF7fBgNW+GQVGPNTib4f3P2Ax/WyRD5cMzXbRM7q71Taj2fLF0Jw8Lb8Yf9ZVUa+tjCzQAJztwtKyVPehdfjJLO60/rbqDZOmikh5SE5p9YU9n2E qx8kLu+pLMESpSeFMhFKWz2vBkTx2+LQ69aaEnjJCkjm2iMnUK5flr1drmH/apw8PeskGsv0WzwvL6xoo0HNsBLX9k/JsC4YILKQEq4DuMzU/XyP/SWs7hSY hy3Q9gOnB1KZFo1cUl7jXs6Jmecv+pJ7f1rkVGoIvkG3m7KY+gFwiwaDOqkazRhACpSdXGGDu7vdDWI5nDbjmw== Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Shuichi Ihara e2mmpstatus is a Multi-Mount Protection (MMP) helper utility to read an MMP block to see if it is being updated. It can also output the latest update time, nodename, and device from the MMP block. This is useful for HA and other maintenance scripts to determine if the filesystem is in use on another node, and which node it is. Signed-off-by: Shuichi Ihara Signed-off-by: Li Xi Signed-off-by: Wang Shilong Moved e2mmpstatus checking/dumping code to be part of dumpe2fs rather than a standalone program, using the "-m" option to check MMP status, and "-i" to dump info. If dumpe2fs is called as "e2mmpstatus" (and also "mmpstatus" for compatibility reasons), assume "-m" is specified. Re-use the existing MMP block handing routines (with some changes) to check and dump the MMP block, rather than adding duplicate versions. Modify dumpe2fs to exit with a non-zero error code if there is an error while reading the filesystem metadata or MMP block, or if "-m" is used with the "mmp" feature and is in use by another node. Add a configure check for gethostname() rather than depending on _BSD_SOURCE or _XOPEN_SOURCE to be set. Update the f_mmp, m_mmp, m_mmp_bad_csum, and m_mmp_bad_magic tests to use e2mmpstatus to check and dump the MMP state before and after e2fsck is run to verify that the tool is working correctly. Signed-off-by: Andreas Dilger Reviewed-by: Lukas Czerner --- .gitignore | 2 + configure | 2 +- configure.ac | 1 + e2fsck/e2fsck.h | 2 +- e2fsck/problem.c | 2 +- e2fsck/unix.c | 3 +- e2fsck/util.c | 22 +++-- e2fsprogs.spec.in | 2 + lib/config.h.in | 15 +++- lib/ext2fs/ext2_err.et.in | 4 +- lib/ext2fs/mmp.c | 12 ++- misc/Makefile.in | 11 ++- misc/dumpe2fs.8.in | 22 ++++- misc/dumpe2fs.c | 202 ++++++++++++++++++++++++++++++++++--------- misc/e2mmpstatus.8.in | 59 +++++++++++++ tests/f_mmp/script | 7 ++ tests/m_mmp/expect.1 | 8 ++ tests/m_mmp_bad_csum/expect | 16 +++- tests/m_mmp_bad_csum/script | 9 +- tests/m_mmp_bad_magic/expect | 13 +++ tests/m_mmp_bad_magic/script | 9 +- tests/test_config | 1 + 22 files changed, 360 insertions(+), 64 deletions(-) create mode 100644 misc/e2mmpstatus.8.in diff --git a/.gitignore b/.gitignore index ac5c2c1..3352ccc 100644 --- a/.gitignore +++ b/.gitignore @@ -170,6 +170,8 @@ misc/e2image misc/e2image.8 misc/e2initrd_helper misc/e2label.8 +misc/e2mmpstatus +misc/e2mmpstatus.8 misc/e2undo misc/e2undo.8 misc/e4crypt diff --git a/configure b/configure index b2701d2..c7853d1 100755 --- a/configure +++ b/configure @@ -13097,7 +13097,7 @@ fi if test -n "$DLOPEN_LIB" ; then ac_cv_func_dlopen=yes fi -for ac_func in __secure_getenv add_key backtrace blkid_probe_get_topology blkid_probe_enable_partitions chflags dlopen fadvise64 fallocate fallocate64 fchown fcntl fdatasync fstat64 fsync ftruncate64 futimes getcwd getdtablesize getmntinfo getpwuid_r getrlimit getrusage jrand48 keyctl llistxattr llseek lseek64 mallinfo mbstowcs memalign mempcpy mmap msync nanosleep open64 pathconf posix_fadvise posix_fadvise64 posix_memalign prctl pread pwrite pread64 pwrite64 secure_getenv setmntent setresgid setresuid snprintf srandom stpcpy strcasecmp strdup strnlen strptime strtoull sync_file_range sysconf usleep utime utimes valloc +for ac_func in __secure_getenv add_key backtrace blkid_probe_get_topology blkid_probe_enable_partitions chflags dlopen fadvise64 fallocate fallocate64 fchown fcntl fdatasync fstat64 fsync ftruncate64 futimes getcwd getdtablesize gethostname getmntinfo getpwuid_r getrlimit getrusage jrand48 keyctl llistxattr llseek lseek64 mallinfo mbstowcs memalign mempcpy mmap msync nanosleep open64 pathconf posix_fadvise posix_fadvise64 posix_memalign prctl pread pwrite pread64 pwrite64 secure_getenv setmntent setresgid setresuid snprintf srandom stpcpy strcasecmp strdup strnlen strptime strtoull sync_file_range sysconf usleep utime utimes valloc do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" diff --git a/configure.ac b/configure.ac index 7392959..5e837c9 100644 --- a/configure.ac +++ b/configure.ac @@ -1124,6 +1124,7 @@ AC_CHECK_FUNCS(m4_flatten([ futimes getcwd getdtablesize + gethostname getmntinfo getpwuid_r getrlimit diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h index 5269650..d151bfd 100644 --- a/e2fsck/e2fsck.h +++ b/e2fsck/e2fsck.h @@ -634,7 +634,7 @@ extern blk64_t get_backup_sb(e2fsck_t ctx, ext2_filsys fs, const char *name, io_manager manager); extern int ext2_file_type(unsigned int mode); extern int write_all(int fd, char *buf, size_t count); -void dump_mmp_msg(struct mmp_struct *mmp, const char *msg); +void dump_mmp_msg(struct mmp_struct *mmp, const char *fmt, ...); errcode_t e2fsck_mmp_update(ext2_filsys fs); extern void e2fsck_set_bitmap_type(ext2_filsys fs, diff --git a/e2fsck/problem.c b/e2fsck/problem.c index ff289b4..be79fdb 100644 --- a/e2fsck/problem.c +++ b/e2fsck/problem.c @@ -450,7 +450,7 @@ static struct e2fsck_problem problem_table[] = { /* Superblock MMP block checksum does not match MMP block. */ { PR_0_MMP_CSUM_INVALID, - N_("@S MMP @b checksum does not match MMP @b. "), + N_("@S MMP @b checksum does not match. "), PROMPT_FIX, PR_PREEN_OK | PR_NO_OK}, /* Superblock 64bit filesystem needs extents to access the whole disk */ diff --git a/e2fsck/unix.c b/e2fsck/unix.c index cbe5ec5..beeaed2 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -1250,7 +1250,8 @@ check_error: dump_mmp_msg(fs->mmp_buf, _("If you are sure the filesystem is not " "in use on any node, run:\n" - "'tune2fs -f -E clear_mmp {device}'\n")); + "'tune2fs -f -E clear_mmp %s'\n"), + ctx->device_name); } else if (retval == EXT2_ET_MMP_MAGIC_INVALID) { if (fix_problem(ctx, PR_0_MMP_INVALID_MAGIC, &pctx)) { ext2fs_mmp_clear(fs); diff --git a/e2fsck/util.c b/e2fsck/util.c index ed94702..5793b65 100644 --- a/e2fsck/util.c +++ b/e2fsck/util.c @@ -756,16 +756,28 @@ int write_all(int fd, char *buf, size_t count) return c; } -void dump_mmp_msg(struct mmp_struct *mmp, const char *msg) +void dump_mmp_msg(struct mmp_struct *mmp, const char *fmt, ...) { + va_list pvar; - if (msg) - printf("MMP check failed: %s\n", msg); + if (fmt) { + printf("MMP check failed: "); + va_start(pvar, fmt); + vprintf(fmt, pvar); + va_end(pvar); + } if (mmp) { time_t t = mmp->mmp_time; - printf("MMP error info: last update: %s node: %s device: %s\n", - ctime(&t), mmp->mmp_nodename, mmp->mmp_bdevname); + printf("MMP_block:\n"); + printf(" mmp_magic: 0x%x\n", mmp->mmp_magic); + printf(" mmp_check_interval: %d\n", + mmp->mmp_check_interval); + printf(" mmp_sequence: %08x\n", mmp->mmp_seq); + printf(" mmp_update_date: %s", ctime(&t)); + printf(" mmp_update_time: %lld\n", mmp->mmp_time); + printf(" mmp_node_name: %s\n", mmp->mmp_nodename); + printf(" mmp_device_name: %s\n", mmp->mmp_bdevname); } } diff --git a/e2fsprogs.spec.in b/e2fsprogs.spec.in index b188b75..f42c4be 100644 --- a/e2fsprogs.spec.in +++ b/e2fsprogs.spec.in @@ -116,6 +116,7 @@ exit 0 %{_root_sbindir}/e2fsck %{_root_sbindir}/e2image %{_root_sbindir}/e2label +%{_root_sbindir}/e2mmpstatus %{_root_sbindir}/e2undo %{_root_sbindir}/findfs %{_root_sbindir}/fsck @@ -167,6 +168,7 @@ exit 0 %{_mandir}/man8/fsck.ext4dev.8* %{_mandir}/man8/e2image.8* %{_mandir}/man8/e2label.8* +%{_mandir}/man8/e2mmpstatus.8* %{_mandir}/man8/e2undo.8* %{_mandir}/man8/fsck.8* %{_mandir}/man8/logsave.8* diff --git a/lib/config.h.in b/lib/config.h.in index 9cc0793..67a0548 100644 --- a/lib/config.h.in +++ b/lib/config.h.in @@ -147,6 +147,9 @@ /* Define to 1 if you have the `fchown' function. */ #undef HAVE_FCHOWN +/* Define to 1 if you have the `fcntl' function. */ +#undef HAVE_FCNTL + /* Define to 1 if you have the `fdatasync' function. */ #undef HAVE_FDATASYNC @@ -156,6 +159,9 @@ /* Define to 1 if you have the `fstat64' function. */ #undef HAVE_FSTAT64 +/* Define to 1 if you have the `fsync' function. */ +#undef HAVE_FSYNC + /* Define to 1 if you have the `ftruncate64' function. */ #undef HAVE_FTRUNCATE64 @@ -183,6 +189,9 @@ /* Define to 1 if you have the `getgid' function. */ #undef HAVE_GETGID +/* Define to 1 if you have the `gethostname' function. */ +#undef HAVE_GETHOSTNAME + /* Define to 1 if you have the `getmntinfo' function. */ #undef HAVE_GETMNTINFO @@ -253,6 +262,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_MAJOR_H +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_TYPES_H + /* Define to 1 if you have the `llistxattr' function. */ #undef HAVE_LLISTXATTR @@ -470,9 +482,6 @@ /* Define to 1 if you have the `sync_file_range' function. */ #undef HAVE_SYNC_FILE_RANGE -/* Define to 1 if you have the 'fsync' function. */ -#undef HAVE_FSYNC - /* Define to 1 if you have the `sysconf' function. */ #undef HAVE_SYSCONF diff --git a/lib/ext2fs/ext2_err.et.in b/lib/ext2fs/ext2_err.et.in index 16abd23..b2ba71a 100644 --- a/lib/ext2fs/ext2_err.et.in +++ b/lib/ext2fs/ext2_err.et.in @@ -429,7 +429,7 @@ ec EXT2_ET_MMP_FAILED, "MMP: device currently active" ec EXT2_ET_MMP_FSCK_ON, - "MMP: fsck being run" + "MMP: e2fsck being run" ec EXT2_ET_MMP_BAD_BLOCK, "MMP: block number beyond filesystem range" @@ -471,7 +471,7 @@ ec EXT2_ET_UNKNOWN_CSUM, "Unknown checksum algorithm" ec EXT2_ET_MMP_CSUM_INVALID, - "MMP block checksum does not match MMP block" + "MMP block checksum does not match" ec EXT2_ET_FILE_EXISTS, "Ext2 file already exists" diff --git a/lib/ext2fs/mmp.c b/lib/ext2fs/mmp.c index 9a771de..0cf0d0d 100644 --- a/lib/ext2fs/mmp.c +++ b/lib/ext2fs/mmp.c @@ -194,7 +194,7 @@ static errcode_t ext2fs_mmp_reset(ext2_filsys fs) mmp_s->mmp_magic = EXT4_MMP_MAGIC; mmp_s->mmp_seq = EXT4_MMP_SEQ_CLEAN; mmp_s->mmp_time = 0; -#if _BSD_SOURCE || _XOPEN_SOURCE >= 500 +#ifdef HAVE_GETHOSTNAME gethostname(mmp_s->mmp_nodename, sizeof(mmp_s->mmp_nodename)); #else mmp_s->mmp_nodename[0] = '\0'; @@ -269,6 +269,10 @@ out: #endif } +#ifndef min +#define min(x, y) ((x) < (y) ? (x) : (y)) +#endif + /* * Make sure that the fs is not mounted or being fsck'ed while opening the fs. */ @@ -316,7 +320,7 @@ errcode_t ext2fs_mmp_start(ext2_filsys fs) if (mmp_s->mmp_check_interval > mmp_check_interval) mmp_check_interval = mmp_s->mmp_check_interval; - sleep(2 * mmp_check_interval + 1); + sleep(min(mmp_check_interval * 2 + 1, mmp_check_interval + 60)); retval = ext2fs_mmp_read(fs, fs->super->s_mmp_block, fs->mmp_buf); if (retval) @@ -332,7 +336,7 @@ clean_seq: goto mmp_error; mmp_s->mmp_seq = seq = ext2fs_mmp_new_seq(); -#if _BSD_SOURCE || _XOPEN_SOURCE >= 500 +#ifdef HAVE_GETHOSTNAME gethostname(mmp_s->mmp_nodename, sizeof(mmp_s->mmp_nodename)); #else strcpy(mmp_s->mmp_nodename, "unknown host"); @@ -344,7 +348,7 @@ clean_seq: if (retval) goto mmp_error; - sleep(2 * mmp_check_interval + 1); + sleep(min(2 * mmp_check_interval + 1, mmp_check_interval + 60)); retval = ext2fs_mmp_read(fs, fs->super->s_mmp_block, fs->mmp_buf); if (retval) diff --git a/misc/Makefile.in b/misc/Makefile.in index efc0e0b..f500276 100644 --- a/misc/Makefile.in +++ b/misc/Makefile.in @@ -39,7 +39,8 @@ USPROGS= mklost+found filefrag e2freefrag $(UUIDD_PROG) \ SMANPAGES= tune2fs.8 mklost+found.8 mke2fs.8 dumpe2fs.8 badblocks.8 \ e2label.8 $(FINDFS_MAN) $(BLKID_MAN) $(E2IMAGE_MAN) \ logsave.8 filefrag.8 e2freefrag.8 e2undo.8 \ - $(UUIDD_MAN) $(E4DEFRAG_MAN) $(E4CRYPT_MAN) @FSCK_MAN@ + $(UUIDD_MAN) $(E4DEFRAG_MAN) $(E4CRYPT_MAN) @FSCK_MAN@ \ + e2mmpstatus.8 FMANPAGES= mke2fs.conf.5 ext4.5 UPROGS= chattr lsattr @UUID_CMT@ uuidgen @@ -475,6 +476,10 @@ dumpe2fs.8: $(DEP_SUBSTITUTE) $(srcdir)/dumpe2fs.8.in $(E) " SUBST $@" $(Q) $(SUBSTITUTE_UPTIME) $(srcdir)/dumpe2fs.8.in dumpe2fs.8 +e2mmpstatus.8: $(DEP_SUBSTITUTE) $(srcdir)/e2mmpstatus.8.in + $(E) " SUBST $@" + $(Q) $(SUBSTITUTE_UPTIME) $(srcdir)/e2mmpstatus.8.in e2mmpstatus.8 + badblocks.8: $(DEP_SUBSTITUTE) $(srcdir)/badblocks.8.in $(E) " SUBST $@" $(Q) $(SUBSTITUTE_UPTIME) $(srcdir)/badblocks.8.in badblocks.8 @@ -546,6 +551,8 @@ install: all $(SMANPAGES) $(UMANPAGES) installdirs $(LN) $(LINK_INSTALL_FLAGS) mke2fs mkfs.$$i); \ done $(Q) (cd $(DESTDIR)$(root_sbindir); \ + $(LN) $(LINK_INSTALL_FLAGS) dumpe2fs e2mmpstatus) + $(Q) (cd $(DESTDIR)$(root_sbindir); \ $(LN) $(LINK_INSTALL_FLAGS) tune2fs e2label) $(Q) if test -n "$(FINDFS_LINK)"; then \ $(ES) " LINK $(root_sbindir)/findfs"; \ @@ -661,7 +668,7 @@ uninstall: for i in $(UMANPAGES); do \ $(RM) -f $(DESTDIR)$(man1dir)/$$i; \ done - for i in $(FINDFS_LINK) e2label ; do \ + for i in $(FINDFS_LINK) e2label e2mmpstatus ; do \ $(RM) -f $(DESTDIR)$(root_sbindir)/$$i; \ done for i in $(FMANPAGES); do \ diff --git a/misc/dumpe2fs.8.in b/misc/dumpe2fs.8.in index da78d4f..ce3214f 100644 --- a/misc/dumpe2fs.8.in +++ b/misc/dumpe2fs.8.in @@ -69,6 +69,17 @@ using .I device as the pathname to the image file. .TP +.B \-m +If the +.B mmp +feature is enabled on the filesystem, check if +.I device +is in use by another node, see +.BR e2mmpstatus (8) +for full details. If used together with the +.B \-i +option, only the MMP block information is printed. +.TP .B \-x print the detailed group information block numbers in hexadecimal format .TP @@ -76,8 +87,16 @@ print the detailed group information block numbers in hexadecimal format print the version number of .B dumpe2fs and exit. +.SH EXIT CODE +.B dumpe2fs +exits with a return code of 0 if the operation completed without errors. +It will exit with a non-zero return code if there are any errors, such +as problems reading a valid superblock, bad checksums, or if the device +is in use by another node and +.B -m +is specified. .SH BUGS -You need to know the physical filesystem structure to understand the +You may need to know the physical filesystem structure to understand the output. .SH AUTHOR .B dumpe2fs @@ -89,6 +108,7 @@ is part of the e2fsprogs package and is available from http://e2fsprogs.sourceforge.net. .SH SEE ALSO .BR e2fsck (8), +.BR e2mmpstatus (8), .BR mke2fs (8), .BR tune2fs (8). .BR ext4 (5) diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c index 395ea9e..384ce92 100644 --- a/misc/dumpe2fs.c +++ b/misc/dumpe2fs.c @@ -53,7 +53,7 @@ static int blocks64 = 0; static void usage(void) { - fprintf(stderr, _("Usage: %s [-bfghixV] [-o superblock=] " + fprintf(stderr, _("Usage: %s [-bfghimxV] [-o superblock=] " "[-o blocksize=] device\n"), program_name); exit(1); } @@ -420,6 +420,79 @@ static void print_journal_information(ext2_filsys fs) e2p_list_journal_super(stdout, buf, fs->blocksize, 0); } +static int check_mmp(ext2_filsys fs) +{ + int retval; + + /* This won't actually start MMP on the filesystem, since fs is opened + * readonly, but it will do the proper activity checking for us. */ + retval = ext2fs_mmp_start(fs); + if (retval) { + com_err(program_name, retval, _("while trying to open %s"), + fs->device_name); + if (retval == EXT2_ET_MMP_FAILED || + retval == EXT2_ET_MMP_FSCK_ON || + retval == EXT2_ET_MMP_CSUM_INVALID || + retval == EXT2_ET_MMP_UNKNOWN_SEQ) { + if (fs->mmp_buf) { + struct mmp_struct *mmp = fs->mmp_buf; + time_t mmp_time = mmp->mmp_time; + + fprintf(stderr, + "%s: MMP last updated by '%s' on %s", + program_name, mmp->mmp_nodename, + ctime(&mmp_time)); + } + retval = 1; + } else { + retval = 2; + } + } else { + printf("%s: it is safe to mount '%s', MMP is clean\n", + program_name, fs->device_name); + } + + return retval; +} + +static void print_mmp_block(ext2_filsys fs) +{ + struct mmp_struct *mmp; + time_t mmp_time; + errcode_t retval; + + if (fs->mmp_buf == NULL) { + retval = ext2fs_get_mem(fs->blocksize, &fs->mmp_buf); + if (retval) { + com_err(program_name, retval, + _("failed to alloc MMP buffer\n")); + return; + } + } + + retval = ext2fs_mmp_read(fs, fs->super->s_mmp_block, fs->mmp_buf); + /* this is only dumping, not checking status, so OK to skip this */ + if (retval == EXT2_ET_OP_NOT_SUPPORTED) + return; + if (retval) { + com_err(program_name, retval, + _("reading MMP block %llu from '%s'\n"), + fs->super->s_mmp_block, fs->device_name); + return; + } + + mmp = fs->mmp_buf; + mmp_time = mmp->mmp_time; + printf("MMP_block:\n"); + printf(" mmp_magic: 0x%x\n", mmp->mmp_magic); + printf(" mmp_check_interval: %d\n", mmp->mmp_check_interval); + printf(" mmp_sequence: %#08x\n", mmp->mmp_seq); + printf(" mmp_update_date: %s", ctime(&mmp_time)); + printf(" mmp_update_time: %lld\n", mmp->mmp_time); + printf(" mmp_node_name: %s\n", mmp->mmp_nodename); + printf(" mmp_device_name: %s\n", mmp->mmp_bdevname); +} + static void parse_extended_opts(const char *opts, blk64_t *superblock, int *blocksize) { @@ -500,11 +573,15 @@ static void parse_extended_opts(const char *opts, blk64_t *superblock, int main (int argc, char ** argv) { errcode_t retval; + errcode_t retval_csum = 0; + const char *error_csum = NULL; ext2_filsys fs; int print_badblocks = 0; blk64_t use_superblock = 0; int use_blocksize = 0; int image_dump = 0; + int mmp_check = 0; + int mmp_info = 0; int force = 0; int flags; int header_only = 0; @@ -519,12 +596,23 @@ int main (int argc, char ** argv) set_com_err_gettext(gettext); #endif add_error_table(&et_ext2_error_table); - fprintf (stderr, "dumpe2fs %s (%s)\n", E2FSPROGS_VERSION, - E2FSPROGS_DATE); - if (argc && *argv) - program_name = *argv; + if (argc && *argv) { + if (strrchr(*argv, '/')) + program_name = strrchr(*argv, '/') + 1; + else + program_name = *argv; + + if (strstr(program_name, "mmpstatus") != NULL) { + mmp_check = 1; + header_only = 1; + } + } - while ((c = getopt(argc, argv, "bfghixVo:")) != EOF) { + if (!mmp_check) + fprintf(stderr, "dumpe2fs %s (%s)\n", E2FSPROGS_VERSION, + E2FSPROGS_DATE); + + while ((c = getopt(argc, argv, "bfghimxVo:")) != EOF) { switch (c) { case 'b': print_badblocks++; @@ -539,7 +627,18 @@ int main (int argc, char ** argv) header_only++; break; case 'i': - image_dump++; + if (mmp_check) + mmp_info++; + else + image_dump++; + break; + case 'm': + mmp_check++; + header_only++; + if (image_dump) { + mmp_info = image_dump; + image_dump = 0; + } break; case 'o': parse_extended_opts(optarg, &use_superblock, @@ -557,12 +656,12 @@ int main (int argc, char ** argv) usage(); } } - if (optind != argc - 1) { + if (optind != argc - 1) usage(); - exit(1); - } + device_name = argv[optind++]; - flags = EXT2_FLAG_JOURNAL_DEV_OK | EXT2_FLAG_SOFTSUPP_FEATURES | EXT2_FLAG_64BITS; + flags = EXT2_FLAG_JOURNAL_DEV_OK | EXT2_FLAG_SOFTSUPP_FEATURES | + EXT2_FLAG_64BITS; if (force) flags |= EXT2_FLAG_FORCE; if (image_dump) @@ -579,64 +678,87 @@ try_open_again: if (!retval) break; } - } else - retval = ext2fs_open (device_name, flags, use_superblock, - use_blocksize, unix_io_manager, &fs); - if (retval && !(flags & EXT2_FLAG_IGNORE_CSUM_ERRORS)) { - flags |= EXT2_FLAG_IGNORE_CSUM_ERRORS; - goto try_open_again; + } else { + retval = ext2fs_open(device_name, flags, use_superblock, + use_blocksize, unix_io_manager, &fs); } - if (!retval && (fs->flags & EXT2_FLAG_IGNORE_CSUM_ERRORS)) - printf("%s", _("\n*** Checksum errors detected in filesystem! Run e2fsck now!\n\n")); flags |= EXT2_FLAG_IGNORE_CSUM_ERRORS; + if (retval && !retval_csum) { + retval_csum = retval; + error_csum = _("while trying to open %s"); + goto try_open_again; + } if (retval) { - com_err (program_name, retval, _("while trying to open %s"), - device_name); + com_err(program_name, retval, _("while trying to open %s"), + device_name); printf("%s", _("Couldn't find valid filesystem superblock.\n")); if (retval == EXT2_ET_BAD_MAGIC) check_plausibility(device_name, CHECK_FS_EXIST, NULL); - exit (1); + goto out; } fs->default_bitmap_type = EXT2FS_BMAP64_RBTREE; if (ext2fs_has_feature_64bit(fs->super)) blocks64 = 1; - if (print_badblocks) { + if (mmp_check) { + if (ext2fs_has_feature_mmp(fs->super) && + fs->super->s_mmp_block != 0) { + if (mmp_info) { + print_mmp_block(fs); + printf(" mmp_block_number: "); + print_number(fs->super->s_mmp_block); + printf("\n"); + } else { + retval = check_mmp(fs); + } + if (!retval && retval_csum) + retval = 2; + } else { + fprintf(stderr, _("%s: MMP feature not enabled.\n"), + program_name); + retval = 2; + } + } else if (print_badblocks) { list_bad_blocks(fs, 1); } else { if (grp_only) goto just_descriptors; - list_super (fs->super); + list_super(fs->super); if (ext2fs_has_feature_journal_dev(fs->super)) { print_journal_information(fs); - ext2fs_close_free(&fs); - exit(0); + + goto out_close; } if (ext2fs_has_feature_journal(fs->super) && (fs->super->s_journal_inum != 0)) print_inline_journal_information(fs); + if (ext2fs_has_feature_mmp(fs->super) && + fs->super->s_mmp_block != 0) + print_mmp_block(fs); list_bad_blocks(fs, 0); - if (header_only) { - ext2fs_close_free(&fs); - exit (0); - } + if (header_only) + goto out_close; + fs->flags &= ~EXT2_FLAG_IGNORE_CSUM_ERRORS; try_bitmaps_again: - retval = ext2fs_read_bitmaps (fs); - if (retval && !(fs->flags & EXT2_FLAG_IGNORE_CSUM_ERRORS)) { + retval = ext2fs_read_bitmaps(fs); + if (retval && !retval_csum) { fs->flags |= EXT2_FLAG_IGNORE_CSUM_ERRORS; + retval_csum = retval; + error_csum = _("while trying to read '%s' bitmaps\n"); goto try_bitmaps_again; } - if (!retval && (fs->flags & EXT2_FLAG_IGNORE_CSUM_ERRORS)) - printf("%s", _("\n*** Checksum errors detected in bitmaps! Run e2fsck now!\n\n")); just_descriptors: list_desc(fs, grp_only); - if (retval) { - printf(_("\n%s: %s: error reading bitmaps: %s\n"), - program_name, device_name, - error_message(retval)); - } + } +out_close: + if (retval_csum) { + com_err(program_name, retval_csum, error_csum, device_name); + printf("%s", _("*** Run e2fsck now!\n\n")); + if (!retval) + retval = retval_csum; } ext2fs_close_free(&fs); remove_error_table(&et_ext2_error_table); - exit (0); +out: + return retval; } diff --git a/misc/e2mmpstatus.8.in b/misc/e2mmpstatus.8.in new file mode 100644 index 0000000..f7d9557 --- /dev/null +++ b/misc/e2mmpstatus.8.in @@ -0,0 +1,59 @@ +.\" -*- nroff -*- +.\" This file may be copied under the terms of the GNU Public License. +.\" +.TH E2MMPSTATUS 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@" +.SH NAME +e2mmpstatus \- Check MMP status of an ext4 filesystem +.SH SYNOPSIS +.BR e2mmpstatus " [" \-i ] +.RI < filesystem > +.SH OPTIONS +.TP +.B \-i +prints out the MMP information rather than check it. +.SH DESCRIPTION +.B e2mmpstatus +is used to check Multiple-Mount Protection (MMP) status of an ext4 +filesystem with the +.B mmp +feature enabled. The specified +.I filesystem +can be a device name (e.g. +.IR /dev/hdc1 ", " /dev/sdb2 ), +or an ext4 filesystem label or UUID, for example +.B UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd +or +.BR LABEL=root . +By default, the +.B e2mmpstatus +program checks whether it is safe to mount the filesystem without taking +the risk of mounting it more than once. +.PP +MMP (multiple-mount protection) is a feature that adds protection against +the filesystem being modified simultaneously by more than one node. +It is NOT safe to mount a filesystem when one of the following conditions +is true: +.br +\ 1. e2fsck is running on the filesystem. +.br +\ 2. the filesystem is in use by another node. +.br +\ 3. The MMP block is corrupted or cannot be read for some reason. +.br +The +.B e2mmpstatus +program might wait for some time to see whether the MMP block is being +updated by any node during this period. The time taken depends on how +frequently the MMP block is being written by the other node. +.SH EXIT CODE +The exit code returned by +.B e2mmpstatus +is 0 when it is safe to mount the filesystem, 1 when the MMP block shows +the filesystem is in use on another node and it is NOT safe to mount +the filesystem, and 2 if some other failure occurred that prevents the +check from properly detecting the current MMP status. +.SH SEE ALSO +.BR dumpe2fs (8), +.BR e2fsck (8), +.BR fstab (5), +.BR fsck (8), diff --git a/tests/f_mmp/script b/tests/f_mmp/script index 9ff16c9..07ae232 100644 --- a/tests/f_mmp/script +++ b/tests/f_mmp/script @@ -43,6 +43,13 @@ rm -f $MARKFILE echo "kill debugfs abruptly (simulates e2fsck failure) ..." >> $test_name.log kill_debugfs +$E2MMPSTATUS $TMPFILE > $test_name.log 2>&1 +status=$? +if [ "$status" != 1 ] ; then + echo "$E2MMPSTATUS with EXT2_MMP_SEQ_FSCK passed!" > $test_name.failed + echo "$test_name: $test_description: failed" + return 1 +fi echo "e2fsck (should fail mmp_seq = EXT2_MMP_SEQ_FSCK) ..." >> $test_name.log $FSCK $FSCK_OPT $TMPFILE >> $test_name.log 2>&1 diff --git a/tests/m_mmp/expect.1 b/tests/m_mmp/expect.1 index a1452e6..9d8a5a3 100644 --- a/tests/m_mmp/expect.1 +++ b/tests/m_mmp/expect.1 @@ -46,6 +46,14 @@ Inode size: 128 Default directory hash: half_md4 MMP block number: 1049 MMP update interval: 5 +MMP_block: + mmp_magic: 0x4d4d50 + mmp_check_interval: 5 + mmp_sequence: 0xff4d4d50 + mmp_update_date: test date + mmp_update_time: test_time + mmp_node_name: test_node + mmp_device_name: test.img Group 0: (Blocks 0-32767) diff --git a/tests/m_mmp_bad_csum/expect b/tests/m_mmp_bad_csum/expect index e15e7b4..a0678ac 100644 --- a/tests/m_mmp_bad_csum/expect +++ b/tests/m_mmp_bad_csum/expect @@ -1,4 +1,7 @@ -Superblock MMP block checksum does not match MMP block. Fix? yes +dumpe2fs: MMP block checksum does not match while trying to open test.img +dumpe2fs: MMP last updated by 'test_node' on test date +Exit status is 1 +Superblock MMP block checksum does not match. Fix? yes Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure @@ -7,3 +10,14 @@ Pass 4: Checking reference counts Pass 5: Checking group summary information test_filesys: 11/128 files (0.0% non-contiguous), 19/512 blocks Exit status is 0 +dumpe2fs: it is safe to mount 'test.img', MMP is clean +Exit status is 0 +MMP_block: + mmp_magic: 0x4d4d50 + mmp_check_interval: 5 + mmp_sequence: 0xff4d4d50 + mmp_update_date: test date + mmp_update_time: test_time + mmp_node_name: test_node + mmp_device_name: test.img + mmp_block_number: 8 diff --git a/tests/m_mmp_bad_csum/script b/tests/m_mmp_bad_csum/script index 09e870c..4c8fe16 100644 --- a/tests/m_mmp_bad_csum/script +++ b/tests/m_mmp_bad_csum/script @@ -12,8 +12,15 @@ gzip -dc < $test_dir/image.gz > $TMPFILE OUT=$test_name.log EXP=$test_dir/expect -$FSCK -fy $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed > $OUT +$E2MMPSTATUS $TMPFILE > $OUT 2>&1 echo Exit status is $? >> $OUT +$FSCK -fy $TMPFILE >> $OUT 2>&1 +echo Exit status is $? >> $OUT +$E2MMPSTATUS $TMPFILE >> $OUT 2>&1 +echo Exit status is $? >> $OUT +$E2MMPSTATUS -i $TMPFILE >> $OUT 2>&1 +sed -f $cmd_dir/filter.sed $OUT > $OUT.new +mv $OUT.new $OUT rm -f $TMPFILE cmp -s $OUT $EXP diff --git a/tests/m_mmp_bad_magic/expect b/tests/m_mmp_bad_magic/expect index b5dfb89..d5fa98c 100644 --- a/tests/m_mmp_bad_magic/expect +++ b/tests/m_mmp_bad_magic/expect @@ -1,3 +1,5 @@ +dumpe2fs: MMP: invalid magic number while trying to open test.img +Exit status is 2 Superblock has invalid MMP magic. Fix? yes Pass 1: Checking inodes, blocks, and sizes @@ -7,3 +9,14 @@ Pass 4: Checking reference counts Pass 5: Checking group summary information test_filesys: 11/128 files (0.0% non-contiguous), 19/512 blocks Exit status is 0 +dumpe2fs: it is safe to mount 'test.img', MMP is clean +Exit status is 0 +MMP_block: + mmp_magic: 0x4d4d50 + mmp_check_interval: 5 + mmp_sequence: 0xff4d4d50 + mmp_update_date: test date + mmp_update_time: test_time + mmp_node_name: test_node + mmp_device_name: test.img + mmp_block_number: 8 diff --git a/tests/m_mmp_bad_magic/script b/tests/m_mmp_bad_magic/script index 09e870c..4c8fe16 100644 --- a/tests/m_mmp_bad_magic/script +++ b/tests/m_mmp_bad_magic/script @@ -12,8 +12,15 @@ gzip -dc < $test_dir/image.gz > $TMPFILE OUT=$test_name.log EXP=$test_dir/expect -$FSCK -fy $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed > $OUT +$E2MMPSTATUS $TMPFILE > $OUT 2>&1 echo Exit status is $? >> $OUT +$FSCK -fy $TMPFILE >> $OUT 2>&1 +echo Exit status is $? >> $OUT +$E2MMPSTATUS $TMPFILE >> $OUT 2>&1 +echo Exit status is $? >> $OUT +$E2MMPSTATUS -i $TMPFILE >> $OUT 2>&1 +sed -f $cmd_dir/filter.sed $OUT > $OUT.new +mv $OUT.new $OUT rm -f $TMPFILE cmp -s $OUT $EXP diff --git a/tests/test_config b/tests/test_config index cf9c79c..2aee6ff 100644 --- a/tests/test_config +++ b/tests/test_config @@ -25,6 +25,7 @@ RESIZE2FS_EXE="../resize/resize2fs" RESIZE2FS="$USE_VALGRIND $RESIZE2FS_EXE" E2UNDO_EXE="../misc/e2undo" E2UNDO="$USE_VALGRIND $E2UNDO_EXE" +E2MMPSTATUS="$USE_VALGRIND ../misc/dumpe2fs -m" TEST_REL=../tests/progs/test_rel TEST_ICOUNT=../tests/progs/test_icount CRCSUM=../tests/progs/crcsum