summaryrefslogtreecommitdiff
path: root/util-linux/mkfs_ext2_test.sh
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-10-20 00:06:03 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-10-20 00:06:03 +0200
commit05647b55512d0fec74fe6d69553a773e852674df (patch)
treee12249ce2de19cfc4280f2850574958202eb8d9c /util-linux/mkfs_ext2_test.sh
parent3ef4f77620a9f5f9a7c1247e29ea9c14e07b8a30 (diff)
downloadbusybox-w32-05647b55512d0fec74fe6d69553a773e852674df.tar.gz
busybox-w32-05647b55512d0fec74fe6d69553a773e852674df.tar.bz2
busybox-w32-05647b55512d0fec74fe6d69553a773e852674df.zip
mkfs_ext2: compat fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux/mkfs_ext2_test.sh')
-rwxr-xr-xutil-linux/mkfs_ext2_test.sh79
1 files changed, 48 insertions, 31 deletions
diff --git a/util-linux/mkfs_ext2_test.sh b/util-linux/mkfs_ext2_test.sh
index fe6291fc5..9c20b3b89 100755
--- a/util-linux/mkfs_ext2_test.sh
+++ b/util-linux/mkfs_ext2_test.sh
@@ -1,54 +1,71 @@
1#!/bin/sh 1#!/bin/sh
2 2
3test_mke2fs() { 3run_test() { # params: mke2fs_invocation image_name
4 echo Testing $kilobytes 4 >$2
5 5 dd seek=$((kilobytes-1)) bs=1K count=1 </dev/zero of=$2 >/dev/null 2>&1 || exit 1
6 >image_std 6 $1 -F $2 $kilobytes >$2.raw_out 2>&1 || return 1
7 dd seek=$((kilobytes-1)) bs=1K count=1 </dev/zero of=image_std >/dev/null 2>&1 || exit 1 7 cat $2.raw_out \
8 /usr/bin/mke2fs -F image_std $kilobytes >image_std.raw_out 2>&1 || return 1 8 | grep -v '^mke2fs [0-9]*\.[0-9]*\.[0-9]* ' \
9 cat image_std.raw_out \
10 | grep -v '^mke2fs ' \
11 | grep -v '^Maximum filesystem' \ 9 | grep -v '^Maximum filesystem' \
12 | grep -v '^warning: .* blocks unused' \
13 | grep -v '^Writing inode tables' \ 10 | grep -v '^Writing inode tables' \
14 | grep -v '^Writing superblocks and filesystem accounting information' \ 11 | grep -v '^Writing superblocks and filesystem accounting information' \
15 | grep -v '^This filesystem will be automatically checked every' \ 12 | grep -v '^This filesystem will be automatically checked every' \
16 | grep -v '^180 days, whichever comes first' \ 13 | grep -v '^180 days, whichever comes first' \
17 | sed 's/block groups/block group/' \ 14 | sed 's/inodes, [0-9]* blocks/inodes, N blocks/' \
15 | sed 's/blocks* unused./blocks unused/' \
16 | sed 's/block groups*/block groups/' \
18 | sed 's/ *$//' \ 17 | sed 's/ *$//' \
19 | sed 's/blocks (.*%) reserved/blocks reserved/' \ 18 | sed 's/blocks (.*%) reserved/blocks reserved/' \
20 | grep -v '^$' \ 19 | grep -v '^$' \
21 >image_std.out 20 >$2.out
21}
22 22
23 >image_bb 23test_mke2fs() {
24 dd seek=$((kilobytes-1)) bs=1K count=1 </dev/zero of=image_bb >/dev/null 2>&1 || exit 1 24 echo Testing $kilobytes
25 ./busybox mke2fs -F image_bb $kilobytes >image_bb.raw_out 2>&1 || return 1 25
26 cat image_bb.raw_out \ 26 run_test '/usr/bin/mke2fs' image_std || return 1
27 | grep -v '^mke2fs ' \ 27 run_test './busybox mke2fs' image_bb || return 1
28 | grep -v '^Maximum filesystem' \
29 | grep -v '^warning: .* blocks unused' \
30 | grep -v '^Writing inode tables' \
31 | grep -v '^Writing superblocks and filesystem accounting information' \
32 | grep -v '^This filesystem will be automatically checked every' \
33 | grep -v '^180 days, whichever comes first' \
34 | sed 's/block groups/block group/' \
35 | sed 's/ *$//' \
36 | sed 's/blocks (.*%) reserved/blocks reserved/' \
37 | grep -v '^$' \
38 >image_bb.out
39 28
40 diff -ua image_bb.out image_std.out >image.out.diff || { 29 diff -ua image_bb.out image_std.out >image.out.diff || {
41 cat image.out.diff 30 cat image.out.diff
42 return 1 31 return 1
43 } 32 }
33
34 e2fsck -f -n image_bb >/dev/null 2>&1 || { echo "e2fsck error on image_bb"; exit 1; }
44} 35}
45 36
37# -:bbox +:standard
38
39# -6240 inodes, 24908 blocks
40# +6240 inodes, 24577 blocks
41# -4 block group
42# +3 block group
43# -1560 inodes per group
44# +2080 inodes per group
46kilobytes=24908 test_mke2fs 45kilobytes=24908 test_mke2fs
47kilobytes=81940 test_mke2fs 46
48kilobytes=98392 test_mke2fs 47# -304 inodes, N blocks
49exit 48# +152 inodes, N blocks
49# -304 inodes per group
50# +152 inodes per group
51kilobytes=1218 test_mke2fs
52
53# -14464 inodes, N blocks
54# +14448 inodes, N blocks
55# -8 block group
56# +7 block group
57# -1808 inodes per group
58# +2064 inodes per group
59kilobytes=57696 test_mke2fs
60
61# This size results in "warning: 75 blocks unused"
62kilobytes=98380 test_mke2fs
63
64# -warning: 239 blocks unused.
65# +warning: 242 blocks unused.
66kilobytes=49395 test_mke2fs
50 67
51while true; do 68while true; do
52 kilobytes=$(( (RANDOM*RANDOM) % 100000 + 100)) 69 kilobytes=$(( (RANDOM*RANDOM) % 1000000 + 2000))
53 test_mke2fs || exit 1 70 test_mke2fs || exit 1
54done 71done