aboutsummaryrefslogtreecommitdiff
path: root/ubi-utils/sort-me-out/jffs2_test.sh
blob: 0cc9f0c3a77c7e7b0b1d51abbcc333d24fb3e3fc (plain)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/sh
#
# Testcase for JFFS2 verification. We do not want to see any
# kernel errors occuring when this is executed.
#
#
# To have a standardized output I define the following function to be
# used when a test was ok or when it failed.
#
failed ()
{
    echo "FAILED"
}

passed ()
{
    echo "PASSED"
}

#
# Print sucess message. Consider to exit with zero as return code.
#
exit_success ()
{
    echo "SUCCESS"
    exit 0
}

#
# Print failure message. Consider to exit with non zero return code.
#
exit_failure ()
{
    echo "FAILED"
    exit 1
}

echo "***********************************************************************"
echo "*        jffs2 testing ...                                            *"
echo "***********************************************************************"

ulimit -c unlimited

for i in `seq 5000`; do
    echo "Testing $i byte (dd if=/dev/urandom of=foo bs=$i count=1) ... "
    dd if=/dev/urandom of=test.bin bs=$i count=1;
    if [ $? -ne "0" ] ; then
        exit_failure
    fi
    passed

    echo "Copy to different file ... "
    dd if=test.bin of=new.bin bs=$i count=1;
    if [ $? -ne "0" ] ; then
        exit_failure
    fi
    passed

    echo "Comparing files ... "
    cmp test.bin new.bin
    dd if=test.bin of=new.bin bs=$i count=1;
    if [ $? -ne "0" ] ; then
        exit_failure
    fi
    passed
done

for i in `seq 5000`; do
    echo "Testing $i byte (dd if=/dev/urandom of=foo bs=$i count=1) ... "
    dd if=/dev/urandom of=foo bs=$i count=1;
    if [ $? -ne "0" ] ; then
        exit_failure
    fi
    passed
done

for i in `seq 5000`; do 
    echo "Testing $i byte (dd if=/dev/zero of=foo bs=$i count=1) ... "
    dd if=/dev/zero of=foo bs=$i count=1;
    if [ $? -ne "0" ] ; then
        exit_failure
    fi
    passed
done

echo "***********************************************************************"
echo "*               Congratulations, no errors found!                     *"
echo "*              Have fun with your cool JFFS2 using system!            *"
echo "***********************************************************************"

exit_success