1#!/bin/sh 2 3TDIR=${AUTOPKGTEST_TMP:-/tmp/test_dir} 4LOGDIR=${AUTOPKGTEST_ARTIFACTS:-/tmp/test_dir_log} 5IMG=$TDIR/test-image.img 6 7# some autopkgtest environments may not have /etc/mtab and/or /proc/mounts 8EXT2FS_NO_MTAB_OK=yes 9export EXT2FS_NO_MTAB_OK 10 11mkdir -p $LOGDIR $TDIR 12 13/sbin/mke2fs -q -t ext4 -d e2fsck $IMG 8M 14/sbin/e2label $IMG test 15/sbin/e2fsck -fy $IMG > $LOGDIR/e2fsck.1.log 2>&1 16if test $? -ne 0 ; then 17 echo "First e2fsck failed; see $LOGDIR/e2fsck.1.log" 18 exit 1 19fi 20/sbin/resize2fs $IMG 16M > $LOGDIR/resize2fs.log 2>&1 21if test $? -ne 0 ; then 22 echo "Resize2fs failed; see $LOGDIR/e2fsck.1.log" 23 exit 1 24fi 25/sbin/e2fsck -fy $IMG > $LOGDIR/e2fsck.2.log 2>&1 26if test $? -ne 0 ; then 27 echo "Second e2fsck failed; see $LOGDIR/e2fsck.2.log" 28 exit 1 29fi 30/sbin/debugfs -R "dump pass1.c $TDIR/pass1.c" $IMG > $LOGDIR/debugfs.log 2>&1 31diff $TDIR/pass1.c e2fsck/pass1.c 32 33