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