summaryrefslogtreecommitdiff
path: root/xc/test/xsuite/xtest/bin/prp
blob: ba42004d2b041c0a3b23fa44615927b2ab38b367 (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

# 
# Copyright (c) 1990, 1991  X Consortium
# 
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# 
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# 
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# 
# Except as contained in this notice, the name of the X Consortium shall not be
# used in advertising or otherwise to promote the sale, use or other dealings
# in this Software without prior written authorization from the X Consortium.
#
#  Copyright 1990, 1991 UniSoft Group Limited.
#  
#  Permission to use, copy, modify, distribute, and sell this software and
#  its documentation for any purpose is hereby granted without fee,
#  provided that the above copyright notice appear in all copies and that
#  both that copyright notice and this permission notice appear in
#  supporting documentation, and that the name of UniSoft not be
#  used in advertising or publicity pertaining to distribution of the
#  software without specific, written prior permission.  UniSoft
#  makes no representations about the suitability of this software for any
#  purpose.  It is provided "as is" without express or implied warranty.
# 
# $XConsortium: prp,v 1.9 94/04/17 21:14:33 rws Exp $
#

# A simple report generator for development use
# There is much information in the journal file that can be
# used to check that all went well, for example matching the number
# of tests in the IC with the number that actually are reported.
#
# This prototype report generator only provides a very simple
# formating function, rather than a validation one.

DODEBUG=0
DOTRACE=0
DOPASS=1
DOSUM=1

usefile=
number=


while test $# -gt 0
do
	case $1 in
	-d)
		DODEBUG=1
		DOTRACE=1
		;;
	-t)
		DOTRACE=1
		;;
	-p)
		# Report only on failures.
		DOPASS=0
		;;
	-s)
		DOSUM=0
		;;
	-f)
		usefile=$2
		shift
		;;
	-T)
		case $2 in
		[0-9]*)
			number=$2
			shift
		esac
		;;
	esac
	shift
done

if [ "$usefile" != "" ]; then
	file=$usefile
else
	# Default for file.
	if [ `basename $0` = prp ]; then
		file=tet_xres
	elif [ "$number" != "" ]; then
		# Use the user supplied number.
		ntmp=`echo 0000$number | sed -e 's/.*\(....\)/\1/'`
		file=$TET_ROOT/xtest/results/${ntmp}*/journal
	else
		# Take the highest numbered journal with an 'e' in it
		file=`ls -r $TET_ROOT/xtest/results/*e*/journal |\
		sed -e '1{
			s/[bce]*//
			q
			}'`
	fi
fi

if [ ! -f $file ]; then
	echo "Could not find file $file"
	exit 1
fi

(
	cat $file
	echo '520|0 0 0 0 0|TRACE:NAME:'
) | awk -F\| '

BEGIN {
	dotrace='$DOTRACE';
	dodebug='$DODEBUG';
	dopass='$DOPASS';
	dosumm='$DOSUM';
	firsttime = 1;

	PASS = 0
	FAIL = 1
	UNRESOLVED = 2
	NOTINUSE = 3
	UNSUPPORTED = 4
	UNTESTED = 5
	UNINITIATED = 6
	NORESULT = 7


}

# The begining of a test case is recognised by the NAME keyword in a
# trace line.
/TRACE:NAME:/ {
	if (firsttime == 0 && dosumm) {
		print ""
		line = "Summary of Results for " name
		print line
		print substr("------------------------------------------------------------------------------------------------", 1, length(line));
		printf "%-12s %d\n", "PASS", result[PASS]
		printf "%-12s %d\n", "FAIL", result[FAIL]
		if (result[UNRESOLVED] != 0)
			printf "%-12s %d\n", "UNRESOLVED", result[UNRESOLVED]
		if (result[NOTINUSE] != 0)
			printf "%-12s %d\n", "NOTINUSE", result[NOTINUSE]
		if (result[UNSUPPORTED] != 0)
			printf "%-12s %d\n", "UNSUPPORTED", result[UNSUPPORTED]
		if (result[UNTESTED] != 0)
			printf "%-12s %d\n", "UNTESTED", result[UNTESTED]
		if (result[UNINITIATED] != 0)
			printf "%-12s %d\n", "UNINITIATED", result[UNINITIATED]
		if (result[NORESULT] != 0)
			printf "%-12s %d\n", "NORESULT", result[NORESULT]
	}
	n = split($3, dat, " ");
	name = dat[2];

	if (firsttime == 0 && name != "")
		printf "\n\n\n"
	if (name != "")
		printf "Tests for %s\n", name;
	for (i = 0; i < 8; i++)
		result[i] = 0;

	# Reset all the information indexes.
	#
	infoind = 0;
	failnum = 0;

	firsttime = 0;
	next;
}

# An IC start message.
$1 == 400 {
	n = split($2, dat, " ");
	ic = dat[2];
	nics = dat[3];
}

# A TP Start message
$1 == 200 {
	split($2, dat, " ");
	tp = dat[2];
	if (donefirst == 0 && infoind > 0) {
		print "Non specific error messages:"
		for (i = 0; i < infoind; i++)
			printf "  %s\n",  infoline[i];
	}
	donefirst = 1;

	infoind = 0;
	failnum = 0;
}

# A infomation line
$1 == 520 {

	# Not that the message field may legally contain the field separator.
	# So we have to extract the message from $0 with a substr expression.
	if ($3 ~ /^REPORT:/) {
		infoline[infoind++] = substr($0, length($1)+1+length($2)+1+8, 512);
		failnum++;
	}
	if ($3 ~ /^TRACE:/ && dotrace) {
		infoline[infoind++] = substr($0, length($1)+1+length($2)+1, 512);
	}
	if ($3 ~ /^TRACE:/ && dotrace == 0 && substr($3, 7, 3) == "---") {
		infoline[infoind++] = substr($0, length($1)+1+length($2)+1+7, 512);
	}
	if ($3 ~ /^DEBUG:/ && dodebug) {
		infoline[infoind++] = substr($0, length($1)+1+length($2)+1, 512);
	}
	if ($3 ~ /^CHECK:/) {
		# Ignore this for the time being
	}
	if ($3 !~ /^[A-Z][A-Z][A-Z][A-Z]*:/) {
		# This was probably entered by the TCM on a signal or other error.
		infoline[infoind++] = "TCM:" substr($0, length($1)+1+length($2)+1, 512);
		failnum++;
	}
}

# A TP Result message
$1 == 220 {

	split($2, dat, " ");
	res = dat[3];

	# Quick consistancy check - ensure that if the
	# result is pass then there are no infoline.
	#
	if (res == PASS && failnum != 0) {
		printf "ERROR: Failure reason given for PASS result\n";
	}

	# Get the result code.
	# NORESULT seems to appear as -1 for some reason ???
	#
	if (res == -1)
		res = NORESULT;

	#
	# Increment the count of this class of result.
	#
	result[res]++;

	if (res == PASS || res == UNTESTED || res == UNSUPPORTED || res == NOTINUSE) {
		# The test did not fail.
		nofailtype = 1;
	} else {
		nofailtype = 0;
	}

	if (dopass == 0 && nofailtype == 1)
		next

	printf "Test %3d:  %s\n", tp, $3

	if (infoind > 0 && res != NOTINUSE) {
		numprint = infoind;
		for (i = 0; i < infoind; i++) {
			if (nofailtype && infoline[i] ~ /^--/) {
				numprint--;
				continue;
			}
			printf "  %s\n", infoline[i];
		}
		if (numprint)
			print ""
	}
	if (nofailtype == 0 && failnum == 0)
		print "	Warning: No reasons given for result"

}

# A TCM start line
$1 == 15 {
	donefirst = 0;
}


END {

}

'