summaryrefslogtreecommitdiff
path: root/security/nss/tests/qa_stat
blob: 7805a6d42f117a7d8a66721e528a3654c11be070 (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
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
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
#! /bin/sh
########################################################################
#
# /u/sonmi/bin/qa_stat - /u/svbld/bin/init/nss/qa_stat
#
# this script is supposed to automatically run QA for NSS on all required
# Unix platforms
#
# parameters
# ----------
#	nssversion (supported: 30b, 31, tip)
#	builddate (default - today)
#
# options
# -------
#	-y answer all questions with y - use at your own risk...ignores warnings
#	-s silent (only usefull with -y)
#	-h, -? - you guessed right - displays this text
#	-d debug
#	-f <filename> - write the (error)output to filename
#	-m <mailinglist> - send filename to mailinglist (csl) only useful
#		with -f
#	-cron equivalient to -y -s -d -f $RESULTDIR/$HOST.qa_stat
#
########################################################################


O_OPTIONS=ON

. `dirname $0`/header

EARLY_EXIT=TRUE

DOCDIR=/u/sonmi/doc

Debug "NTDIST $NTDIST"
Debug "UXDIST $UXDIST"
Debug "TESTSCRIPTDIR $TESTSCRIPTDIR"
Debug "RESULTDIR $RESULTDIR"

############################### find_qa_systems ##########################
# local shell function, tries to determine the QA operating system
########################################################################
find_qa_systems()
{

#the line below had a bug, which caused nssqa as being run when only 
#the .nssqa file existed
#FIXME remaining bugs: 
#when only debug but not opt is being run this is not recognized. 
#2000 and NT are reported the same way
#it should also examine the directory (.1) for files 

for w in `ls $RESULTDIR | grep \.1$ | sed -e "s/\..*//" | sort -u`
do
	NO_RSH="FALSE"
	QA_OS=""
	QA_RHVER=""
	IS_64=""
	IS_WIN=""

	grep WINDOWS-OS-LINE ${RESULTDIR}/${w}.nssqa && NO_RSH=TRUE

	if [ $NO_RSH = "TRUE" ]
	then
		grep WINDOWS-OS-LINE ${RESULTDIR}/${w}.nssqa | sed -e "s/ /_/g" \
			 -e "s/WINDOWS-OS-LINE:_Windows/${w}/g" >>$TMP_PLATFORMLIST_FILE
		grep WINDOWS-OS-LINE ${RESULTDIR}/${w}.nssqa | sed -e "s/ /_/g" \
			 -e "s/WINDOWS-OS-LINE:_Windows/${w}/g" 
	else
    	QA_SYS=`rsh $w uname -sr`
		echo $QA_SYS | grep Linux && QA_RHVER=`rsh $w cat /etc/redhat-release`
		if [ -n "$QA_RHVER" ]
		then
			QA_OS=`echo $w $QA_RHVER | sed -e "s/Red Hat /RH /" \
						-e "s/ release//"`
		else
			case $QA_SYS in
				*SunOS*5.8*)
					IS_64=`rsh $w isainfo -v | grep 64 >/dev/null && \
						echo 64 bit`
					if [ -z "$IS_64" ] ; then IS_64="32 bit"; fi;
					;;
				*HP*)
					IS_64=`rsh $w getconf KERNEL_BITS | grep 64 >/dev/null && \
						echo 64 bit`
					if [ -z "$IS_64" ] ; then IS_64="32 bit"; fi;
					;;
				*AIX*)
					IS_64=`rsh $w lslpp -l | grep "bos.64bit"> /dev/null && \
						echo 64 bit`
					if [ -z "$IS_64" ] ; then IS_64="32 bit"; fi;
					;;
			esac
			QA_OS=`echo "$w $QA_SYS $IS_64"`
		fi
		echo $QA_OS
		echo $QA_OS | sed -e "s/ /_/g" >>$TMP_PLATFORMLIST_FILE	# use later for 
															# missing list
	fi
done

}
################################### set_files ##########################
# local shell function, sets the name of the resultfile to:
#	<filename> if option -f <filename>
#	$RESULTDIR/result if write permission 
#		(mozilla/tests_results/security/result)
#	$HOME/resultNSS${NSSVER}-${BUILDDATE} if no write permission in $RESULTDIR
########################################################################
set_files()
{
	if [ $O_FILE = ON -a $O_CRON = OFF ]	# if -f was specified write there 
	then
		RFILE=$FILENAME	
	else
		RFILE=${RESULTDIR}/result
		#RFILE=${RESULTDIR}/result.$$
		if [ ! -w $RESULTDIR ]
		then
			RFILE=$HOME/resultNSS${NSSVER}-${BUILDDATE}
			Debug "Using alternate resultfile $RFILE"
		elif [ $O_CRON = ON ]
		then
			 find ${RESULTDIR} -exec chmod a+rw {} \;	#FIXME - umask 
							#doesn't seem to work - this is a tmp workaround
		fi
	
		if [ ! -x $RESULTDIR -o ! -r  $RESULTDIR -o ! -w $RESULTDIR ]
		then
			glob_usage "$RESULTDIR does not have the right permissions `ls -l $RESULTDIR`"
		fi
		if [ -d $RESULTDIR ]
		then
			cd $RESULTDIR
		else
			glob_usage "$RESULTDIR does not exist"
		fi
	fi
	TMP_E_FILE=${RFILE}.E$$
	TMP_P_FILE=${RFILE}.P$$
	TMP_PLATFORMLIST_FILE=${RFILE}.platform.$$
	rm $TMP_PLATFORMLIST_FILE 2>/dev/null
	TMP_PERF_FILE=${RFILE}.perf.$$
	HTML_FILE=${RFILE}.html
	TMPFILES="$TMPFILES  $TMP_E_FILE $TMP_P_FILE" 
#FIXME rm the rest too - add them to the TMPFILES
	FILENAME=$RFILE		#we might want to mail it...later switch to html file
	O_FILE="ON"
	rm $HTML_FILE $RFILE $TMP_E_FILE $TMP_P_FILE 2>/dev/null
	cp $DOCDIR/QAheader.html $HTML_FILE
}

################################# html_eot #########################
# local shell function, writes end of the html table
########################################################################
html_eot()
{
echo '</table>'
}

################################# html_footer #########################
# local shell function, writes end of the html body
########################################################################
html_footer()
{

echo '</body>'
echo '</html>'

}

################################# setQAsysvars #########################
# local shell function, sets system specific variables
########################################################################
setQAsysvars()
{
	if [ "$MACHINE" != "0" ]
	then
		TESTDATE=`ls -ld $MACHINE | awk '{ print $5, $6, $7 }'`
		TESTNUMBER=`echo $MACHINE | sed -e 's/.*\.//'`
		SYSNAME=`echo $MACHINE | sed -e 's/\..*//'`
		Debug "SYSNAME= $SYSNAME"
		QA_SYS_OS=`grep $SYSNAME $TMP_PLATFORMLIST_FILE |sed -e 's/
//' | \
			sort | uniq | sed  -e "s/$SYSNAME//" \
			-e "s/WINNT_WIN95/Windows NT/"  \
			-e "s/WINNT_WINNT/Windows NT/"  \
			-e "s/Windows_NT_WIN95/Windows NT/"  \
			-e "s/Windows_NT_WINNT/Windows NT/"  | sort | uniq`
		Debug "QA_SYS_OS= $QA_SYS_OS"
	fi
	BUILD_SYS=`echo $BUILDPLATFORM | sed -e 's/\.OBJ//' -e 's/_DBG/ Debug/' \
			-e 's/_OPT/ Optimized/'  -e 's/_64/ 64bit/' -e 's/_glibc_PTH//' \
			-e 's/_/ /'`
	Debug "BUILD_SYS=$BUILD_SYS"
	if [ -f "${RESULTDIR}/${MACHINE}/results.html" ] 
	then
		RESULT="http://cindercone${RESULTDIR}/${MACHINE}/results.html"
		Debug "RESULT=$RESULT"
	else
        RESULT="0"
        Debug "no resultfile"
	fi

	if [ -f "${RESULTDIR}/${MACHINE}/output.log" ] 
	then
		LOG="http://cindercone${RESULTDIR}/${MACHINE}/output.log"
		Debug "LOG=$LOG"
	else
		LOG="0"
		Debug "no logfile"
	fi
}

HTML_ERRORCOLOR=\"#FF0000\"
HTML_ERRORMSG=Failed

HTML_MISSINGCOLOR=\"#FFFFCC\"
HTML_MISSINGMSG=Missing

HTML_PASSEDCOLOR=\"#66FF99\"
HTML_PASSEDMSG=Passed
################################# html_line() #########################
# local shell function, writes a line in the html table
########################################################################
html_line()
{
echo '<tr NOSAVE>'
echo '<td NOSAVE>'$BUILD_SYS'</td>'
echo ''
echo '<td NOSAVE>'$QA_SYS_OS'</td>'
echo ''
echo '<td>'$SYSNAME'</td>'
#echo '<td>'$SYSNAME $TESTNUMBER $TESTDATE'</td>'
echo ''
if [ "$1" = "failed" ]
then
	echo '<td BGCOLOR='$HTML_ERRORCOLOR' NOSAVE><b>'$HTML_ERRORMSG'</b></td>'
elif [ "$1" = "passed" ]
then
	echo '<td BGCOLOR='$HTML_PASSEDCOLOR' NOSAVE>'$HTML_PASSEDMSG'</td>'
else
	echo '<td BGCOLOR='$HTML_MISSINGCOLOR' NOSAVE>'$HTML_MISSINGMSG'</td>'	
fi

if [ "$RESULT" = "0" ]
then
	echo '<td BGCOLOR='$HTML_MISSINGCOLOR' NOSAVE>'$HTML_MISSINGMSG'</td>'
else
	echo '<td>&nbsp;<a href="'$RESULT'">result</a>&nbsp;</td>'
fi
echo ''
if [ "$LOG" = "0" ]
then
	echo '<td BGCOLOR='$HTML_MISSINGCOLOR' NOSAVE>'$HTML_MISSINGMSG'</td>'
else
	echo '<td>&nbsp;<a href="'$LOG'">log</a>&nbsp;</td>'
fi
echo ''
if [ "$1" = "failed" ]
then
	echo '<td>&nbsp;<a href="#errorlist">error</a>&nbsp;</td>'
else
	echo '<td></td>'
fi
echo '<td>'$TESTDATE $TESTNUMBER'</td>'
echo '</tr>'

}

################################# qa_errorlist #########################
# local shell function, finds problems in the previously run QA
########################################################################
qa_errorlist()
{
	if [ "$1" = "1" ]
	then
		echo "	R e s u l t		E r r o r l i s t"
		lline
	fi

	#FIXME it should also examine the files for passed messages, since 
	#sometimes empty results and output.log files are generated
	grep red */results.html | 
		sed -e 's/.results.html:<TR><TD>/ /' -e 's/<[^>]*>/ /g'
	if [ "$1" = "1" ]
	then
		lline
		echo "	O u t p u t		E r r o r / W a r n i n g l i s t"
		lline
	fi

	grep 'cache hits; .* cache misses, .* cache not reusable' */output.log | 
		grep -v selfserv |
		grep -v '0 cache hits; 1 cache misses, 0 cache not reusable' | 
		grep -v '0 cache hits; 0 cache misses, 0 cache not reusable' | 
		grep -v ' cache hits; 1 cache misses, 0 cache not reusable'
		#grep -v '999 cache hits; 1 cache misses, 0 cache not reusable'
	
	if [ "$1" = "1" ]
	then
		lline
		echo "	C o r e l i s t "
		lline
	fi
	
	find . -name core -print 2>/dev/null

}

platformlist()
{
	lline
	echo "	P l a t f o r m l i s t "
	
	grep Platform */results.html | 
		sed -e 's/.results.html:<H4>Platform:/	/' \
			-e 's/<BR>//' |
	while read MACHINE BUILDPLATFORM
	do
		grep $MACHINE $1 >/dev/null
		ret=$?
		setQAsysvars
		if [ $ret -eq 0 ]
		then
			echo "Failed $MACHINE $BUILDPLATFORM"
			html_line failed >>$HTML_FILE
			#echo "1 $MACHINE $BUILDPLATFORM Failed 2" 
		else
			echo "Passed $MACHINE $BUILDPLATFORM"
			html_line passed >>$HTML_FILE
			#echo "1 $MACHINE $BUILDPLATFORM passed 2"
		fi
	done 

}

############################ check_platforms ###########################
# local shell function, finds out if we ran on all required platforms
########################################################################
check_platforms()
{
	#lline
	#echo "	M i s s i n g  P l a t f o r m s"
	#lline
	QA_MISSING="QA report missing"
	MACHINE="0"

	for BUILDPLATFORM in `cat $TESTSCRIPTDIR/platformlist`
	do
		grep $BUILDPLATFORM $TMP_PLATFORMLIST_FILE > /dev/null || {
			echo "$BUILDPLATFORM not tested: $QA_MISSING" >>$TMP_P_FILE
			setQAsysvars
			html_line missing >>$HTML_FILE


		}
	done
}

lline()
{
	echo
	echo "------------------------------------------------------------------"
	echo
}

header()
{
	lline
	echo "QA results for NSS $NSSVER builddate $QAYEAR $BUILDDATE "
	echo "today's date `date`"
	lline
	echo "testing in $RESULTDIR"
}

rsaperf()
{
	grep RSAPERF */output.log | grep -v "_DBG" > $TMP_PERF_FILE
	
    echo '&nbsp;'
	echo '<br>&nbsp;'
	echo '<center>'
	echo '<h1>'
	echo '<a NAME="Performance list"></a>Performance list</h1></center>'
	echo '&nbsp;'
	echo '<table BORDER WIDTH="100%" NOSAVE >'
	echo '<tr NOSAVE>'
	echo '<td NOSAVE><b><font size=+1>Build-OS and version</font></b></td>'
	echo ''
	echo '<td><b><font size=+1>Systemname</font></b></td>'
	echo ''
	echo '<td><b><font size=+1># of iterations</font></b></td>'
	echo ''
	echo '<td><b><font size=+1>average for one op</font></b></td>'
	echo ''
	echo '<td><b><font size=+1>Total</font></b></td>'
	echo ''
	echo '<td><b><font size=+1>QA time / #</font></b></td>'
	echo '</tr>'
	cat $TMP_PERF_FILE | while read MACHINE BUILDPLATFORM no_iter t1 t2 total total_unit t3 t4 t5 average average_unit
	do
		BUILD_SYS=`echo $BUILDPLATFORM | sed -e 's/\.OBJ//' \
			-e 's/_DBG/ Debug/' \
			-e 's/_OPT/ Optimized/'  -e 's/_64/ 64bit/' -e 's/_glibc_PTH//' \
			-e 's/_/ /'`
		TESTNUMBER=`echo $MACHINE | sed -e 's/[^\.]*\.//' -e 's/\/.*//'`
		MACHINE=`echo $MACHINE | sed -e 's/\..*//'`
		TESTDATE=`ls -ld ${MACHINE}.${TESTNUMBER} | awk '{ print $5, $6, $7 }'`
		echo '<tr>'
		echo '<td>'$BUILD_SYS'</td>'
		echo ''
		echo '<td>'$MACHINE'</td>'
		echo ''
		echo '<td>'$no_iter'</td>'
		echo ''
		echo '<td>'$average' '$average_unit'</td>'
		echo ''
		echo '<td>'$total' '$total_unit'</td>'
		echo ''
		echo '<td>'$TESTDATE $TESTNUMBER'</td>'
		echo ''
		echo '</tr>'
	done
	echo '</table>'
}

set_files

find_qa_systems 2>/dev/null

#header > $RFILE

qa_errorlist 1 > $TMP_E_FILE

cat $TMP_E_FILE

platformlist $TMP_E_FILE > $RFILE

cat $RFILE

echo "" >$TMP_P_FILE

check_platforms $RFILE 

html_eot >>$HTML_FILE


rsaperf >>$HTML_FILE

echo '<a NAME="errorlist"></a>' >> $HTML_FILE

qa_errorlist 2  | sed -e "s/^/<br>/" >>$HTML_FILE

html_footer >>$HTML_FILE

EARLY_EXIT=FALSE
FILENAME=$HTML_FILE		#we might want to mail it...
Exit