case2
1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
TESTFILE=testfile.$$
./mkcart > $TESTFILE
. ./testlib.sh
export BBC_BAD_BLKS=4079
#
# Test 2: Add file with bad blocks
#
echo "Test (2) Add $1 with bad block"
cp ./$TESTFILE bkup.$$
sk=$(($RANDOM % 256))
dd if=common/rdata of=tmp.$$ bs=1 count=16384 skip=$sk >$OUTPUT 2>&1
emsh << END_OF_FILE >out2.$$ 2>err2.$$
u ./$TESTFILE
B
F
A
P$2 tmp.$$
END_OF_FILE
check_log 2 out
check_log 2 err
#### check cert.sys was write to blk 4078 #####
sk=$((4078 * 16400))
dd if=./$TESTFILE of=tmp1.$$ bs=1 skip=$sk count=16384 >$OUTPUT 2>&1
diff tmp.$$ tmp1.$$ >$OUTPUT 2>&1 || {
echo "Test (2) Failed: wrong $1 @blk 4079 "
cp ./$TESTFILE data
exit
}
sz=4078
check_unchange bkup.$$ ./$TESTFILE 0 $sz "input" "result"
gzip -d -c Golden/$TESTID/fat2.gz > out.$$
sz=$((4079 * 16400))
dd if=./$TESTFILE of=tmp.$$ skip=$sz bs=1 >$OUTPUT 2>&1
if ! cmp tmp.$$ out.$$; then
echo "Failed 4079 + fat does not match"
exit
fi
rm -rf ./$TESTFILE err2.$$ out.$$ tmp*.$$ bkup.$$
exit 0