shared/032: add options for jffs2
authorSu Yue <l@damenly.su>
Sat, 19 Dec 2020 09:10:58 +0000 (17:10 +0800)
committerEryu Guan <guaneryu@gmail.com>
Sun, 20 Dec 2020 16:18:43 +0000 (00:18 +0800)
Recently I found that my disk space was eaten by results/shared/032.full
after one round of xfstests running. The file was filled with binary
bytes by the command:
`mkfs -t jffs2 /dev/mapper/test-2 >> results/shared/032.full 2>&1`

Manual of mkfs.jffs2:
========================================================================
The program mkfs.jffs2 creates a JFFS2 (Second Journalling Flash
File System) file system image and writes the resulting image to the
file specified by the -o option or by default to the standard output,
unless the standard output is a terminal device in which case mkfs.jffs2
will abort. The file system image is created using the files and
directories contained in the directory specified by the option -r or
the present directory, if the -r option is not specified.
========================================================================

So the command equals to
`mkfs -t jffs2 -r xfstests-dev /dev/mapper/test-2 \
    -o xfstests-dev/results/shared/032.full \
    >>xfstests-dev/results/shared/032.full 2>&1`

The output image 032.full is under the directory xfstests-dev.
mkfs.jffs2 keeps reading from 032.full in page size and append bytes
to 032.full until the disk where xfstests-devel located is full.

Fix it by setting @preargs to '-r /proc/fs -o' for jffs2, now the output
is $SCRATCH_DEV. Since mkfs.jffs2 doesn't check overwrite case, just
skip overwrite attempt.

Signed-off-by: Su Yue <l@damenly.su>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/shared/032

index 00ae6860d9d5333dadf6d9337b6bbf86c841b457..360087ee1fb980ed92e6f5d03c52a186fa1d2f9e 100755 (executable)
@@ -55,6 +55,8 @@ do
        [ $fs = ext3 ] && preargs="-F"
        [ $fs = ext4 ] && preargs="-F"
        [ $fs = ext4dev ] && preargs="-F"
        [ $fs = ext3 ] && preargs="-F"
        [ $fs = ext4 ] && preargs="-F"
        [ $fs = ext4dev ] && preargs="-F"
+       # jffs2 mkfs requires '-r $directory' and '-o $image'
+       [ $fs = jffs2 ] && preargs="-r /proc/fs -o"
 
        # overwite the first few Kb - should blow away superblocks
        $here/src/devzero -n 20 $SCRATCH_DEV >/dev/null
 
        # overwite the first few Kb - should blow away superblocks
        $here/src/devzero -n 20 $SCRATCH_DEV >/dev/null
@@ -66,6 +68,9 @@ do
 
        if [ $? -eq 0 ] ; then
                # next, ensure we don't overwrite it
 
        if [ $? -eq 0 ] ; then
                # next, ensure we don't overwrite it
+               # jffs2 mkfs doesn't check overwrite case
+               [ $fs = jffs2 ] && continue
+
                echo "=== Attempting $FSTYP overwrite of $fs..." >>$seqres.full
                ${MKFS_PROG} -t $FSTYP $SCRATCH_DEV >>$seqres.full 2>&1
 
                echo "=== Attempting $FSTYP overwrite of $fs..." >>$seqres.full
                ${MKFS_PROG} -t $FSTYP $SCRATCH_DEV >>$seqres.full 2>&1