1#!/bin/bash
2#
3# @echo off
4#
5# Concatenate bdemo summary files (obtained by bdemossum)
6# of two multi-results.
7#
8# Paremeters:
9#
10# arg1 - the first multi-result directory
11# arg2 - the second multi-result directory
12#
13# (for comments see Do and asltsrun utilities).
14
15# Includes
16
17. common
18. settings
19
20get_summary()
21{
22	OLD_IFS=$IFS
23	IFS=":"
24
25	cat\
26		$path0\
27		$path1\
28		$path2\
29		$path3\
30		$path4\
31		$path5\
32		$path6\
33		$path7 |\
34	while [ 1 ]
35	do
36		read number line
37		if [ $? -ne 0 ] ; then
38			do_report_summary
39			break
40		fi
41
42		if [ "x$number" != x ]; then
43			SUMMARY[$number]=${SUMMARY[$number]}"|$line"
44		fi
45
46	done
47
48	IFS=$OLD_IFS
49}
50
51# arg1   - multi-result directory
52# arg2   - mode of run
53get_name_of_bdemossum()
54{
55	local path modepart0
56
57	modepart0=`get_mode_string $2 0`
58	path="$1/$modepart0/__STATUS_OF_BDEMO_TESTS"
59	echo "$path"
60}
61
62do_report_summary()
63{
64	index=0
65
66	while [ 1 ]
67	do
68		if [[ $index -ge $MAXBDEMO ]]; then
69			break
70		fi
71
72		echo "$index${SUMMARY[$index]}"
73
74		index=$[ $index + 1 ]
75	done
76}
77
78# ############################## MAIN ###############################
79
80DIR0="$1"
81DIR1="$2"
82UTILSTATUS=0
83SUMMARY=
84
85# Initialization
86
87INIT_MAX_BDEMO
88
89echo "The number of bdemo-tests is equal to $MAXBDEMO"
90
91# Do summary files of bdemos
92
93if [ -d "$DIR0" ]; then
94	bdemossum "$DIR0" 0
95fi
96if [ -d "$DIR1" ]; then
97	bdemossum "$DIR1" 1
98fi
99
100# Concatenate the summary files of bdemos of two multi-results
101
102echo "Concatenating bdemo summary files of two multi-results:"
103echo "   the first  : $DIR0"
104echo "   the second : $DIR1"
105
106bdemo_sum=
107if [ -d "$DIR0" ]; then
108	bdemo_sum="$DIR0/__STATUS_OF_ALL_BDEMO_TESTS"
109elif [ -d "$DIR1" ]; then
110	bdemo_sum="$DIR1/__STATUS_OF_ALL_BDEMO_TESTS"
111else
112	do_exit 1 "No one directory specified by both parameters"
113fi
114
115path0=""
116path1=""
117path2=""
118path3=""
119path4=""
120path5=""
121path6=""
122path7=""
123
124if [ -d "$DIR0" ]; then
125	path0=`get_name_of_bdemossum "$DIR0" $NORM32`
126	path1=`get_name_of_bdemossum "$DIR0" $NORM64`
127	path2=`get_name_of_bdemossum "$DIR0" $SLACK32`
128	path3=`get_name_of_bdemossum "$DIR0" $SLACK64`
129fi
130if [ -d "$DIR1" ]; then
131	path4=`get_name_of_bdemossum "$DIR1" $NORM32`
132	path5=`get_name_of_bdemossum "$DIR1" $NORM64`
133	path6=`get_name_of_bdemossum "$DIR1" $SLACK32`
134	path7=`get_name_of_bdemossum "$DIR1" $SLACK64`
135fi
136
137get_summary > "$bdemo_sum"
138
139exit $UTILSTATUS
140
141
142
143