1#!/bin/bash
2#
3# @echo off
4#
5# Calculate the current state of all bugs
6# and report the summary tables.
7#
8# Paremeters:
9#
10# arg1 - the first multi-result directory
11# arg2 - the second multi-result directory
12#
13#    Note: fictitious invalid name could be applied instead of either arg1 or arg2.
14#
15# arg3 - ALLBUGS file which is a manually prepared description of all bugs,
16#        those features of current state of bugs which could not be obtained
17#        automatically
18# arg4 - kernel bugzilla Bug List file
19# arg5 - local bugzilla Bug List file
20#
21# (for additional comments see Do and asltsrun utilities).
22
23# Includes
24
25. common
26. settings
27
28print_complete_list_per_comp=yes
29
30# Opcodes of TEST-RESULT
31PASS=0
32FAIL=1
33BLOCKED=2
34SKIPPED=3
35UNDEFINED=4
36
37ST_FAIL=" FAIL       "
38ST_BLCK=" BLOCKED    "
39ST_PASS=" PASS       "
40ST_SKIP=" SKIPPED    "
41ST_UNDF=" UNDEFINED  "
42ST_EMPT="            "
43
44# Opcodes of (STATE-MANUALLY)
45Man_REJECTED=0
46Man_FIXED=1
47Man_INTEGRATED=2
48Man_FIXED_INTEGRATED=3
49Man_EMPTY=4
50Man_UNDEFINED=5
51
52# Overall status
53REJ_STATUS=0
54PASS_STATUS=1
55FAIL_STATUS=2
56
57# Opcodes of component
58I_COMP=0
59C_COMP=1
60M_COMP=2
61U_COMP=3
62S_COMP=4
63UNDEF_COMP=5
64
65
66# Return opcode of TEST-RESULT according to weights
67gen_stat()
68{
69	if [ "x$1" != x ]; then
70		stat=`echo "$1" | awk -F: '{ print $4}'`
71		if [ "$stat" != 0 ]; then
72			rval=$FAIL
73		else
74			stat=`echo "$1" | awk -F: '{ print $5}'`
75			if [ "$stat" != 0 ]; then
76				if [ "$rval" != $FAIL ]; then
77					rval=$BLOCKED
78				fi
79			else
80				stat=`echo "$1" | awk -F: '{ print $6}'`
81				if [ "$stat" != 0 ]; then
82					if [ "$rval" != $FAIL -a "$rval" != $BLOCKED ]; then
83						rval=$PASS
84					fi
85				else
86					stat=`echo "$1" | awk -F: '{ print $7}'`
87					if [ "$stat" != 0 ]; then
88						if [ "$rval" != $FAIL -a "$rval" != $BLOCKED -a "$rval" != $PASS ]; then
89							rval=$SKIPPED
90						fi
91					fi
92				fi
93			fi
94		fi
95	fi
96}
97
98# Inputs/outputs are 'Opcodes of TEST-RESULT'
99generate_status()
100{
101	rval="$UNDEFINED"
102
103	gen_stat "$c32n_GL"
104	gen_stat "$c64n_GL"
105	gen_stat "$c32s_GL"
106	gen_stat "$c64s_GL"
107	gen_stat "$l32n_GL"
108	gen_stat "$l64n_GL"
109	gen_stat "$l32s_GL"
110	gen_stat "$l64s_GL"
111
112	return $rval
113}
114
115# Get name of 'Opcode of TEST-RESULT'
116get_test_result_name()
117{
118	case $1 in
119		0) echo "$ST_PASS";;
120		1) echo "$ST_FAIL";;
121		2) echo "$ST_BLCK";;
122		3) echo "$ST_SKIP";;
123		4) echo "$ST_UNDF";;
124		*)  echo "?"
125	esac
126}
127
128get_state_result()
129{
130	if [ "x$2" != x ]; then
131		State=`get_element_of_line  "$1" ":" $2 0`
132		Result=`get_element_of_line "$1" ":" $2 1`
133		if [ "x$State" == x ]; then
134			StateResult="         "
135		elif [ "$State" == NEW ]; then
136			StateResult="$State      "
137		elif [ "x$Result" == x ]; then
138			StateResult="$State     "
139		else
140			StateResult="$State $Result"
141		fi
142	else
143		StateResult="         "
144	fi
145
146	echo "$StateResult"
147}
148
149# Check(STATE-MANUALLY) == {REJECTED|FIXED|INTEGRATED|FIXED INTEGRATED|<empty>}
150check_state_manually()
151{
152	rval=$Man_UNDEFINED
153
154	x=`echo "$1" | awk -F" " '{print $1}'`
155	y=`echo "$1" | awk -F" " '{print $2}'`
156
157	# FIXED INTEGRATED
158	if [ "x$y" != x ]; then
159		if [ "$x" != FIXED -o "$y" != INTEGRATED ]; then
160			CerrSTMAN=h
161		else
162			rval=$Man_FIXED_INTEGRATED
163			z=`echo "$1" | awk -F" " '{print NF}'`
164			if [ "$z" != 2 ]; then
165				CerrSTMAN=i
166			fi
167		fi
168	elif [ "$x" == REJECTED ]; then
169		rval=$Man_REJECTED
170	elif [ "$x" == FIXED ]; then
171		rval=$Man_FIXED
172	elif [ "$x" == INTEGRATED ]; then
173		rval=$Man_INTEGRATED
174	elif [ "x$x" == x ]; then
175		rval=$Man_EMPTY
176	else
177		CerrSTMAN=j
178	fi
179
180	return $rval
181}
182
183# Check(TEST-RESULT) == {PASS|FAIL|BLOCKED|SKIPPED|UNDEFINED}
184check_test_result()
185{
186	if [ "$1" != $PASS\
187		-a "$1" != $FAIL\
188		-a "$1" != $BLOCKED\
189		-a "$1" != $SKIPPED\
190		-a "$1" != $UNDEFINED ]; then
191		CerrTSRESID=k
192	fi
193}
194
195check_conformity()
196{
197	entry=7
198	rval=$FAIL_STATUS
199
200	if [ "$1" == $Man_REJECTED ]; then
201		entry=0
202		rval=$REJ_STATUS
203	elif [ "$1" == $Man_FIXED -a "$2" == $UNDEFINED ]; then
204		entry=1
205		rval=$PASS_STATUS
206	elif [ "$1" == $Man_FIXED_INTEGRATED -a "$2" == $UNDEFINED ]; then
207		entry=1
208		rval=$PASS_STATUS
209	elif [ "$1" == $Man_EMPTY -o "$1" == $Man_INTEGRATED ]; then
210		if [ "$2" == $PASS ]; then
211			entry=2
212			rval=$PASS_STATUS
213		elif [ "$2" == $FAIL ]; then
214			entry=4
215			rval=$FAIL_STATUS
216		elif [ "$2" == $BLOCKED ]; then
217			entry=5
218			rval=$FAIL_STATUS
219		elif [ "$2" == $SKIPPED ]; then
220			entry=3
221			rval=$PASS_STATUS
222		elif [ "$2" == $UNDEFINED ]; then
223			entry=6
224			rval=$FAIL_STATUS
225		else
226			CerrCONFORMITY=l
227		fi
228	else
229		entry=7
230		echo "ERROR 0: check_conformity, <$1> <$2>"
231		InternalErrCount=$[ $InternalErrCount + 1 ]
232		CerrCONFORMITY=m
233	fi
234
235	if [ "$1" == $Man_FIXED_INTEGRATED -o "$1" == $Man_INTEGRATED ]; then
236		if [ "x$LBZID" == x -a "x$KBZID" == x ]; then
237			CerrCONFORMITY=u
238		fi
239	fi
240
241	entry_of_table=$entry
242
243	return $rval
244}
245
246# Check(COMP) == {I|C|M|U|S}
247check_component()
248{
249	rval=$UNDEF_COMP
250
251	if [[ "$1" == I* ]]; then
252		rval=$I_COMP
253	elif [[ "$1" == C* ]]; then
254		rval=$C_COMP
255	elif [[ "$1" == M* ]]; then
256		rval=$M_COMP
257	elif [[ "$1" == U* ]]; then
258		rval=$U_COMP
259	elif [[ "$1" == S* ]]; then
260		rval=$S_COMP
261	else
262		CerrCOMP=g
263		echo "ERROR 0: check_component, <$1>"
264		InternalErrCount=$[ $InternalErrCount + 1 ]
265	fi
266
267	return $rval
268}
269
270report_state_of_bugs()
271{
272	local second_file=
273
274	rintinbzcnt=0
275	notresolvedcnt=0
276	rnotintcnt=0
277	rjinbzilla=0
278	rstateinbzilla=0
279	rstateinbzillafail=0
280
281	init_summary_table
282
283	echo ""
284	echo ""
285	echo ""
286	echo "Table 1  (Complete list of per-bug states)"
287	echo ""
288
289	report_head_of_table
290
291	OLD_IFS=$IFS
292	IFS="|"
293
294	cat\
295		"$BDEMO_SUM"\
296		"$ALLBUGS" |\
297	while [ 1 ]
298	do
299		read number s0 s1 s2 s3 s4 s5 s6 s7
300		if [ $? -ne 0 ] ; then
301			do_report_summary
302			echo ""
303			report_errors_encountered
304			echo ""
305			echo ""
306			echo ""
307			report_bug_summary
308			echo ""
309			echo ""
310			echo ""
311			report_rejected_in_bzilla
312			echo ""
313			echo ""
314			echo ""
315			report_resolved_integrated
316			echo ""
317			echo ""
318			echo ""
319			report_resolved_not_integrated
320			echo ""
321			echo ""
322			echo ""
323			report_not_resolved
324			echo ""
325			echo ""
326			echo ""
327			report_resolved_state_in_bzilla
328			echo ""
329			echo ""
330			echo ""
331			report_resolved_state_in_bzilla_but_fail
332			echo ""
333			echo ""
334			echo ""
335			report_bzilla_summary
336			echo ""
337			echo ""
338			echo ""
339			report_internal_bugs_number
340
341			break
342		fi
343
344		if [ "$number" == ALLBUGS ] ; then
345			second_file=yes
346			continue
347		fi
348
349		if [ "$second_file" == yes ] ; then
350
351			if [ "x$number" == x ]; then
352				continue
353			fi
354
355			CerrMISC=" "
356
357			# Local/kernel bugzilla State/Result parameters
358
359			LBZID=`echo $s1 | sed 's/ //'g`
360			lst=`get_state_result "$LBSUM_PARSED"  "$LBZID"`
361
362			KBZID=`echo $s2 | sed 's/ //'g`
363			kst=`get_state_result "$KBSUM_PARSED"  "$KBZID"`
364
365			lState=`echo "$lst" | awk -F" " '{print $1}'`
366			lResult=`echo "$lst" | awk -F" " '{print $2}'`
367
368			kState=`echo "$kst" | awk -F" " '{print $1}'`
369			kResult=`echo "$kst" | awk -F" " '{print $2}'`
370
371			resolved_state_in_bzilla=
372			resolved_state_in_bzilla_but_fail=
373
374			if [ "$lState" == RESO\
375				-o "$lState" == REJE\
376				-o "$lState" == CLOS\
377				-o "$kState" == RESO\
378				-o "$kState" == REJE\
379				-o "$kState" == CLOS ]; then
380				resolved_state_in_bzilla=yes
381			fi
382
383
384			# Check consistancy of bug-data.
385			#
386			# Check that the state of bugs reported by local and kernel
387			# bugzilla dont contradict with the actual state of bugs
388			# reported by test runs and manually provided data.
389
390			# Check STATE-MANUALLY (error # 1)
391
392			CerrSTMAN=" "
393			check_state_manually "$s3"
394			MANstat=$?
395
396			# Check TEST-RESULT (error # 1)
397
398			TSRESstat="${SUMMARY[$number]}"
399
400			CerrTSRESID=" "
401			check_test_result "$TSRESstat"
402
403			# Check Component (error # 2,3,4,5,6)
404
405			LerrCOMP=" "
406			KerrCOMP=" "
407			CerrCOMP=" "
408
409			Component=`echo $s0 | sed 's/ //'g`
410			check_component "$Component"
411			Component=$?
412
413			if [ "x$KBZID" != x ]; then
414				if [ "x$kState" == x ]; then
415					KerrCOMP=s
416				else
417					Comp=`get_element_of_line  "$KBSUM_PARSED" ":" "$KBZID" 2`
418					if [ "$Comp" != "ACPI" ]; then
419						KerrCOMP=v
420					elif [[ "$Component" != $I_COMP ]]; then
421						KerrCOMP=f
422					fi
423				fi
424			fi
425			if [ "x$LBZID" != x ]; then
426
427				if [ "x$lState" == x ]; then
428					LerrCOMP=s
429				else
430					Comp=`get_element_of_line  "$LBSUM_PARSED" ":" "$LBZID" 2`
431					if [ "$Comp" == "Core/Int" ]; then
432						if [[ "$Component" != $I_COMP ]]; then
433							LerrCOMP=a
434						fi
435					elif [ "$Comp" == "iASL Com" ]; then
436						if [[ "$Component" != $C_COMP ]]; then
437							LerrCOMP=b
438						fi
439					elif [ "$Comp" == "ACPI Spe" ]; then
440						if [[ "$Component" != $S_COMP ]]; then
441							LerrCOMP=c
442						fi
443					elif [ "$Comp" == "Utilitie" ]; then
444						if [ "$Component" != $U_COMP -a "$Component" != $M_COMP ]; then
445							LerrCOMP=d
446						fi
447					else
448						LerrCOMP=e
449					fi
450				fi
451			fi
452
453			# Check conformity of STATE-MANUALLY & TEST-RESULT (error # 1)
454
455			CerrCONFORMITY=" "
456			entry_of_table=100
457			check_conformity "$MANstat" "$TSRESstat"
458			overall_status=$?
459
460
461			# Increment the relevant entry of the summary table
462			if [ "$Component" != $UNDEF_COMP ]; then
463				increment_summary_table "$Component" "$entry_of_table"
464			else
465				CerrMISC=t
466				echo "ERROR 0: report_state_of_bugs, <$number> <$Component> <$entry_of_table>"
467				InternalErrCount=$[ $InternalErrCount + 1 ]
468			fi
469
470
471			if [ "$overall_status" == $FAIL_STATUS ]; then
472				tobefixed="*"
473			else
474				tobefixed=" "
475			fi
476
477			# Check REJECTED (error # 1)
478
479			LerrRJ=" "
480			KerrRJ=" "
481
482			if [ "x$LBZID" != x -o "x$KBZID" != x ]; then
483
484				MNrejected=
485				if [ "$overall_status" == $REJ_STATUS ]; then
486					MNrejected=yes
487				fi
488
489				# Local bugzilla
490
491				if [ "x$LBZID" != x ]; then
492					rejected=
493					if [ "$lResult" == INVA ]; then
494						rejected=yes
495					fi
496					if [ "$rejected" != "$MNrejected" ]; then
497						LerrRJ=A
498					fi
499				fi
500
501				# Kernel bugzilla
502
503				if [ "x$KBZID" != x ]; then
504					rejected=
505					if [ "$kState" == REJE ]; then
506						rejected=yes
507					fi
508					if [ "$rejected" != "$MNrejected" ]; then
509						KerrRJ=F
510					fi
511				fi
512			fi
513
514			# Check State-Result (error # 7,8,9,a,b,c,d,e)
515
516			intgr=
517			if [[ "$s3" == *INTEGRATED* ]]; then
518				intgr=yes
519			fi
520
521			LerrSTAT=" "
522			LerrRES=" "
523			KerrSTAT=" "
524			KerrRES=" "
525			CerrPRIOR=" "
526
527			x=`echo $s4 | sed 's/ //'g`
528
529			if [ "$overall_status" == $REJ_STATUS ]; then
530				if [ "x$x" != x ]; then
531					CerrPRIOR=n
532				fi
533			elif [ "$overall_status" == $PASS_STATUS ]; then
534				if [ "x$LBZID" != x ]; then
535					if [ "$lState" == CLOS -a "x$intgr" == x ]; then
536						LerrSTAT=L
537					elif [ "$lState" != RESO -a "$lState" != CLOS ]; then
538						LerrSTAT=R
539					elif [ "$lState" == RESO ]; then
540						LerrSTAT=C
541						if [ "$lResult" != FIXE ]; then
542							LerrRES=D
543						fi
544					else
545						if [ "$lResult" != FIXE ]; then
546							LerrRES=D
547						fi
548					fi
549				fi
550				if [ "x$KBZID" != x ]; then
551					if [ "$kState" == CLOS -a "x$intgr" == x ]; then
552						KerrSTAT=L
553					elif [ "$kState" != RESO -a "$kState" != CLOS ]; then
554						KerrSTAT=R
555					elif [ "$kState" == RESO ]; then
556						KerrSTAT=C
557						if [ "$kResult" != CODE -a "$kResult" != PATC ]; then
558							KerrRES=H
559						fi
560					else
561						if [ "$kResult" != CODE -a "$kResult" != PATC ]; then
562							KerrRES=H
563						fi
564					fi
565				fi
566				if [ "x$x" != x ]; then
567					CerrPRIOR=o
568				fi
569			else
570				if [ "x$LBZID" != x ]; then
571					if [ "$lState" == RESO\
572						-o "$lState" == CLOS ]; then
573						LerrSTAT=B
574					elif [ "$lResult" == FIXE\
575							-o "$lResult" == CODE\
576							-o "$lResult" == PATC ]; then
577						LerrRES=E
578					fi
579				fi
580				if [ "x$KBZID" != x ]; then
581					if [ "$kState" == RESO\
582						-o "$kState" == CLOS ]; then
583						KerrSTAT=G
584					elif [ "$kResult" == FIXE\
585							-o "$kResult" == CODE\
586							-o "$kResult" == PATC ]; then
587						KerrRES=J
588					fi
589				fi
590
591				if [ "x$LBZID" == x -a "x$KBZID" == x ]; then
592					LerrSTAT=r
593					KerrSTAT=r
594				fi
595				if [ "x$x" == x ]; then
596					CerrPRIOR=p
597				fi
598			fi
599
600			# Check INTEGRATED (error # f,g,h,i)
601
602			CerrINTEGR=" "
603
604			rejected_in_bz=
605			rejected_not_in_bz=
606			not_resolved=
607			resolved_integrated_in_bz=
608			resolved_not_integrated_in_bz=
609
610			if [ "$overall_status" == $REJ_STATUS ]; then
611				if [ "x$KBZID" != x -o "x$LBZID" != x ]; then
612					rejected_in_bz=yes
613				else
614					rejected_not_in_bz=yes
615				fi
616			elif [ "$overall_status" == $FAIL_STATUS ]; then
617				not_resolved=yes
618				if [ "x$LBZID" != x -o "x$KBZID" != x ]; then
619					if [ "$resolved_state_in_bzilla" == yes ]; then
620						resolved_state_in_bzilla_but_fail=yes
621					fi
622					if [ "x$intgr" != x ]; then
623						CerrINTEGR=K
624					fi
625				fi
626			else
627				if [ "x$LBZID" != x -o "x$KBZID" != x ]; then
628					if [ "x$intgr" == x ]; then
629						CerrINTEGR=I
630						resolved_not_integrated_in_bz=yes
631					else
632						resolved_integrated_in_bz=yes
633					fi
634				fi
635			fi
636
637			# Local & Kernel bugzilla summary
638
639			if [ "x$LBZID" != x -o "x$KBZID" != x ]; then
640
641				if [ "$kState" == NEW ]; then
642					KBarr[0]=$[ ${KBarr[0]} + 1 ]
643				elif [ "$kState" == ASSI ]; then
644					KBarr[1]=$[ ${KBarr[1]} + 1 ]
645				elif [ "$kState" == NEED ]; then
646					KBarr[2]=$[ ${KBarr[2]} + 1 ]
647				elif [ "$kState" == RESO ]; then
648					if [ "$kResult" == CODE ]; then
649						KBarr[3]=$[ ${KBarr[3]} + 1 ]
650					elif [ "$kResult" == PATC ]; then
651						KBarr[4]=$[ ${KBarr[4]} + 1 ]
652					elif [ "$kResult" == FIXE ]; then
653						KBarr[5]=$[ ${KBarr[5]} + 1 ]
654					elif [ "$kResult" == INVA ]; then
655						KBarr[6]=$[ ${KBarr[6]} + 1 ]
656					else
657						KBarr[9]=$[ ${KBarr[9]} + 1 ]
658					fi
659				elif [ "$kState" == REJE ]; then
660					if [ "$kResult" == DOCU ]; then
661						KBarr[7]=$[ ${KBarr[7]} + 1 ]
662					else
663						KBarr[9]=$[ ${KBarr[9]} + 1 ]
664					fi
665				elif [ "$kState" == CLOS ]; then
666					if [ "$kResult" == CODE ]; then
667						KBarr[8]=$[ ${KBarr[8]} + 1 ]
668					else
669						KBarr[9]=$[ ${KBarr[9]} + 1 ]
670					fi
671				fi
672
673				if [ "$lState" == NEW ]; then
674					LBarr[0]=$[ ${LBarr[0]} + 1 ]
675				elif [ "$lState" == ASSI ]; then
676					LBarr[1]=$[ ${LBarr[1]} + 1 ]
677				elif [ "$lState" == NEED ]; then
678					LBarr[2]=$[ ${LBarr[2]} + 1 ]
679				elif [ "$lState" == RESO ]; then
680					if [ "$lResult" == CODE ]; then
681						LBarr[3]=$[ ${LBarr[3]} + 1 ]
682					elif [ "$lResult" == PATC ]; then
683						LBarr[4]=$[ ${LBarr[4]} + 1 ]
684					elif [ "$lResult" == FIXE ]; then
685						LBarr[5]=$[ ${LBarr[5]} + 1 ]
686					elif [ "$lResult" == INVA ]; then
687						LBarr[6]=$[ ${LBarr[6]} + 1 ]
688					else
689						LBarr[9]=$[ ${LBarr[9]} + 1 ]
690					fi
691				elif [ "$lState" == REJE ]; then
692					if [ "$lResult" == DOCU ]; then
693						LBarr[7]=$[ ${LBarr[7]} + 1 ]
694					else
695						LBarr[9]=$[ ${LBarr[9]} + 1 ]
696					fi
697				elif [ "$lState" == CLOS ]; then
698					if [ "$lResult" == CODE ]; then
699						LBarr[8]=$[ ${LBarr[8]} + 1 ]
700					else
701						LBarr[9]=$[ ${LBarr[9]} + 1 ]
702					fi
703				fi
704
705				if [ "$overall_status" == $REJ_STATUS ]; then
706					if [ "x$LBZID" != x ]; then
707						LBarr[10]=$[ ${LBarr[10]} + 1 ]
708					fi
709					if [ "x$KBZID" != x ]; then
710						KBarr[10]=$[ ${KBarr[10]} + 1 ]
711					fi
712				elif [ "$overall_status" == $PASS_STATUS ]; then
713					if [ "x$LBZID" != x ]; then
714						LBarr[11]=$[ ${LBarr[11]} + 1 ]
715					fi
716					if [ "x$KBZID" != x ]; then
717						KBarr[11]=$[ ${KBarr[11]} + 1 ]
718					fi
719				else
720					if [ "x$LBZID" != x ]; then
721						LBarr[12]=$[ ${LBarr[12]} + 1 ]
722					fi
723					if [ "x$KBZID" != x ]; then
724						KBarr[12]=$[ ${KBarr[12]} + 1 ]
725					fi
726				fi
727			fi
728
729			TSRESname=`get_test_result_name "$TSRESstat"`
730			if [ "$overall_status" == $REJ_STATUS ]; then
731				TSRESname="$ST_EMPT"
732			fi
733
734			# Summary error string
735
736			LErrStr="$LerrRJ$LerrCOMP$LerrSTAT$LerrRES"
737			KErrStr="$KerrRJ$KerrCOMP$KerrSTAT$KerrRES"
738			CommonErrStr="$CerrCOMP$CerrSTMAN$CerrTSRESID$CerrCONFORMITY$CerrPRIOR$CerrINTEGR"
739			AllErrors="$LErrStr$KErrStr$CommonErrStr$CerrMISC $tobefixed"
740			x=`echo "$AllErrors" | sed 's/ //'g`
741			AccumulateErrors="$AccumulateErrors$x"
742			line="$AllErrors|$number|$s0|$s1|$lst|$s2|$kst|$TSRESname|$s3|$s4| $tobefixed$s5"
743			SUMMARY[$number]="$line"
744
745			if [ "x$print_complete_list_per_comp" != x ]; then
746				if [[ "$Component" == $I_COMP ]]; then
747					SUMMARY_I="$SUMMARY_I:$number"
748				elif [[ "$Component" == $C_COMP ]]; then
749					SUMMARY_C="$SUMMARY_C:$number"
750				elif [[ "$Component" == $M_COMP ]]; then
751					SUMMARY_M="$SUMMARY_M:$number"
752				elif [[ "$Component" == $U_COMP ]]; then
753					SUMMARY_U="$SUMMARY_U:$number"
754				elif [[ "$Component" == $S_COMP ]]; then
755					SUMMARY_S="$SUMMARY_S:$number"
756				else
757					SUMMARY_UNDEF="$SUMMARY_UNDEF:$number"
758				fi
759			fi
760
761			if [ "$not_resolved" == yes ]; then
762				if [[ "$Component" == $I_COMP ]]; then
763					NOT_RESOLVED_I="$NOT_RESOLVED_I:$number"
764				elif [[ "$Component" == $C_COMP ]]; then
765					NOT_RESOLVED_C="$NOT_RESOLVED_C:$number"
766				elif [[ "$Component" == $M_COMP ]]; then
767					NOT_RESOLVED_M="$NOT_RESOLVED_M:$number"
768				elif [[ "$Component" == $U_COMP ]]; then
769					NOT_RESOLVED_U="$NOT_RESOLVED_U:$number"
770				elif [[ "$Component" == $S_COMP ]]; then
771					NOT_RESOLVED_S="$NOT_RESOLVED_S:$number"
772				else
773					NOT_RESOLVED_UNDEF="$NOT_RESOLVED_UNDEF:$number"
774				fi
775				notresolvedcnt=$[ $notresolvedcnt + 1 ]
776			elif [ "$resolved_integrated_in_bz" == yes ]; then
777				if [[ "$Component" == $I_COMP ]]; then
778					RESOLVED_INTEGRATED_IN_BZ_I="$RESOLVED_INTEGRATED_IN_BZ_I:$number"
779				elif [[ "$Component" == $C_COMP ]]; then
780					RESOLVED_INTEGRATED_IN_BZ_C="$RESOLVED_INTEGRATED_IN_BZ_C:$number"
781				elif [[ "$Component" == $M_COMP ]]; then
782					RESOLVED_INTEGRATED_IN_BZ_M="$RESOLVED_INTEGRATED_IN_BZ_M:$number"
783				elif [[ "$Component" == $U_COMP ]]; then
784					RESOLVED_INTEGRATED_IN_BZ_U="$RESOLVED_INTEGRATED_IN_BZ_U:$number"
785				elif [[ "$Component" == $S_COMP ]]; then
786					RESOLVED_INTEGRATED_IN_BZ_S="$RESOLVED_INTEGRATED_IN_BZ_S:$number"
787				else
788					RESOLVED_INTEGRATED_IN_BZ_UNDEF="$RESOLVED_INTEGRATED_IN_BZ_UNDEF:$number"
789				fi
790				rintinbzcnt=$[ $rintinbzcnt + 1 ]
791			elif [ "$resolved_not_integrated_in_bz" == yes ]; then
792				if [[ "$Component" == $I_COMP ]]; then
793					RESOLVED_NOT_INTEGRATED_IN_BZ_I="$RESOLVED_NOT_INTEGRATED_IN_BZ_I:$number"
794				elif [[ "$Component" == $C_COMP ]]; then
795					RESOLVED_NOT_INTEGRATED_IN_BZ_C="$RESOLVED_NOT_INTEGRATED_IN_BZ_C:$number"
796				elif [[ "$Component" == $M_COMP ]]; then
797					RESOLVED_NOT_INTEGRATED_IN_BZ_M="$RESOLVED_NOT_INTEGRATED_IN_BZ_M:$number"
798				elif [[ "$Component" == $U_COMP ]]; then
799					RESOLVED_NOT_INTEGRATED_IN_BZ_U="$RESOLVED_NOT_INTEGRATED_IN_BZ_U:$number"
800				elif [[ "$Component" == $S_COMP ]]; then
801					RESOLVED_NOT_INTEGRATED_IN_BZ_S="$RESOLVED_NOT_INTEGRATED_IN_BZ_S:$number"
802				else
803					RESOLVED_NOT_INTEGRATED_IN_BZ_UNDEF="$RESOLVED_NOT_INTEGRATED_IN_BZ_UNDEF:$number"
804				fi
805				rnotintcnt=$[ $rnotintcnt + 1 ]
806			elif [ "$rejected_in_bz" == yes ]; then
807				REJECTED_IN_BZILLA="$REJECTED_IN_BZILLA:$number"
808				rjinbzilla=$[ $rjinbzilla + 1 ]
809			elif [ "$rejected_not_in_bz" == yes ]; then
810				if [[ "$Component" == $I_COMP ]]; then
811					REJECTED_NOT_IN_BZILLA_I="$REJECTED_NOT_IN_BZILLA_I:$number"
812				elif [[ "$Component" == $C_COMP ]]; then
813					REJECTED_NOT_IN_BZILLA_C="$REJECTED_NOT_IN_BZILLA_C:$number"
814				elif [[ "$Component" == $M_COMP ]]; then
815					REJECTED_NOT_IN_BZILLA_M="$REJECTED_NOT_IN_BZILLA_M:$number"
816				elif [[ "$Component" == $U_COMP ]]; then
817					REJECTED_NOT_IN_BZILLA_U="$REJECTED_NOT_IN_BZILLA_U:$number"
818				elif [[ "$Component" == $S_COMP ]]; then
819					REJECTED_NOT_IN_BZILLA_S="$REJECTED_NOT_IN_BZILLA_S:$number"
820				else
821					REJECTED_NOT_IN_BZILLA_UNDEF="$REJECTED_NOT_IN_BZILLA_UNDEF:$number"
822				fi
823				rjnotinbzilla=$[ $rjnotinbzilla + 1 ]
824			fi
825
826			if [ "$resolved_state_in_bzilla" == yes ]; then
827				if [[ "$Component" == $I_COMP ]]; then
828					RESOLVED_STATE_IN_BZILLA_I="$RESOLVED_STATE_IN_BZILLA_I:$number"
829				elif [[ "$Component" == $C_COMP ]]; then
830					RESOLVED_STATE_IN_BZILLA_C="$RESOLVED_STATE_IN_BZILLA_C:$number"
831				elif [[ "$Component" == $M_COMP ]]; then
832					RESOLVED_STATE_IN_BZILLA_M="$RESOLVED_STATE_IN_BZILLA_M:$number"
833				elif [[ "$Component" == $U_COMP ]]; then
834					RESOLVED_STATE_IN_BZILLA_U="$RESOLVED_STATE_IN_BZILLA_U:$number"
835				elif [[ "$Component" == $S_COMP ]]; then
836					RESOLVED_STATE_IN_BZILLA_S="$RESOLVED_STATE_IN_BZILLA_S:$number"
837				else
838					RESOLVED_STATE_IN_BZILLA_UNDEF="$RESOLVED_STATE_IN_BZILLA_UNDEF:$number"
839				fi
840				rstateinbzilla=$[ $rstateinbzilla + 1 ]
841			fi
842
843			if [ "$resolved_state_in_bzilla_but_fail" == yes ]; then
844				if [[ "$Component" == $I_COMP ]]; then
845					RESOLVED_STATE_IN_BZILLA_BUT_FAIL_I="$RESOLVED_STATE_IN_BZILLA_BUT_FAIL_I:$number"
846				elif [[ "$Component" == $C_COMP ]]; then
847					RESOLVED_STATE_IN_BZILLA_BUT_FAIL_C="$RESOLVED_STATE_IN_BZILLA_BUT_FAIL_C:$number"
848				elif [[ "$Component" == $M_COMP ]]; then
849					RESOLVED_STATE_IN_BZILLA_BUT_FAIL_M="$RESOLVED_STATE_IN_BZILLA_BUT_FAIL_M:$number"
850				elif [[ "$Component" == $U_COMP ]]; then
851					RESOLVED_STATE_IN_BZILLA_BUT_FAIL_U="$RESOLVED_STATE_IN_BZILLA_BUT_FAIL_U:$number"
852				elif [[ "$Component" == $S_COMP ]]; then
853					RESOLVED_STATE_IN_BZILLA_BUT_FAIL_S="$RESOLVED_STATE_IN_BZILLA_BUT_FAIL_S:$number"
854				else
855					RESOLVED_STATE_IN_BZILLA_BUT_FAIL_UNDEF="$RESOLVED_STATE_IN_BZILLA_BUT_FAIL_UNDEF:$number"
856				fi
857				rstateinbzillafail=$[ $rstateinbzillafail + 1 ]
858			fi
859
860		else
861			c32n_GL="$s0"
862			c64n_GL="$s1"
863			c32s_GL="$s2"
864			c64s_GL="$s3"
865			l32n_GL="$s4"
866			l64n_GL="$s5"
867			l32s_GL="$s6"
868			l64s_GL="$s7"
869
870			generate_status "$number"
871			status=$?
872
873			if [ "x$number" != x ]; then
874				SUMMARY[$number]="$status"
875			fi
876		fi
877
878	done
879
880	IFS=$OLD_IFS
881}
882
883init_summary_table()
884{
885# Elements of arrays:
886#    0 - rejected
887#    1 - undef_fixed
888#    2 - pass
889#    3 - skipped
890#    4 - failed
891#    5 - blocked
892#    6 - undef_not_fixed
893
894	InternalErrCount=0
895
896# Interpreter
897	StINT[0]=0
898	StINT[1]=0
899	StINT[2]=0
900	StINT[3]=0
901	StINT[4]=0
902	StINT[5]=0
903	StINT[6]=0
904	StINT[7]=0
905
906# iASL
907	StASL[0]=0
908	StASL[1]=0
909	StASL[2]=0
910	StASL[3]=0
911	StASL[4]=0
912	StASL[5]=0
913	StASL[6]=0
914	StASL[7]=0
915
916# Simulation
917	StSIM[0]=0
918	StSIM[1]=0
919	StSIM[2]=0
920	StSIM[3]=0
921	StSIM[4]=0
922	StSIM[5]=0
923	StSIM[6]=0
924	StSIM[7]=0
925
926# Utilities
927	StUTIL[0]=0
928	StUTIL[1]=0
929	StUTIL[2]=0
930	StUTIL[3]=0
931	StUTIL[4]=0
932	StUTIL[5]=0
933	StUTIL[6]=0
934	StUTIL[7]=0
935
936# Specs 
937	StSPEC[0]=0
938	StSPEC[1]=0
939	StSPEC[2]=0
940	StSPEC[3]=0
941	StSPEC[4]=0
942	StSPEC[5]=0
943	StSPEC[6]=0
944	StSPEC[7]=0
945
946# LBarr
947
948	LBarr[0]=0
949	LBarr[1]=0
950	LBarr[2]=0
951	LBarr[3]=0
952	LBarr[4]=0
953	LBarr[5]=0
954	LBarr[6]=0
955	LBarr[7]=0
956	LBarr[8]=0
957	LBarr[9]=0
958	LBarr[10]=0
959	LBarr[11]=0
960	LBarr[12]=0
961
962# KBarr
963
964	KBarr[0]=0
965	KBarr[1]=0
966	KBarr[2]=0
967	KBarr[3]=0
968	KBarr[4]=0
969	KBarr[5]=0
970	KBarr[6]=0
971	KBarr[7]=0
972	KBarr[8]=0
973	KBarr[9]=0
974	KBarr[10]=0
975	KBarr[11]=0
976	KBarr[12]=0
977}
978
979increment_summary_table()
980{
981	if [ "$1" == $I_COMP ]; then
982		StINT[$2]=$[ ${StINT[$2]} + 1 ]
983	elif [ "$1" == $C_COMP ]; then
984		StASL[$2]=$[ ${StASL[$2]} + 1 ]
985	elif [ "$1" == $S_COMP ]; then
986		StSPEC[$2]=$[ ${StSPEC[$2]} + 1 ]
987	elif [ "$1" == $M_COMP ]; then
988		StSIM[$2]=$[ ${StSIM[$2]} + 1 ]
989	elif [ "$1" == $U_COMP ]; then
990		StUTIL[$2]=$[ ${StUTIL[$2]} + 1 ]
991	fi
992}
993
994report_bug_summary()
995{
996y0=$[ ${StINT[0]} + ${StASL[0]} + ${StSIM[0]} + ${StUTIL[0]} + ${StSPEC[0]} ]
997y1=$[ ${StINT[1]} + ${StASL[1]} + ${StSIM[1]} + ${StUTIL[1]} + ${StSPEC[1]} ]
998y2=$[ ${StINT[2]} + ${StASL[2]} + ${StSIM[2]} + ${StUTIL[2]} + ${StSPEC[2]} ]
999y3=$[ ${StINT[3]} + ${StASL[3]} + ${StSIM[3]} + ${StUTIL[3]} + ${StSPEC[3]} ]
1000
1001x="           "
1002echo "Table 2  (Summary of bugs)"
1003echo ""
1004echo "                             | Interpreter iASL        Simulation  Utilities   Specs   |   TOTAL   |"
1005echo "=============================|=========================================================|===========|"
1006echo "F      |*         & REJECTED | ${StINT[0]}$x${StASL[0]}$x${StSIM[0]}$x${StUTIL[0]}$x${StSPEC[0]}       | $y0"
1007echo " I     |UNDEFINED & FIXED    | ${StINT[1]}$x${StASL[1]}$x${StSIM[1]}$x${StUTIL[1]}$x${StSPEC[1]}       | $y1"
1008echo "  X    |PASS                 | ${StINT[2]}$x${StASL[2]}$x${StSIM[2]}$x${StUTIL[2]}$x${StSPEC[2]}       | $y2"
1009echo "   ED  |SKIPPED              | ${StINT[3]}$x${StASL[3]}$x${StSIM[3]}$x${StUTIL[3]}$x${StSPEC[3]}       | $y3"
1010echo "-----------------------------|---------------------------------------------------------|"
1011
1012y4=$[ ${StINT[4]} + ${StASL[4]} + ${StSIM[4]} + ${StUTIL[4]} + ${StSPEC[4]} ]
1013y5=$[ ${StINT[5]} + ${StASL[5]} + ${StSIM[5]} + ${StUTIL[5]} + ${StSPEC[5]} ]
1014y6=$[ ${StINT[6]} + ${StASL[6]} + ${StSIM[6]} + ${StUTIL[6]} + ${StSPEC[6]} ]
1015# y7=$[ ${StINT[7]} + ${StASL[7]} + ${StSIM[7]} + ${StUTIL[7]} + ${StSPEC[7]} ]
1016
1017x00=$[ ${StINT[0]} + ${StINT[1]} + ${StINT[2]} + ${StINT[3]} ]
1018x01=$[ ${StASL[0]} + ${StASL[1]} + ${StASL[2]} + ${StASL[3]} ]
1019x02=$[ ${StSIM[0]} + ${StSIM[1]} + ${StSIM[2]} + ${StSIM[3]} ]
1020x03=$[ ${StUTIL[0]} + ${StUTIL[1]} + ${StUTIL[2]} + ${StUTIL[3]} ]
1021x04=$[ ${StSPEC[0]} + ${StSPEC[1]} + ${StSPEC[2]} + ${StSPEC[3]} ]
1022x05=$[ $x00 + $x01 + $x02 + $x03 + $x04 ]
1023
1024echo "        Total (fixed)        | $x00$x$x01$x$x02$x$x03$x$x04       | $x05"
1025
1026echo "-----------------------------|---------------------------------------------------------|"
1027echo "TO     |FAIL                 | ${StINT[4]}$x${StASL[4]}$x${StSIM[4]}$x${StUTIL[4]}$x${StSPEC[4]}       | $y4"
1028echo " BE    |BLOCKED              | ${StINT[5]}$x${StASL[5]}$x${StSIM[5]}$x${StUTIL[5]}$x${StSPEC[5]}       | $y5"
1029echo "  FIXED|UNDEFINED & !FIXED   | ${StINT[6]}$x${StASL[6]}$x${StSIM[6]}$x${StUTIL[6]}$x${StSPEC[6]}       | $y6"
1030# echo "     |  Other  (must be 0) | ${StINT[7]}$x${StASL[7]}$x${StSIM[7]}$x${StUTIL[7]}$x${StSPEC[7]}       | $y7"
1031echo "-----------------------------|---------------------------------------------------------|"
1032
1033
1034x10=$[ ${StINT[4]} + ${StINT[5]} + ${StINT[6]} ]
1035x11=$[ ${StASL[4]} + ${StASL[5]} + ${StASL[6]} ]
1036x12=$[ ${StSIM[4]} + ${StSIM[5]} + ${StSIM[6]} ]
1037x13=$[ ${StUTIL[4]} + ${StUTIL[5]} + ${StUTIL[6]} ]
1038x14=$[ ${StSPEC[4]} + ${StSPEC[5]} + ${StSPEC[6]} ]
1039x15=$[ $x10 + $x11 + $x12 + $x13 + $x14 ]
1040
1041echo "        Total (NOT fixed)    | $x10$x$x11$x$x12$x$x13$x$x14       | $x15"
1042
1043x20=$[ $x00 + $x10 ]
1044x21=$[ $x01 + $x11 ]
1045x22=$[ $x02 + $x12 ]
1046x23=$[ $x03 + $x13 ]
1047x24=$[ $x04 + $x14 ]
1048x25=$[ $x20 + $x21 + $x22 + $x23 + $x24 ]
1049
1050echo "-----------------------------|---------------------------------------------------------|"
1051echo "        TOTAL ($MAXBDEMO)          | $x20$x$x21$x$x22$x$x23$x$x24       | $x25"
1052echo "===================================================================================================|"
1053
1054	if [ "$x25" != "$MAXBDEMO" ]; then
1055		echo "ERROR 0: report_bug_summary, incorrect TOTAL, expected <$MAXBDEMO> received <$x25>"
1056		InternalErrCount=$[ $InternalErrCount + 1 ]
1057	fi
1058}
1059
1060report_internal_bugs_number()
1061{
1062	echo "Number of data inconsistency internal errors: InternalErrCount = $InternalErrCount (program to be updated)"
1063}
1064
1065status_calculation_comment()
1066{
1067echo "Calculate status of bug according to the results of bdemo-tests run on two systems"
1068echo "for all modes (norm-32,norm-64,slack-32,slack-64):"
1069echo ""
1070echo "   UNDEFINED & FIXED == PASS"
1071echo ""
1072echo "   UNDEFINED & {FAIL|BLOCKED|         |PASS|SKIPPED} == UNDEFINED == FAIL"
1073echo "   REJECTED  & {FAIL|BLOCKED|UNDEFINED|PASS|SKIPPED} == REJECTED  == PASS"
1074echo "   FAIL      & {     BLOCKED|UNDEFINED|PASS|SKIPPED} == FAIL      == FAIL"
1075echo "   BLOCKED   & {             UNDEFINED|PASS|SKIPPED} == BLOCKED   == FAIL"
1076echo "   PASS      & {                            SKIPPED} == PASS      == PASS"
1077}
1078
1079status_entries_comment()
1080{
1081echo "Bug status entries:"
1082echo ""
1083echo "   REJECTED          : bug is rejected - no matter what are the results of bdemo-test runs"
1084echo "   UNDEFINED & FIXED : no runtime bdemo-test for this bug (impossible), status FIXED was set up manually"
1085echo "   FAIL              : some of runs of the relevant bdemo-test on either system in different modes failed"
1086echo "   BLOCKED           : no failures for the bdemo-test but it was not run in some of modes (see FAIL) (blocked temporary for some reason)"
1087echo "   PASS              : the bdemo-test doesn't failed or blocked and some runs resulted in PASS"
1088echo "   SKIPPED           : no FAIL/BLOCKED/PASS for this bdemo-test and some run was SKIPPED (no conditions to run the test)"
1089echo "   UNDEFINED         : no result of bdemo-test for this bug (either temporary or impossible to generate runtime test conditions at all)"
1090}
1091
1092
1093# arg1 - the first multi-result directory
1094# arg2 - the second multi-result directory
1095init_bdemo_sum()
1096{
1097	if [ -d "$DIR0" ]; then
1098		BDEMO_SUM="$DIR0/__STATUS_OF_ALL_BDEMO_TESTS"
1099	elif [ -d "$DIR1" ]; then
1100		BDEMO_SUM="$DIR1/__STATUS_OF_ALL_BDEMO_TESTS"
1101	else
1102		do_exit 1 "No one directory specified by both parameters"
1103	fi
1104}
1105
1106report_head_of_table()
1107{
1108	echo "Errors            IID  COMP    LBZID  ST/RES    KBZID  ST/RES    TEST-RESULT  STATE-MANUALLY     PR      SUMMARY"
1109	echo "=====================================================================================================|"
1110}
1111
1112report_end_of_table()
1113{
1114	echo "=====================================================================================================|"
1115}
1116
1117report_mid_line()
1118{
1119		echo "                 |---|-------|------|---------|------|---------|------------|------------------|-----|"
1120}
1121
1122do_report_summary()
1123{
1124	if [ "x$print_complete_list_per_comp" != x ]; then
1125		report_subset_of_summary "$SUMMARY_S"
1126		report_subset_of_summary "$SUMMARY_C"
1127		report_subset_of_summary "$SUMMARY_M"
1128		report_subset_of_summary "$SUMMARY_U"
1129		report_subset_of_summary "$SUMMARY_UNDEF"
1130		report_subset_of_summary "$SUMMARY_I"
1131	else
1132		index=0
1133		while [ 1 ]
1134		do
1135			if [[ $index -ge $MAXBDEMO ]]; then
1136				break
1137			fi
1138			echo "${SUMMARY[$index]}"
1139			index=$[ $index + 1 ]
1140		done
1141	fi
1142
1143	report_end_of_table
1144}
1145
1146# arg1 - numbers of bugs - ":n0:n1:...:nX"
1147report_subset_of_summary()
1148{
1149	if [ "x$1" != x ]; then
1150		echo "$1" | awk -F: '{ for (i=2; i<=NF; i++) { print $i}}' |\
1151		while [ 1 ]
1152		do
1153			read number
1154			if [ $? -ne 0 ] ; then
1155				break
1156			fi
1157			echo "${SUMMARY[$number]}"
1158		done
1159	fi
1160}
1161
1162report_rejected_in_bzilla()
1163{
1164	x=$[ $rjnotinbzilla + $rjinbzilla ]
1165
1166	echo "Table 3  (Rejected, $rjnotinbzilla + $rjinbzilla == $x)"
1167	echo ""
1168	report_head_of_table
1169
1170	report_subset_of_summary "$REJECTED_NOT_IN_BZILLA_S"
1171	report_subset_of_summary "$REJECTED_NOT_IN_BZILLA_C"
1172	report_subset_of_summary "$REJECTED_NOT_IN_BZILLA_M"
1173	report_subset_of_summary "$REJECTED_NOT_IN_BZILLA_U"
1174	report_subset_of_summary "$REJECTED_NOT_IN_BZILLA_UNDEF"
1175	report_subset_of_summary "$REJECTED_NOT_IN_BZILLA_I"
1176
1177	if [ $rjnotinbzilla -gt 0 ]; then
1178		report_mid_line
1179	fi
1180
1181	report_subset_of_summary "$REJECTED_IN_BZILLA"
1182
1183	report_end_of_table
1184}
1185
1186report_resolved_integrated()
1187{
1188	echo "Table 4  (PASS-state and INTEGRATED (of BZ), $rintinbzcnt)"
1189
1190	echo ""
1191	report_head_of_table
1192
1193	report_subset_of_summary "$RESOLVED_INTEGRATED_IN_BZ_S"
1194	report_subset_of_summary "$RESOLVED_INTEGRATED_IN_BZ_C"
1195	report_subset_of_summary "$RESOLVED_INTEGRATED_IN_BZ_M"
1196	report_subset_of_summary "$RESOLVED_INTEGRATED_IN_BZ_U"
1197	report_subset_of_summary "$RESOLVED_INTEGRATED_IN_BZ_UNDEF"
1198	report_subset_of_summary "$RESOLVED_INTEGRATED_IN_BZ_I"
1199
1200	report_end_of_table
1201}
1202
1203report_resolved_not_integrated()
1204{
1205	echo "Table 5  (PASS-state but NOT INTEGRATED (of BZ), $rnotintcnt)"
1206	echo ""
1207	report_head_of_table
1208
1209	report_subset_of_summary "$RESOLVED_NOT_INTEGRATED_IN_BZ_S"
1210	report_subset_of_summary "$RESOLVED_NOT_INTEGRATED_IN_BZ_C"
1211	report_subset_of_summary "$RESOLVED_NOT_INTEGRATED_IN_BZ_M"
1212	report_subset_of_summary "$RESOLVED_NOT_INTEGRATED_IN_BZ_U"
1213	report_subset_of_summary "$RESOLVED_NOT_INTEGRATED_IN_BZ_UNDEF"
1214	report_subset_of_summary "$RESOLVED_NOT_INTEGRATED_IN_BZ_I"
1215
1216	report_end_of_table
1217}
1218
1219report_not_resolved()
1220{
1221	echo "Table 6  (FAIL-state, $notresolvedcnt)"
1222	echo ""
1223	report_head_of_table
1224
1225	report_subset_of_summary "$NOT_RESOLVED_S"
1226	report_subset_of_summary "$NOT_RESOLVED_C"
1227	report_subset_of_summary "$NOT_RESOLVED_M"
1228	report_subset_of_summary "$NOT_RESOLVED_U"
1229	report_subset_of_summary "$NOT_RESOLVED_UNDEF"
1230	report_subset_of_summary "$NOT_RESOLVED_I"
1231
1232	report_end_of_table
1233}
1234
1235report_resolved_state_in_bzilla()
1236{
1237	echo "Table 7  (RESOLVED-Bugzilla-State, $rstateinbzilla)"
1238	echo ""
1239	report_head_of_table
1240
1241	report_subset_of_summary "$RESOLVED_STATE_IN_BZILLA_S"
1242	report_subset_of_summary "$RESOLVED_STATE_IN_BZILLA_C"
1243	report_subset_of_summary "$RESOLVED_STATE_IN_BZILLA_M"
1244	report_subset_of_summary "$RESOLVED_STATE_IN_BZILLA_U"
1245	report_subset_of_summary "$RESOLVED_STATE_IN_BZILLA_UNDEF"
1246	report_subset_of_summary "$RESOLVED_STATE_IN_BZILLA_I"
1247
1248	report_end_of_table
1249}
1250
1251report_resolved_state_in_bzilla_but_fail()
1252{
1253	echo "Table 8  (RESOLVED-Bugzilla-State BUT FAIL-state, $rstateinbzillafail)"
1254	echo ""
1255	report_head_of_table
1256
1257	report_subset_of_summary "$RESOLVED_STATE_IN_BZILLA_BUT_FAIL_S"
1258	report_subset_of_summary "$RESOLVED_STATE_IN_BZILLA_BUT_FAIL_C"
1259	report_subset_of_summary "$RESOLVED_STATE_IN_BZILLA_BUT_FAIL_M"
1260	report_subset_of_summary "$RESOLVED_STATE_IN_BZILLA_BUT_FAIL_U"
1261	report_subset_of_summary "$RESOLVED_STATE_IN_BZILLA_BUT_FAIL_UNDEF"
1262	report_subset_of_summary "$RESOLVED_STATE_IN_BZILLA_BUT_FAIL_I"
1263
1264	report_end_of_table
1265}
1266
1267report_bzilla_summary()
1268{
1269	y=$[ ${LBarr[0]} + ${LBarr[1]} + ${LBarr[2]} + ${LBarr[3]}\
1270		+ ${LBarr[4]} + ${LBarr[5]} + ${LBarr[6]} + ${LBarr[7]}\
1271		+ ${LBarr[8]} + ${LBarr[9]} ]
1272
1273	z=$[ ${KBarr[0]} + ${KBarr[1]} + ${KBarr[2]} + ${KBarr[3]}\
1274		+ ${KBarr[4]} + ${KBarr[5]} + ${KBarr[6]} + ${KBarr[7]}\
1275		+ ${KBarr[8]} + ${KBarr[9]} ]
1276
1277	x="           "
1278	echo "Table 9  (Summary per-State-Result in BZ)"
1279	echo ""
1280
1281	echo "State Result |  LBZ         KBZ"
1282	echo "=============|==================="
1283	echo "NEW          |  ${LBarr[0]}$x${KBarr[0]}"
1284	echo "ASSI         |  ${LBarr[1]}$x${KBarr[1]}"
1285	echo "NEED         |  ${LBarr[2]}$x${KBarr[2]}"
1286	echo "RESO CODE    |  ${LBarr[3]}$x${KBarr[3]}"
1287	echo "RESO PATC    |  ${LBarr[4]}$x${KBarr[4]}"
1288	echo "RESO FIXE    |  ${LBarr[5]}$x${KBarr[5]}"
1289	echo "RESO INVA    |  ${LBarr[6]}$x${KBarr[6]}"
1290	echo "REJE DOCU    |  ${LBarr[7]}$x${KBarr[7]}"
1291	echo "CLOS CODE    |  ${LBarr[8]}$x${KBarr[8]}"
1292	echo "Other        |  ${LBarr[9]}$x${KBarr[9]}"
1293	echo "-------------|-------------------"
1294	echo "Total        |  $y$x$z"
1295	echo "=============|==================="
1296
1297	y=$[ ${LBarr[10]} + ${LBarr[11]} + ${LBarr[12]} ]
1298	z=$[ ${KBarr[10]} + ${KBarr[11]} + ${KBarr[12]} ]
1299
1300	echo ""
1301	echo ""
1302	echo ""
1303	echo "Table 10  (Summary state of bugs (of BZ))"
1304	echo ""
1305	echo "    State    |  LBZ         KBZ"
1306	echo "=============|==================="
1307	echo "REJECTED     |  ${LBarr[10]}$x${KBarr[10]}"
1308	echo "PASS-state   |  ${LBarr[11]}$x${KBarr[11]}"
1309	echo "FAIL-state   |  ${LBarr[12]}$x${KBarr[12]}"
1310	echo "-------------|-------------------"
1311	echo "Total        |  $y$x$z"
1312	echo "================================="
1313}
1314
1315report_errors_encountered()
1316{
1317	echo "A list of encountered errors:"
1318	echo ""
1319
1320	if [ -f "$ERROR_OPCODES" ]; then
1321		z=`echo "$AccumulateErrors" | transform_to_single_chars`
1322		report_lines_per_char "$ERROR_OPCODES" "$z"
1323	else
1324		echo "Error: ERROR_OPCODES is not file: <$ERROR_OPCODES>"
1325	fi
1326}
1327
1328# ############################## MAIN ###############################
1329
1330date
1331
1332DIR0="$1"
1333DIR1="$2"
1334ALLBUGS="$3"
1335KBSUM="$4"
1336LBSUM="$5"
1337BUG_STATE_DIR="$6"
1338
1339BDEMO_SUM=
1340KBSUM_PARSED=
1341LBSUM_PARSED=
1342
1343c32n_GL=
1344c64n_GL=
1345c32s_GL=
1346c64s_GL=
1347l32n_GL=
1348l64n_GL=
1349l32s_GL=
1350l64s_GL=
1351
1352UTILSTATUS=0
1353SUMMARY=
1354
1355# NOT_RESOLVED=
1356# RESOLVED_INTEGRATED_IN_BZ=
1357# RESOLVED_NOT_INTEGRATED_IN_BZ=
1358# RESOLVED_STATE_IN_BZILLA=
1359# REJECTED_IN_BZILLA=
1360# REJECTED_NOT_IN_BZILLA=
1361
1362LBarr=
1363KBarr=
1364
1365ERROR_OPCODES="$BUG_STATE_DIR/ERROR_OPCODES"
1366
1367
1368# Opcodes of errors
1369# REJECTED_ERR=1
1370# COMP_ERR=9
1371
1372
1373# Arrays for summary information for Interpreter, iASL, Simulation, Utilities, Specs.
1374
1375StINT=
1376StASL=
1377StSIM=
1378StUTIL=
1379StSPEC=
1380
1381
1382# Prepare the summary table of bdemo summary files of two multi-results:
1383
1384echo "Preparing the summary table of bdemo summary files of two multi-results:"
1385echo "   the first  : $DIR0"
1386echo "   the second : $DIR1"
1387echo "   ALLBUGS    : $ALLBUGS"
1388echo "   kernel bugzilla Bug List file : $KBSUM"
1389echo "   local bugzilla Bug List file  : $LBSUM"
1390
1391# Initialization
1392
1393INIT_MAX_BDEMO
1394
1395system0=
1396system1=
1397if [ -d "$DIR0" ]; then
1398	COMMONLOGFILE="$DIR0/Summary"
1399	if [ ! -f "$COMMONLOGFILE" ]; then
1400		do_exit 1 "COMMONLOGFILE is not file: <$COMMONLOGFILE>"
1401	else
1402		system0=`get_name_of_system "$COMMONLOGFILE"`
1403	fi
1404fi
1405if [ -d "$DIR1" ]; then
1406	COMMONLOGFILE="$DIR1/Summary"
1407	if [ ! -f "$COMMONLOGFILE" ]; then
1408		do_exit 1 "COMMONLOGFILE is not file: <$COMMONLOGFILE>"
1409	else
1410		system1=`get_name_of_system "$COMMONLOGFILE"`
1411	fi
1412fi
1413
1414if [ ! -f "$KBSUM" ]; then
1415	do_exit 1 "KBSUM is not file: <$KBSUM>"
1416fi
1417
1418if [ ! -f "$LBSUM" ]; then
1419	do_exit 1 "LBSUM is not file: <$LBSUM>"
1420fi
1421
1422if [ -d "$DIR0" ]; then
1423	KBSUM_PARSED="$DIR0/__KERNEL_ASLTS_BUG_LIST"
1424	LBSUM_PARSED="$DIR0/__LOCAL_ASLTS_BUG_LIST"
1425elif [ -d "$DIR1" ]; then
1426	KBSUM_PARSED="$DIR1/__KERNEL_ASLTS_BUG_LIST"
1427	LBSUM_PARSED="$DIR1/__LOCAL_ASLTS_BUG_LIST"
1428fi
1429
1430if [ "x$KBSUM_PARSED" == x -o "x$LBSUM_PARSED" == x ]; then
1431	do_exit 1 "Failed to initialize KBSUM_PARSED & LBSUM_PARSED"
1432fi
1433
1434if [ ! -f "$ALLBUGS" ]; then
1435	do_exit 1 "ALLBUGS is not file: <$ALLBUGS>"
1436fi
1437
1438init_bdemo_sum
1439
1440# Parse the Bug List files (kernel and local bugzilla)
1441
1442echo "Parse the Bug List files (kernel and local bugzilla)"
1443echo "   kernel bugzilla Bug List file : $KBSUM"
1444echo "   local bugzilla Bug List file  : $LBSUM"
1445
1446parsebuglist "$KBSUM" > "$KBSUM_PARSED"
1447if [ $? -ne 0 ]; then
1448	do_exit 1 "Failed to parse KBSUM: <$KBSUM>"
1449fi
1450
1451parsebuglist "$LBSUM" > "$LBSUM_PARSED"
1452if [ $? -ne 0 ]; then
1453	do_exit 1 "Failed to parse LBSUM: <$LBSUM>"
1454fi
1455
1456# Concatenate the summary files of bdemos of two multi-results
1457
1458bdemosconc "$DIR0" "$DIR1"
1459
1460if [ ! -f "$BDEMO_SUM" ]; then
1461	do_exit 1 "BDEMO_SUM is not file: <$BDEMO_SUM>"
1462fi
1463
1464echo ""
1465echo ""
1466echo "The tables below represent the current state of all bugs encountered by ASLTS project."
1467echo ""
1468echo "The underlying systems the aslts tests were run:"
1469echo ""
1470echo "   the first  <$system0>"
1471echo "   the second <$system1>"
1472echo ""
1473echo "The aslts tests multi-results analyzed:"
1474echo ""
1475echo "   the first multi-result directory  : <$DIR0>"
1476echo "   the second multi-result directory : <$DIR1>"
1477echo ""
1478
1479
1480report_state_of_bugs
1481
1482if [ 0 -eq 1 ]; then
1483	echo ""
1484	status_calculation_comment
1485	echo ""
1486	status_entries_comment
1487fi
1488
1489echo ""
1490
1491date
1492
1493exit $UTILSTATUS
1494
1495
1496
1497