-
Notifications
You must be signed in to change notification settings - Fork 175
/
Copy pathrun.sh
executable file
·202 lines (175 loc) · 4.05 KB
/
run.sh
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
#!/bin/bash
#
# run.sh -- test specified boards automatically
#
# Copyright (C) 2016-2021 Wu Zhangjin <falcon@ruma.tech>
#
# TODO:
# 1. test core features of boards
# 2. different boards should maintain a board feature list for specific linux version: nfsroot, 9pnet, graphic boot ...
# 3. all of the features should be tested, if possible, no regression
#
# Notes:
# 1. every release should pass this basic test
# 2. some boards may fail, should be fixed if possible, for example, raspi3 hang at reboot issued
#
# Known failures:
#
# 1. these boards hang after send 'poweroff' or 'reboot' command: aarch64/raspi3, arm/verstailpb, mipsel/malta
# To ignore such failures, run it like: TIMEOUT_CONTINUE=1 tools/docker/run.sh
#
TOP_DIR=$(cd $(dirname $0)/../../ && pwd)
# Kill old gdb and qemu if exists
CLEAN=$TOP_DIR/tools/testing/kill.sh
[ -n "$1" ] && BOARD=$1
[ -n "$2" ] && CASE=$2
[ -n "$3" ] && VERBOSE=$3
[ -n "$4" ] && FEATURE=$4
[ -n "$5" ] && MODULE=$5
[ -n "$6" ] && CFGS=$6
[ -n "$7" ] && ARGS=$7
[ -n "$8" ] && PREBUILT=$8
[ -n "$9" ] && DEBUG=$9
[ -z "$TIMEOUT" ] && TIMEOUT=50
[ -z "$CASE" ] && CASE="release"
[ -z "$FEATURE" ] && FEATURE=""
[ -z "$VERBOSE" ] && VERBOSE=0
[ -z "$MODULE" ] && MODULE=""
[ -z "$PREBUILT" ] && PREBUILT=0
[ -z "$DEBUG" ] && DEBUG=0
if [ -z "$BOARD" -a -f "$TOP_DIR/.board_config" ]; then
BOARD=$(cat $TOP_DIR/.board_config)
fi
[ -z "$BOARD" ] && BOARD=all
if [ "$BOARD" = "all" ]; then
unset BOARD
BOARDS=`make list-board | grep -v ARCH | tr -d ':' | tr -d '[' | tr -d ']' | tr '\n' ' ' | tr -s ' '`
else
BOARDS="$BOARD"
fi
if [ -n "$FEATURE" ]; then
[ -n "$MODULE" ] && FEATURE="boot,module,$FEATURE"
else
[ -n "$MODULE" ] && FEATURE="boot,module"
fi
_CASE="test"
case $CASE in
kernel)
PREPARE="kernel"
;;
kernel-release)
PREPARE="kernel-release"
PREBUILT=1
;;
root)
PREPARE="root"
;;
root-release)
PREPARE="root-release"
PREBUILT=1
;;
qemu)
PREPARE="qemu"
;;
qemu-release)
PREPARE="qemu-release"
PREBUILT=1
;;
uboot)
PREPARE="uboot"
;;
uboot-release)
PREPARE="uboot-release"
PREBUILT=1
;;
module)
;;
base)
PREPARE="uboot,kernel"
;;
base-release)
PREPARE="uboot-release,kernel-release"
PREBUILT=1
;;
core)
PREPARE="uboot,kernel,root"
;;
core-release)
PREPARE="uboot-release,kernel-release,root-release"
PREBUILT=1
;;
full)
PREPARE="uboot,kernel,root,qemu"
;;
full-release)
PREPARE="uboot-release,kernel-release,root-release,qemu-release"
PREBUILT=1
;;
debug)
_CASE="boot-test"
DEBUG=1
;;
boot)
_CASE="boot-test"
;;
release)
_CASE="boot-test"
PREBUILT=1
;;
*)
_CASE="boot-test"
;;
esac
if [ $DEBUG -eq 1 ]; then
_DEBUG=D=1
#TEST_RD=/dev/ram0
fi
# Run for release, please issue: PREBUILT=1 ./run.sh boot
if [ $PREBUILT -eq 1 ]; then
_PREBUILT="PBK=1 PBR=1 PBU=1 PBD=1 PBQ=1"
fi
# external case in this script
echo -e "\nRunning [$CASE $_CASE]\n"
# Internal case
CASE=$_CASE
PASS_BOARDS=""
FAIL_BOARDS=""
echo -e "\nTesting boards: $BOARDS"
echo
echo -e "\n prepare: $PREPARE"
echo -e "\n boot timeout: $TIMEOUT"
echo -e "\n verbose: $VERBOSE"
echo -e "\n prebuilt: $PREBUILT"
echo -e "\n features: $FEATURE"
echo -e "\n modules: $MODULE"
echo -e "\n args: $ARGS"
echo -e "\n cfgs: $CFGS"
echo -e "\n debug: $DEBUG"
echo
sleep 2
for b in $BOARDS
do
[ -z "$TEST_RD" ] && TEST_RD=/dev/nfs
echo -e "\nBOARD: [ $b ]"
echo -e "\n... [ $b ] $CASE START...\n"
sleep 2
if [ "$b" == "aarch64/raspi3" ]; then
TEST_RD=/dev/ram0
fi
$CLEAN
sleep 2
make $CASE b=$b TIMEOUT=$TIMEOUT TEST_RD=$TEST_RD V=$VERBOSE PREPARE=$PREPARE FEATURE=$FEATURE $_PREBUILT $_DEBUG m=$MODULE $CFGS $ARGS
if [ $? -eq 0 ]; then
echo -e "\n... [ $b ] $CASE PASS...\n"
PASS_BOARDS="${PASS_BOARDS} $b"
else
echo -e "\n... [ $b ] $CASE FAIL...\n"
FAIL_BOARDS="${FAIL_BOARDS} $b"
fi
echo -e "\n... [ $b ] $CASE STOP...\n"
done
echo -e "\nFinished [$CASE]\n"
echo -e "\n.......... TEST REPORT..........\n"
echo -e "\nPASS: $PASS_BOARDS"
echo -e "\nFAIL: $FAIL_BOARDS"
echo