diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-10-18 20:57:52 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-10-18 20:57:52 +0200 |
commit | e8405619fa28972eacff34d3dee030927c4afc24 (patch) | |
tree | 6bef4cfa8130c8c5f2fa8e844944bf416bb6c28b /util-linux/mkfs_ext2_test.sh | |
parent | f9d3a91a89251cc4470a3cb94e918a49191438d2 (diff) | |
download | busybox-w32-e8405619fa28972eacff34d3dee030927c4afc24.tar.gz busybox-w32-e8405619fa28972eacff34d3dee030927c4afc24.tar.bz2 busybox-w32-e8405619fa28972eacff34d3dee030927c4afc24.zip |
mkfs_ext2: more work. added test script
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux/mkfs_ext2_test.sh')
-rwxr-xr-x | util-linux/mkfs_ext2_test.sh | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/util-linux/mkfs_ext2_test.sh b/util-linux/mkfs_ext2_test.sh new file mode 100755 index 000000000..fe6291fc5 --- /dev/null +++ b/util-linux/mkfs_ext2_test.sh | |||
@@ -0,0 +1,54 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | test_mke2fs() { | ||
4 | echo Testing $kilobytes | ||
5 | |||
6 | >image_std | ||
7 | dd seek=$((kilobytes-1)) bs=1K count=1 </dev/zero of=image_std >/dev/null 2>&1 || exit 1 | ||
8 | /usr/bin/mke2fs -F image_std $kilobytes >image_std.raw_out 2>&1 || return 1 | ||
9 | cat image_std.raw_out \ | ||
10 | | grep -v '^mke2fs ' \ | ||
11 | | grep -v '^Maximum filesystem' \ | ||
12 | | grep -v '^warning: .* blocks unused' \ | ||
13 | | grep -v '^Writing inode tables' \ | ||
14 | | grep -v '^Writing superblocks and filesystem accounting information' \ | ||
15 | | grep -v '^This filesystem will be automatically checked every' \ | ||
16 | | grep -v '^180 days, whichever comes first' \ | ||
17 | | sed 's/block groups/block group/' \ | ||
18 | | sed 's/ *$//' \ | ||
19 | | sed 's/blocks (.*%) reserved/blocks reserved/' \ | ||
20 | | grep -v '^$' \ | ||
21 | >image_std.out | ||
22 | |||
23 | >image_bb | ||
24 | dd seek=$((kilobytes-1)) bs=1K count=1 </dev/zero of=image_bb >/dev/null 2>&1 || exit 1 | ||
25 | ./busybox mke2fs -F image_bb $kilobytes >image_bb.raw_out 2>&1 || return 1 | ||
26 | cat image_bb.raw_out \ | ||
27 | | grep -v '^mke2fs ' \ | ||
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 | |||
40 | diff -ua image_bb.out image_std.out >image.out.diff || { | ||
41 | cat image.out.diff | ||
42 | return 1 | ||
43 | } | ||
44 | } | ||
45 | |||
46 | kilobytes=24908 test_mke2fs | ||
47 | kilobytes=81940 test_mke2fs | ||
48 | kilobytes=98392 test_mke2fs | ||
49 | exit | ||
50 | |||
51 | while true; do | ||
52 | kilobytes=$(( (RANDOM*RANDOM) % 100000 + 100)) | ||
53 | test_mke2fs || exit 1 | ||
54 | done | ||