File: regression.sh

package info (click to toggle)
rtlinux 3.1pre3-3
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 4,896 kB
  • ctags: 4,228
  • sloc: ansic: 26,204; sh: 2,069; makefile: 1,414; perl: 855; tcl: 489; asm: 380; cpp: 42
file content (298 lines) | stat: -rwxr-xr-x 6,249 bytes parent folder | download | duplicates (2)
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
#!/bin/bash

OUTFILE=regression.log

if [ ! -z "$1" ] ; then
    OUTFILE=$1
else
    rm -f ${OUTFILE}
fi

SETCOLOR_SUCCESS="echo -en \\033[1;32m"
SETCOLOR_FAILURE="echo -en \\033[1;31m"
SETCOLOR_WARNING="echo -en \\033[1;33m"
SETCOLOR_NORMAL="echo -en \\033[0;39m"

HOSTARCH=`uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/`
if [ -d linux ]; then cd linux;RTLINUX=`pwd`;cd ..;\
	  else if [ -d /sys/linux ]; then RTLINUX=/sys/linux; \
	  else if [ -d /usr/src/linux ]; then RTLINUX=/usr/src/linux; \
	  else if [ -d /util/2.3/rtlinux ]; then RTLINUX=/util/2.3/rtlinux; \
	  else echo "No directory for linux 2.3"; fi ; fi; fi; fi
KPL=`grep UTS_RELEASE ${RTLINUX}/include/linux/version.h 2>> ${OUTFILE} | \
	cut -d\" -f2 | awk -F \. '{print $2}'`

PATH=$PATH:/sbin

MOD_LISTF="\
	rtl \
	rtl_time \
	rtl_posixio \
	rtl_fifo \
	rtl_sched \
	"

#
# If there is a psc module then assume that the system was
# built with it and it's supported.
#
if [ -f modules/psc.o ] ; then
	MOD_LISTF="${MOD_LISTF} psc"
fi

sync;sync;sync

cleanup()
{
    	for x in periodic_test rtl_fifo rtl_posixio rtl_sched rtl_time psc rtl 
    	do
		(rmmod $x 2>> ${OUTFILE})
    	done
}

fatal()
{
    echo -n '[ '
    $SETCOLOR_FAILURE
    echo -n FAILED
    $SETCOLOR_NORMAL
    echo ' ]'
    echo 'Fatal Error.  Exiting.'
    cleanup
    exit 1
}

failure()
{
    echo -n '[ '
    $SETCOLOR_FAILURE
    echo -n FAILED
    $SETCOLOR_NORMAL
    echo ' ]'
}

success()
{
    echo -n '[ '
    $SETCOLOR_SUCCESS
    echo -n "  OK  "
    $SETCOLOR_NORMAL
    echo ' ]'
}

echo '----------------------------'
echo '- Installing basic modules -'
echo '----------------------------'
cleanup

for x in $MOD_LISTF
do
    echo -n "Testing multiple loads of $x.o...	 	"
    l=`echo $x|wc -c`
    if [ `expr $l \< 10` = "1" ] ; then
    	echo -n "	"
    fi
    
    CNT=70
    #
    # special case for timer on x86 - it's slow -- Cort
    #
    if [ "${HOSTARCH}" = "i386" -a "${x}" = "rtl_time" ] ; then
	CNT=10
    fi
    while [ "${CNT}" != 0 ]; do
	CNT=`expr $CNT - 1`
	if [ "$x" = "rtl" ] ; then
		insmod modules/$x.o quiet=1 2>> ${OUTFILE}
	else
		insmod modules/$x.o 2>> ${OUTFILE}
	fi
	if [ $? != "0" ] ; then
	    fatal
	    exit -1
	fi
	# on the last run, leave the module so others can load
	if [ "$CNT" != 0 ]; then
		rmmod $x 2>> ${OUTFILE}
	fi
    done
    success
done

sleep 1

echo -n 'Testing RTLinux fifos...				'
(regression/fifo_app 2>> ${OUTFILE})
if [ $? != "0" ] ; then
	failure
else
	success
fi
(rmmod fifo_module 2>> ${OUTFILE})

echo -n 'Testing thread wait times...				'
(regression/thread_app 2>> ${OUTFILE})
if [ $? != "0" ] ; then
	failure
else
 		success
fi

echo -n 'Testing that Linux time progresses...			'
s=`date`
CNT=1000
while [ ${CNT} != 0 ]; do
	CNT=`expr $CNT - 1`
	/bin/true
done
if [ "${s}" = "`date`" ]; then
	failure
else
	success
fi

echo -n 'Testing that Linux time is monotonically increasing...	'
(regression/linuxtime 2>> ${OUTFILE})
if [ $? != "0" ] ; then
	failure
else
	success
fi

echo -n 'Testing ping flood...					'
sync;sync;sync
(ping -f -c 100000 localhost 2>> ${OUTFILE} > /dev/null )
success # if it doesn't crash - it passes

if [ -f modules/psc.o ] ; then

#	echo -n 'Testing User-Level IRQ signals...			'
#	IRQ=`fgrep -v ' 0' /proc/interrupts | awk '{print $2 " " $1}' | sort -n | tail -1 | sed 's/:$//' | awk '{print $2}'`
#	(regression/rtlsigirq_app $IRQ 2>> ${OUTFILE})
#	if [ $? != "0" ] ; then
#		failure
#	else
#	  	success
#	fi

	echo -n 'Testing User-Level Timer signals...			'
	(regression/rtlsigtimer_app 2>> ${OUTFILE})
	if [ $? != "0" ] ; then
		failure
	else
 		success
	fi
	
	echo -n 'Testing User-Level gethrtime()...			'
	(regression/rtlgethrtime_test 2>> ${OUTFILE})
	if [ $? != "0" ] ; then
		failure
	else
		success
	fi

	echo -n 'Testing User-Level FIFO...				'
	(regression/psc_fifo_test 2>> ${OUTFILE})
	if [ $? != "0" ] ; then
		failure
	else
		success
	fi

	# if this doesn't hard lock the system, it passes. -Nathan

	# i have a dream -- and that dream is that someday psc debugging will
	# work on SMP, and then we can uncomment all of this.  i also have

	# Nathan, this dream of yours has come true -- MB.
	# But, need to fix some mm issues

	# another dream -- and that dream is that someday psc will take care
	# of cleaning up any messes anyone might make, and we won't need to
	# unload and load all of the modules for every single one of these
	# tests. -Nathan

	# Yep, that would be great -- Michael

#	echo -n 'Testing User-Level debugging...			'
#	(insmod debugger/rtl_debug.o >& /dev/null)
#	(insmod modules/psc.o >& /dev/null)
#	(regression/psc_dbg_div0 >& /dev/null)
#	(rmmod psc >& /dev/null)
#	(rmmod rtl_debug >& /dev/null)
#	(scripts/rmrtl >& /dev/null)
#	(scripts/insrtl >& /dev/null)

#	(insmod debugger/rtl_debug.o >& /dev/null)
#	(insmod modules/psc.o >& /dev/null)
#	(regression/psc_dbg_oob >& /dev/null)
#	(rmmod psc >& /dev/null)
#	(rmmod rtl_debug >& /dev/null)
#	(scripts/rmrtl >& /dev/null)
#	(scripts/insrtl >& /dev/null)

#	(rmmod psc >& /dev/null)
#	(rmmod rtl_debug >& /dev/null)
#	(insmod debugger/rtl_debug.o >& /dev/null)
#	(insmod modules/psc.o >& /dev/null)
#	(regression/psc_dbg_libcall >& /dev/null)
#	success

	echo -n 'Removing psc.o...					'
	(rmmod psc 2>> ${OUTFILE})
	if [ $? != "0" ] ; then
		fatal
	else
		success
        fi
fi

(insmod regression/fp_test.o >& /dev/null)
if [ $? = "0" ] ; then
	echo -n 'Testing floating-point support...			'
	(regression/fp_app 2>> ${OUTFILE})
	if [ $? != "0" ] ; then
		failure
	else
		success
	fi
fi

echo -n 'Removing rtl_sched.o...					'
(rmmod rtl_sched 2>> ${OUTFILE})
if [ $? != "0" ] ; then
	fatal
else
	success
fi

echo -n 'Testing periodic timer...				'
(insmod regression/periodic_test.o 2>> ${OUTFILE})
if [ $? != "0" ] ; then
	failure
else
	(regression/periodic_monitor 2>> ${OUTFILE})
	if [ $? != "0" ] ; then
  		failure
	else
   		success
	fi
fi
(rmmod periodic_test 2>> ${OUTFILE})

echo -n 'Testing oneshot timer...				'
(insmod regression/oneshot_test.o 2>> ${OUTFILE})
if [ $? != "0" ] ; then
	failure
else
	(regression/oneshot_monitor 2>> ${OUTFILE})
	if [ $? != "0" ] ; then
  		failure
	else
   		success
	fi
fi
(rmmod oneshot_test 2>> ${OUTFILE})

cleanup