1#!/bin/sh 2 3TDIR=${AUTOPKGTEST_TMP:-/tmp/fuse_dir} 4LOGDIR=${AUTOPKGTEST_ARTIFACTS:-/tmp/fuse_dir_log} 5IMG=$TDIR/test-image.img 6MNT=$TDIR/mnt 7 8# some autopkgtest environments may not have /etc/mtab and/or /proc/mounts 9EXT2FS_NO_MTAB_OK=yes 10export EXT2FS_NO_MTAB_OK 11 12mkdir -p $LOGDIR $TDIR $MNT 13 14/sbin/mke2fs -E root_owner -q -t ext4 -d e2fsck $IMG 8M 15/sbin/e2label $IMG test 16fuse2fs $IMG $MNT > $LOGDIR/fuse2fs.log 2>&1 17if test $? -ne 0 ; then 18 echo "fuse2fs failed; see $LOGDIR/fuse2fs.log" 19 exit 1 20fi 21diff e2fsck/pass1.c $MNT/pass1.c 22echo foobar > $MNT/testfile 23fusermount -u $MNT > $LOGDIR/fusermount.log 2>&1 24if test $? -ne 0 ; then 25 echo "fusermount failed; see $LOGDIR/fusermount.log" 26 exit 1 27fi 28/sbin/e2fsck -fy $IMG > $LOGDIR/e2fsck.log 2>&1 29if test $? -ne 0 ; then 30 echo "e2fsck failed; see $LOGDIR/e2fsck.log" 31 exit 1 32fi 33contents=$(/sbin/debugfs -R "cat testfile" $IMG 2> $LOGDIR/debugfs.log) 34if test "$contents" != foobar ; then 35 echo "testfile does not contain expected output" 36 exit 1 37fi 38