| 1 | #!/bin/shscip-shell filesystem . . `/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 | mkdirscip-shell system . . mkdir. -p $LOGDIR $TDIR $MNT |
| 13 | |
| 14 | /sbin/mke2fsscip-shell filesystem . . `/sbin/mke2fs`. -E root_owner -q -t ext4 -d e2fsck $IMG 8M |
| 15 | /sbin/e2labelscip-shell filesystem . . `/sbin/e2label`. $IMG test |
| 16 | fuse2fs $IMG $MNT > $LOGDIR/fuse2fs.log 2>&1 |
| 17 | if testscip-shell system . . test. $? -ne 0 ; then |
| 18 | echoscip-shell system . . echo. "fuse2fs failed; see $LOGDIR/fuse2fs.log" |
| 19 | exit 1 |
| 20 | fi |
| 21 | diffscip-shell system . . diff. e2fsck/pass1.c $MNT/pass1.c |
| 22 | echoscip-shell system . . echo. foobar > $MNT/testfile |
| 23 | fusermount -u $MNT > $LOGDIR/fusermount.log 2>&1 |
| 24 | if testscip-shell system . . test. $? -ne 0 ; then |
| 25 | echoscip-shell system . . echo. "fusermount failed; see $LOGDIR/fusermount.log" |
| 26 | exit 1 |
| 27 | fi |
| 28 | /sbin/e2fsckscip-shell filesystem . . `/sbin/e2fsck`. -fy $IMG > $LOGDIR/e2fsck.log 2>&1 |
| 29 | if testscip-shell system . . test. $? -ne 0 ; then |
| 30 | echoscip-shell system . . echo. "e2fsck failed; see $LOGDIR/e2fsck.log" |
| 31 | exit 1 |
| 32 | fi |
| 33 | contents=$(/sbin/debugfsscip-shell filesystem . . `/sbin/debugfs`. -R "cat testfile" $IMG 2> $LOGDIR/debugfs.log) |
| 34 | if testscip-shell system . . test. "$contents" != foobar ; then |
| 35 | echoscip-shell system . . echo. "testfile does not contain expected output" |
| 36 | exit 1 |
| 37 | fi |