1#!/bin/bash
2#
3# @echo off
4#
5# Settings and initializations
6#
7# Initialize all the AVAILABLE test cases
8# and collections (all which are).
9#
10INIT_ALL_AVAILABLE_CASES()
11{
12	# Functional test collection
13
14	FUNC_COLL="arithmetic bfield constant control descriptor"
15	FUNC_COLL="$FUNC_COLL logic manipulation name reference region synchronization"
16	FUNC_COLL="$FUNC_COLL table module"
17
18	# Complex test collection
19
20	OPER_TCASES="oarg oconst oconversion olocal onamedglob onamedloc opackageel oreftonamed oreftopackageel oreturn"
21	RES_TCASES="rconversion rcopyobject rexplicitconv rindecrement roptional rstore"
22
23	CPLX_COLL="misc provoke"
24	CPLX_COLL="$CPLX_COLL $OPER_TCASES"
25	CPLX_COLL="$CPLX_COLL $RES_TCASES"
26	CPLX_COLL="$CPLX_COLL badasl namespace"
27
28	# Exceptions test collection
29
30	EXCP_COLL="exc exc_operand1 exc_operand2 exc_ref exc_result1 exc_result2"
31	EXCP_COLL="$EXCP_COLL exc_tbl"
32
33	# Bug-demo test collection
34
35	BDEMO_COLL="bdemo bdemof"
36
37	# Service test collection
38
39	SERV_COLL="condbranches"
40
41	# Implementation dependent test collection
42
43	IMPL_COLL="dynobj"
44
45	# Tests of multi-threading functionality (mt-tests)
46
47	MT_COLL="mt_mutex"
48
49	# Tests to prove identity of ACPICA to MS
50
51	MS_IDENT_COLL="extra extra_aslts"
52
53	# All collections of tests
54
55	ALL_AVAILABLE_COLLS="functional complex exceptions bdemo service mt Identity2MS IMPL"
56
57	ALL_AVAILABLE_TEST_CASES="$FUNC_COLL $CPLX_COLL $EXCP_COLL $BDEMO_COLL $MT_COLL $SERV_COLL $IMPL_COLL $MS_IDENT_COLL"
58}
59
60#
61# Initialize all the AVAILABLE test modes
62#
63INIT_ALL_AVAILABLE_MODES()
64{
65	# All test modes
66
67	ALL_AVAILABLE_TEST_MODES="n32 n64 s32 s64"
68}
69
70#
71# Report all the available test cases
72#
73echo_available_test_cases()
74{
75	echo "All available test cases:"
76
77	echo_list "functional"                "$FUNC_COLL"
78	echo_list "complex"                   "$CPLX_COLL"
79	echo_list "exceptions"                "$EXCP_COLL"
80	echo_list "bug-demo"                  "$BDEMO_COLL"
81	echo_list "mt"                        "$MT_COLL"
82	echo_list "service"                   "$SERV_COLL"
83	echo_list "implementation dependent"  "$IMPL_COLL"
84	echo_list "Identity2MS"               "$MS_IDENT_COLL"
85}
86
87#
88# Return the number of all the available test cases
89#
90get_num_of_available_test_cases()
91{
92	local count=0
93
94	for tcase in $ALL_AVAILABLE_TEST_CASES
95	do
96		count=$[ $count + 1 ]
97	done
98
99	return $count
100}
101
102#
103# Set up a list of test cases you want
104# to be processed by run and compare utilities.
105# Do that here manually.
106#
107INIT_SET_OF_TEST_CASES()
108{
109	local func compl excep bdemo serv impl
110
111	# Functional test collection
112
113	func="arithmetic bfield constant control descriptor"
114	func="$func logic manipulation name reference region synchronization"
115	func="$func table"
116
117	# Complex test collection
118
119	compl="misc provoke"
120	compl="$compl oarg oconst olocal onamedloc onamedglob opackageel oreftonamed oreftopackageel oreturn"
121	compl="$compl rstore roptional rcopyobject rindecrement rexplicitconv"
122	compl="$compl badasl namespace"
123
124	# Exceptions test collection
125
126	excep="exc exc_ref exc_operand2 exc_result2"
127	excep="$excep exc_tbl"
128
129	# Bug-demo test collection
130
131	bdemo="bdemo bdemof"
132
133	# Service test collection
134
135	serv="condbranches"
136
137	# Tests of multi-threading functionality (mt-tests)
138
139	mt="mt_mutex"
140
141	# Tests to prove identity of ACPICA to MS
142
143	Identity2MS="extra extra_aslts"
144
145	# Implementation dependent test collection
146
147	impl="dynobj"
148
149
150	# The test cases to be processed by run and compare utilities:
151
152	if [ "x$ENABLED_TCASES" = "x" ]; then
153
154#		ENABLED_TCASES="$func $compl $excep $bdemo $serv"
155#		ENABLED_TCASES="$func $compl $excep $Identity2MS $bdemo $serv"
156		ENABLED_TCASES="$func $compl $excep $mt $Identity2MS $bdemo $serv"
157
158#		ENABLED_TCASES="extra extra_aslts"
159#		ENABLED_TCASES="control"
160#		ENABLED_TCASES="bdemo"
161#		ENABLED_TCASES="bdemo bdemof"
162#		ENABLED_TCASES="bdemo misc"
163#		ENABLED_TCASES="arithmetic constant"
164#		ENABLED_TCASES="condbranches"
165#		ENABLED_TCASES="exc"
166#		ENABLED_TCASES="arithmetic constant exc condbranches"
167#		ENABLED_TCASES="arithmetic bfield constant control descriptor logic manipulation name reference region synchronization misc provoke exc bdemo"
168#		ENABLED_TCASES="oarg oconst olocal onamedloc onamedglob opackageel oreftonamed oreftopackageel oreturn"
169#		ENABLED_TCASES="rstore roptional rcopyobject rindecrement rexplicitconv exc_ref exc_operand2 exc_result2"
170#		ENABLED_TCASES="condbranches"
171#		ENABLED_TCASES="arithmetic bfield"
172#		ENABLED_TCASES="descriptor"
173#		ENABLED_TCASES="reference"
174#		ENABLED_TCASES="arithmetic misc logic bdemo"
175#		ENABLED_TCASES="misc control manipulation"
176#		ENABLED_TCASES="exc_ref"
177#		ENABLED_TCASES="rstore"
178#		ENABLED_TCASES="bdemo reference"
179#		ENABLED_TCASES="name"
180#		ENABLED_TCASES="badasl"
181#		ENABLED_TCASES="constant"
182#		ENABLED_TCASES="arithmetic constant exc mt_mutex bdemo"
183#		ENABLED_TCASES="mt_mutex"
184#		ENABLED_TCASES="region"
185
186	fi
187}
188
189#
190# Set up a list of test modes you want
191# to be processed by run and compare utilities.
192#
193INIT_SET_OF_TEST_MODES()
194{
195	local m n found
196
197	for m in $ALL_AVAILABLE_TEST_MODES
198	do
199		found=0
200		for n in $ENABLED_TMODES
201		do
202			if [ "x$m" = "x$n" ]; then
203				found=1
204			fi
205		done
206
207		if [ $found -eq 1 ]; then
208
209			# 32-bit non-slack (normal):
210
211			if [ "$m" = "n32" ]; then
212				ENABLENORM32=1
213			fi
214
215			# 64-bit non-slack (normal):
216
217			if [ "$m" = "n64" ]; then
218				ENABLENORM64=1
219			fi
220
221			# 32-bit slack:
222
223			if [ "$m" = "s32" ]; then
224				ENABLESLACK32=1
225			fi
226
227			# 64-bit slack:
228
229			if [ "$m" = "s64" ]; then
230				ENABLESLACK64=1
231			fi
232		fi
233	done
234}
235
236#
237# Set it up to zero to exclude the aslts/RESULTS technique at all
238#
239INIT_LOG_RESULTS()
240{
241	ENABLELOG=1
242}
243
244#
245# Set it up to the maximal number of bdemo tests (of all bugs of ACPICA)
246#
247INIT_MAX_BDEMO()
248{
249	MAXBDEMO=307
250}
251
252#
253# Reset collections involved flags
254#
255reset_collections_flags()
256{
257	FUNC_COLL_FLAG=0
258	CPLX_COLL_FLAG=0
259	EXCP_COLL_FLAG=0
260	BDEMO_COLL_FLAG=0
261	MT_COLL_FLAG=0
262	SERV_COLL_FLAG=0
263	IMPL_COLL_FLAG=0
264	MS_IDENT_COLL_FLAG=0
265}
266
267RESET_SETTINGS()
268{
269	# Log enable flag
270
271	ENABLELOG=0
272
273	# Enabled modes
274
275	ENABLENORM32=0
276	ENABLENORM64=0
277	ENABLESLACK32=0
278	ENABLESLACK64=0
279
280	# Available test collections
281
282	FUNC_COLL=
283	CPLX_COLL=
284	EXCP_COLL=
285	BDEMO_COLL=
286	MT_COLL=
287	SERV_COLL=
288	MS_IDENT_COLL=
289	IMPL_COLL=
290	ALL_AVAILABLE_COLLS=
291	ALL_AVAILABLE_TEST_CASES=
292
293	# Particular test cases staff
294
295	OPER_TCASES=
296	RES_TCASES=
297
298	# Test collections involved flags
299
300	reset_collections_flags
301
302	# Run test error flags
303
304	HAVE_LARGE_REF_CNT=no
305}
306
307INIT_MEM_STAT()
308{
309	# If 'yes', eliminates all settings of comparing below
310
311	DO_ALL_COMPARE=yes
312
313	DO_COMPARE_TOTAL_ONLY=no
314
315	# Enable memory statistics processing
316
317	DO_MEMSTAT=yes
318
319	#
320    # Enable comparing of memory statistics for the test cases
321	# (not only the total figures related to all the test cases
322	# of mode).
323	# Allows to reduce the time of the comparing utility.
324	# This comparing utility takes too long time on Cygwin
325	# (more than 1 hour 10 minutes, though quickly on Linux -
326	# not more than 1 minute).
327	#
328    DO_COMPARE_OF_TEST_CASES=no
329	DO_COMPARE_OF_EXCEPTIONS=no
330
331	if [ "$DO_COMPARE_OF_TEST_CASES" != yes -a "$DO_COMPARE_OF_EXCEPTIONS" != yes ]; then
332		DO_COMPARE_TOTAL_ONLY=yes
333	fi
334
335	if [ "$DO_ALL_COMPARE" == yes ]; then
336		DO_COMPARE_TOTAL_ONLY=no
337		DO_COMPARE_OF_TEST_CASES=yes
338		DO_COMPARE_OF_EXCEPTIONS=yes
339	fi
340}
341
342