summaryrefslogtreecommitdiff
path: root/linaro-android-kernel-tests.sh
blob: d8d030cb8062164d5a94078b0f8a06ae6ec9e251 (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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#############################################################################
# Copyright (c) 2013 Linaro
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
#     Linaro <linaro-dev@lists.linaro.org>
#############################################################################

usage() {
    echo ""
    echo "Usage: $0 [-h] [-t testnames]"
    echo ""
    echo "Runs all tests if no arguments are given."
    echo ""
    echo "-h prints this help mesage."
    echo "-t testnames, run specified tests."
    echo "   currently supported:"
    echo "   ashmem"
    echo "   ashmem_expanded"
    echo "   binder"
    echo "   sync"
    echo "   vfat"
    echo "   evdev"
    echo "   swp-swpb"
    echo ""
    echo "example:"
    echo "$ linaro-android-kernel-tests -t \"logger binder\""
}


run_ashmemtest()
{
    echo "Running basic ashmemtest."
    ashmemtest
}

run_ashmemtest_expanded()
{
    echo "Running expanded ashmemtest."
    DIR=/data/linaro-android-kernel-test/ashmemtest-expanded
    OUT_DIR=/data/local/tmp/linaro-android-kernel-test/
    mkdir $OUT_DIR

    FILES=$DIR/*.txt

    for f in $FILES
    do
	BASENAME=${f##*/}
	TESTNAME="${BASENAME%.*}"
	echo "running $TESTNAME"

	ashmemtest-expanded $f &> $OUT_DIR/tmp.out

	diff $OUT_DIR/tmp.out $DIR/$TESTNAME.out > /dev/null
	if [ $? -eq 0 ]; then
	    cat $OUT_DIR/tmp.out
	    echo "[ashmem_expanded_$TESTNAME]: test passed"
	else
	    cat $OUT_DIR/tmp.out
	    echo "[ashmem_expanded_$TESTNAME]: test failed"
	fi
	rm $OUT_DIR/tmp.out
    done
}

run_binder_test() {
    echo "Running binder test."
    bindertest.sh
}

run_sync_test() {
    echo "Running sync test."
    sync-basic
}

run_vfat_test() {
    echo "Running vfat test."
    vfat-volid-test.sh
}

run_swp_swpb_test(){
        echo "Running swp-swpb test."
        swp-test-static
}

run_all() {
    echo "Running all tests"
    TESTS="ashmem ashmem_expanded alarmdev logger binder sync vfat evdev swp-swpb"
    run_tests
}

run_tests() {
    for TEST in $TESTS;
    do
	case $TEST in
	    ashmem)
		run_ashmemtest
		;;
	    ashmem_expanded)
		run_ashmemtest_expanded
		;;
	    alarmdev)
		run_alarm_dev_test
		;;
	    logger)
		run_logger_test
		;;
	    binder)
		run_binder_test
		;;
	    sync)
		run_sync_test
		;;
	    vfat)
		run_vfat_test
		;;
            swp-swpb)
		run_swp_swpb_test
		;;
	    *)
		echo ""
		echo "Unrecognized test $TEST."
		usage
		exit
		;;
	esac
    done
}

TESTS=

# no input argument
# run all tests
if [ $# -eq 0 ]; then
    run_all
    exit
fi

while getopts "ht:" OPT
do
    case $OPT in
	h)
	    usage
	    exit 1
	    ;;
	t)
	    TESTS=$OPTARG
	    ;;
	*)
	    usage
	    exit
    esac
done

run_tests