Whamcloud - gitweb
libext2fs: always refuse to open a file system with a zero s_desc_size
[tools/e2fsprogs.git] / tests / d_special_files / script
1 if ! test -x $DEBUGFS_EXE; then
2         echo "$test_name: $test_description: skipped (no debugfs)"
3         return 0
4 fi
5
6 OUT=$test_name.log
7 EXP=$test_dir/expect
8 VERIFY_FSCK_OPT=-yf
9
10 TEST_DATA=$test_name.tmp
11 VERIFY_DATA=$test_name.ver.tmp
12
13 echo "debugfs create special files" > $OUT.new
14
15 dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1
16
17 echo "mke2fs -Fq -b 1024 test.img 512" >> $OUT.new
18
19 $MKE2FS -Fq -b 1024 -o linux $TMPFILE 512 > /dev/null 2>&1
20 status=$?
21 echo Exit status is $status >> $OUT.new
22
23 $DEBUGFS -w $TMPFILE << EOF > /dev/null 2>&1
24 set_current_time 20130115140000
25 set_super_value lastcheck 0
26 set_super_value hash_seed null
27 set_super_value mkfs_time 0
28 symlink foo bar
29 symlink foo2 12345678901234567890123456789012345678901234567890123456789012345678901234567890
30 mknod pipe p
31 mknod sda b 8 0
32 mknod null c 1 3
33 EOF
34
35 echo "debugfs -R ''stat foo'' -w test.img" >> $OUT.new
36 $DEBUGFS -R "stat foo" -w $TMPFILE >> $OUT.new 2>&1
37 status=$?
38 echo Exit status is $status >> $OUT.new
39
40 echo "debugfs -R ''stat foo2'' -w test.img" >> $OUT.new
41 $DEBUGFS -R "stat foo2" -w $TMPFILE >> $OUT.new 2>&1
42 status=$?
43 echo Exit status is $status >> $OUT.new
44
45 echo "debugfs -R ''block_dump 28'' -w test.img" >> $OUT.new
46 $DEBUGFS -R "block_dump 28" -w $TMPFILE >> $OUT.new 2>&1
47 status=$?
48 echo Exit status is $status >> $OUT.new
49
50 echo "debugfs -R ''stat pipe'' -w test.img" >> $OUT.new
51 $DEBUGFS -R "stat pipe" -w $TMPFILE >> $OUT.new 2>&1
52 status=$?
53 echo Exit status is $status >> $OUT.new
54
55 echo "debugfs -R ''stat sda'' -w test.img" >> $OUT.new
56 $DEBUGFS -R "stat sda" -w $TMPFILE >> $OUT.new 2>&1
57 status=$?
58 echo Exit status is $status >> $OUT.new
59
60 echo "debugfs -R ''stat null'' -w test.img" >> $OUT.new
61 $DEBUGFS -R "stat null" -w $TMPFILE >> $OUT.new 2>&1
62 status=$?
63 echo Exit status is $status >> $OUT.new
64
65 echo e2fsck $VERIFY_FSCK_OPT -N test_filesys >> $OUT.new
66 $FSCK $VERIFY_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
67 status=$?
68 echo Exit status is $status >> $OUT.new
69 sed -f $cmd_dir/filter.sed $OUT.new > $OUT
70
71 #
72 # Do the verification
73 #
74
75 rm -f $TMPFILE $OUT.new
76 cmp -s $OUT $EXP
77 status=$?
78
79 if [ "$status" = 0 ] ; then
80         echo "$test_name: $test_description: ok"
81         touch $test_name.ok
82 else
83         echo "$test_name: $test_description: failed"
84         diff $DIFF_OPTS $EXP $OUT > $test_name.failed
85 fi
86
87 unset VERIFY_FSCK_OPT NATIVE_FSCK_OPT OUT EXP TEST_DATA VERIFY_DATA