]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: add fsck.minix checks
authorSami Kerola <kerolasa@iki.fi>
Sun, 2 Aug 2015 18:29:00 +0000 (19:29 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 3 Aug 2015 09:27:38 +0000 (11:27 +0200)
The debian bug was fixed in commit 730ae9c89971, and the rest are about
having test coverity for various file name lenghts and minix fs versions.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 files changed:
tests/expected/minix/fsck-images-auto-fix [new file with mode: 0644]
tests/expected/minix/fsck-images-broken-root [new file with mode: 0644]
tests/expected/minix/fsck-images-bug.773892 [new file with mode: 0644]
tests/expected/minix/fsck-images-check-blocks [new file with mode: 0644]
tests/expected/minix/fsck-images-v1c14 [new file with mode: 0644]
tests/expected/minix/fsck-images-v1c30 [new file with mode: 0644]
tests/expected/minix/fsck-images-v2c14 [new file with mode: 0644]
tests/expected/minix/fsck-images-v2c30 [new file with mode: 0644]
tests/expected/minix/fsck-images-v3c60 [new file with mode: 0644]
tests/ts/minix/broken-root [new file with mode: 0644]
tests/ts/minix/debian.bug.773892 [new file with mode: 0644]
tests/ts/minix/fsck-images [new file with mode: 0755]

diff --git a/tests/expected/minix/fsck-images-auto-fix b/tests/expected/minix/fsck-images-auto-fix
new file mode 100644 (file)
index 0000000..d017dfb
--- /dev/null
@@ -0,0 +1,31 @@
+Filesystem auto-fix is dirty, needs checking.
+Read error: bad block in file '/'
+16 inodes
+16 blocks
+Firstdatazone=5 (5)
+Zonesize=1024
+Maxsize=2147483647
+namelen=60
+
+Read error: bad block in file '/'
+/: bad directory: '.' isn't first
+Read error: bad block in file '/'
+/: bad directory: '..' isn't second
+Inode 1 not used, marked used in the bitmap.
+
+     0 inodes used (0%)
+     6 zones used (37%)
+
+     0 regular files
+     0 directories
+     0 character device files
+     0 block device files
+     1 links
+     0 symbolic links
+------
+     1 files
+----------------------------
+FILE SYSTEM HAS BEEN CHANGED
+----------------------------
+0
+29f0edbcb7e405bbc56e614af3c3cb7c auto-fix
diff --git a/tests/expected/minix/fsck-images-broken-root b/tests/expected/minix/fsck-images-broken-root
new file mode 100644 (file)
index 0000000..d851b83
--- /dev/null
@@ -0,0 +1,7 @@
+Read error: bad block in file '/'
+Read error: bad block in file '/'
+/: bad directory: '.' isn't first
+Read error: bad block in file '/'
+/: bad directory: '..' isn't second
+Inode 1 not used, marked used in the bitmap.
+4
diff --git a/tests/expected/minix/fsck-images-bug.773892 b/tests/expected/minix/fsck-images-bug.773892
new file mode 100644 (file)
index 0000000..573541a
--- /dev/null
@@ -0,0 +1 @@
+0
diff --git a/tests/expected/minix/fsck-images-check-blocks b/tests/expected/minix/fsck-images-check-blocks
new file mode 100644 (file)
index 0000000..c255d2b
--- /dev/null
@@ -0,0 +1,9 @@
+32 inodes
+16 blocks
+Firstdatazone=5 (5)
+Zonesize=1024
+Maxsize=268966912
+
+mkfs return value: 0
+fsck return value: 0
+a00e2f45adc97da6ccb5aade7b129b42
diff --git a/tests/expected/minix/fsck-images-v1c14 b/tests/expected/minix/fsck-images-v1c14
new file mode 100644 (file)
index 0000000..519fc7e
--- /dev/null
@@ -0,0 +1,9 @@
+32 inodes
+16 blocks
+Firstdatazone=5 (5)
+Zonesize=1024
+Maxsize=268966912
+
+mkfs return value: 0
+fsck return value: 0
+9d9bf9d22274bb996938812ab01dd891
diff --git a/tests/expected/minix/fsck-images-v1c30 b/tests/expected/minix/fsck-images-v1c30
new file mode 100644 (file)
index 0000000..c255d2b
--- /dev/null
@@ -0,0 +1,9 @@
+32 inodes
+16 blocks
+Firstdatazone=5 (5)
+Zonesize=1024
+Maxsize=268966912
+
+mkfs return value: 0
+fsck return value: 0
+a00e2f45adc97da6ccb5aade7b129b42
diff --git a/tests/expected/minix/fsck-images-v2c14 b/tests/expected/minix/fsck-images-v2c14
new file mode 100644 (file)
index 0000000..2b3a173
--- /dev/null
@@ -0,0 +1,9 @@
+16 inodes
+16 blocks
+Firstdatazone=5 (5)
+Zonesize=1024
+Maxsize=2147483647
+
+mkfs return value: 0
+fsck return value: 0
+d836636da820de16325370caf494cdab
diff --git a/tests/expected/minix/fsck-images-v2c30 b/tests/expected/minix/fsck-images-v2c30
new file mode 100644 (file)
index 0000000..168e66a
--- /dev/null
@@ -0,0 +1,9 @@
+16 inodes
+16 blocks
+Firstdatazone=5 (5)
+Zonesize=1024
+Maxsize=2147483647
+
+mkfs return value: 0
+fsck return value: 0
+3e5796ddbd8d08b98c29c42199685bcb
diff --git a/tests/expected/minix/fsck-images-v3c60 b/tests/expected/minix/fsck-images-v3c60
new file mode 100644 (file)
index 0000000..4505dcd
--- /dev/null
@@ -0,0 +1,9 @@
+16 inodes
+16 blocks
+Firstdatazone=5 (5)
+Zonesize=1024
+Maxsize=2147483647
+
+mkfs return value: 0
+fsck return value: 0
+e4acad302d186a5c8788acedb7021255
diff --git a/tests/ts/minix/broken-root b/tests/ts/minix/broken-root
new file mode 100644 (file)
index 0000000..37ee84e
Binary files /dev/null and b/tests/ts/minix/broken-root differ
diff --git a/tests/ts/minix/debian.bug.773892 b/tests/ts/minix/debian.bug.773892
new file mode 100644 (file)
index 0000000..db97848
Binary files /dev/null and b/tests/ts/minix/debian.bug.773892 differ
diff --git a/tests/ts/minix/fsck-images b/tests/ts/minix/fsck-images
new file mode 100755 (executable)
index 0000000..afd2f9b
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/bash
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="${0%/*}/../.."
+TS_DESC="fsck images"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+ts_check_test_command "$TS_CMD_FSCKMINIX"
+ts_check_test_command "$TS_HELPER_MKFS_MINIX"
+
+export MKFS_MINIX_TEST_SECOND_SINCE_EPOCH='1438460212'
+
+check_minix_fs_type() {
+       ts_init_subtest $1
+       dd if=/dev/zero bs=1024 count=16 of=$TS_OUTDIR/$1 >/dev/null 2>&1
+       $TS_HELPER_MKFS_MINIX $2 $TS_OUTDIR/$1 >> $TS_OUTPUT 2>&1
+       echo "mkfs return value: $?" >> $TS_OUTPUT
+       $TS_CMD_FSCKMINIX $TS_OUTDIR/$1 >> $TS_OUTPUT 2>&1
+       echo "fsck return value: $?" >> $TS_OUTPUT
+       md5sum $TS_OUTDIR/$1 | awk '{print $1}' >> $TS_OUTPUT 2>&1
+       rm -f $TS_OUTDIR/$1
+       ts_finalize_subtest
+}
+
+check_minix_fs_type 'v1c14' '-1 -n 14'
+check_minix_fs_type 'v1c30' '-1 -n 30'
+check_minix_fs_type 'v2c14' '-2 -n 14'
+check_minix_fs_type 'v2c30' '-2 -n 30'
+check_minix_fs_type 'v3c60' '-3 -n 60'
+
+ts_init_subtest "auto-fix"
+cp "$TS_SELF/broken-root" "$TS_OUTDIR/auto-fix"
+"$TS_CMD_FSCKMINIX" -sav "$TS_OUTDIR/auto-fix" |
+       sed 's/Filesystem on .*auto-fix is dirty/Filesystem auto-fix is dirty/' > $TS_OUTPUT 2>&1
+echo $? >> $TS_OUTPUT
+md5sum "$TS_OUTDIR/auto-fix" |
+       sed 's/  .*auto-fix/ auto-fix/' >> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "bug.773892"
+"$TS_CMD_FSCKMINIX" "$TS_SELF/debian.bug.773892" > $TS_OUTPUT 2>&1
+echo $? >> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "broken-root"
+"$TS_CMD_FSCKMINIX" "$TS_SELF/broken-root" > $TS_OUTPUT 2>&1
+echo $? >> $TS_OUTPUT
+ts_finalize_subtest
+
+echo "42" > $TS_OUTDIR/badlist
+check_minix_fs_type 'check-blocks' "-l $TS_OUTDIR/badlist -c"
+rm -f $TS_OUTDIR/badlist
+
+ts_finalize