FreeCalypso > hg > tcs211-c139
comparison gpf/BIN/mkalltc.bat @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:509db1a7b7b8 |
---|---|
1 @echo off | |
2 setlocal | |
3 rem --------------------------------------------------------------------------- | |
4 rem Project : | |
5 rem Modul : mkalltc.bat | |
6 rem --------------------------------------------------------------------------- | |
7 rem Copyright 2002 Texas Instruments Berlin, AG | |
8 rem All rights reserved. | |
9 rem | |
10 rem This file is confidential and a trade secret of Texas | |
11 rem Instruments Berlin, AG | |
12 rem The receipt of or possession of this file does not convey | |
13 rem any rights to reproduce or disclose its contents or to | |
14 rem manufacture, use, or sell anything it may describe, in | |
15 rem whole, or in part, without the specific written consent of | |
16 rem Texas Instruments Berlin, AG. | |
17 rem --------------------------------------------------------------------------- | |
18 rem Purpose : Generate all test cases for a given test specification | |
19 rem --------------------------------------------------------------------------- | |
20 set tc_exitcode=0 | |
21 loadbtm on | |
22 @pushd | |
23 @if x%_4ver% == x goto Need4NT | |
24 | |
25 @rem Check %PROST | |
26 @iff x%PROST == x then | |
27 @echo Which Protocol Stack shall be tested? | |
28 @echo set the environment variable PROST to the name of the stack. | |
29 @echo e.g. set PROST=GSM or set PROST=WARP will work | |
30 goto error | |
31 @endiff | |
32 | |
33 @rem Check for gnumake and grep | |
34 set grep=%GPF%\tools\bin\grep.exe | |
35 iff NOT exist %grep% then | |
36 echo You need %grep% to generate test cases | |
37 goto error | |
38 endiff | |
39 set gnumake=%GPF%\tools\bin\gnumake.exe | |
40 iff NOT exist %gnumake% then | |
41 echo You need %gnumake% to generate test cases | |
42 goto error | |
43 endiff | |
44 set sed=%GPF%\tools\bin\sed.exe | |
45 iff NOT exist %sed% then | |
46 echo You need %sed% to generate tests | |
47 goto error | |
48 endiff | |
49 rem set gawk but check it later only if it is needed | |
50 set gawk=%GPF%\tools\bin\gawk.exe | |
51 | |
52 @set TC_COMPILE_ONLY=0 | |
53 @set TC_FINALTESTS=0 | |
54 iff "x%TDSCHECK_ENABLED" == "x" then | |
55 set enable_check=0 | |
56 else | |
57 set enable_check=1 | |
58 endiff | |
59 set tc_firsttc= | |
60 set tc_lasttc= | |
61 set tc_delete_olds=1 | |
62 set tc_cons_output=0 | |
63 set tc_bnam= | |
64 set tc_furtherincludes= | |
65 set tc_gen_only=0 | |
66 set tc_range_supplied=0 | |
67 set tc_testconfig= | |
68 set tc_testdlldir= | |
69 set tc_testenv=new | |
70 set tc_gendir=%GPF%\util\tap\gen | |
71 set tc_tap_errfunc=tap_get_exitcode | |
72 set tc_testpref= | |
73 set tc_allin1=0 | |
74 set tc_genc=0 | |
75 set tc_tdc=0 | |
76 | |
77 :check_options | |
78 @rem Check Parameters | |
79 @if "x%1" == "x" goto How2Use | |
80 iff "%1" == "-to" then | |
81 iff %tc_compile_only% == 1 .OR. %TC_FINALTESTS% == 1 then | |
82 echo Use of "-to" ignored because "-co" or "-f" was set | |
83 else | |
84 set tc_gen_only=1 | |
85 endiff | |
86 shift 1 | |
87 goto check_options | |
88 elseiff "%1" == "-co" then | |
89 iff %tc_gen_only% == 1 then | |
90 echo Use of "-co" ignored because "-to" was set | |
91 else | |
92 set TC_COMPILE_ONLY=1 | |
93 endiff | |
94 shift 1 | |
95 goto check_options | |
96 elseiff "%1" == "-eut" then | |
97 set tc_testconfig=EUT=%@UPPER[%2] | |
98 set tc_tdcenti=%@LOWER[%2] | |
99 shift 2 | |
100 goto check_options | |
101 elseiff "%1" == "-f" then | |
102 rem Check for several tools in %PATH | |
103 set uniq=%GPF%\tools\bin\uniq.exe | |
104 set sort=%GPF%\tools\bin\sort.exe | |
105 iff NOT exist %uniq% then | |
106 echo You need %uniq% to generate final tests | |
107 goto error | |
108 endiff | |
109 iff NOT exist %sort% then | |
110 echo You need %sort% to generate final tests | |
111 goto error | |
112 endiff | |
113 iff NOT exist %gawk% then | |
114 echo You need %gawk% to generate final tests | |
115 goto error | |
116 endiff | |
117 iff %tc_gen_only% == 1 then | |
118 echo Use of "-f" ignored because "-to" was set | |
119 else | |
120 set TC_FINALTESTS=1 | |
121 endiff | |
122 shift 1 | |
123 goto check_options | |
124 elseiff "%1" == "-tty" then | |
125 set tc_cons_output=1 | |
126 shift 1 | |
127 goto check_options | |
128 elseiff "%1" == "-oe" then | |
129 set tc_tap_errfunc=!tcd_errorOccured | |
130 set tc_gendir=%GPF%\tap | |
131 set tc_testenv=old | |
132 shift 1 | |
133 goto check_options | |
134 elseiff "%1" == "-oed" then | |
135 set tc_tap_errfunc=!tcd_errorOccured | |
136 set tc_gendir=%GPF%\tap | |
137 set tc_testenv=old | |
138 set tc_testpref=oe_ | |
139 shift 1 | |
140 goto check_options | |
141 elseiff "%1" == "-debug" then | |
142 echo on | |
143 shift 1 | |
144 goto check_options | |
145 elseiff "%1" == "-k" then | |
146 set tc_delete_olds=0 | |
147 shift 1 | |
148 goto check_options | |
149 elseiff "%1" == "-tc" then | |
150 if "x%2" == "x" (echo Missing name of testcases for "-tc" & goto How2Use) | |
151 set tc_bnam=%2 | |
152 shift 2 | |
153 goto check_options | |
154 elseiff "%1" == "-r" then | |
155 if "x%2" == "x" (echo Missing range for "-r" & goto How2Use) | |
156 set tc_dash=%@INDEX[%2,-] | |
157 if %tc_dash == -1 (echo Invalid range "%2" & goto How2Use) | |
158 set tc_firsttc=%@INSTR[0,%tc_dash,%2] | |
159 set tc_lasttc=%@SUBSTR[%2,%@eval[1+%tc_dash%]] | |
160 set tc_range_supplied=1 | |
161 shift 2 | |
162 goto check_options | |
163 elseiff "%1" == "-chk" then | |
164 rem Call TDSCheck after generating tds files | |
165 set enable_check=1 | |
166 shift 1 | |
167 goto check_options | |
168 elseiff "%1" == "-td" then | |
169 if "x%2" == "x" (echo Missing testdll directory for "-td" & goto How2Use) | |
170 set tc_testdlldir=%2 | |
171 shift 2 | |
172 goto check_options | |
173 elseiff "%1" == "-genc" then | |
174 set tc_genc=1 | |
175 set tc_allin1=1 | |
176 shift 1 | |
177 goto check_options | |
178 elseiff "%1" == "-1" then | |
179 set tc_allin1=1 | |
180 shift 1 | |
181 goto check_options | |
182 elseiff "%1" == "-tdc" then | |
183 set tc_tdc=1 | |
184 shift 1 | |
185 goto check_options | |
186 elseiff "%1" == "-i" then | |
187 if "x%2" == "x" (echo Miissing include directory for "-i" & goto How2Use) | |
188 iff "%@INSTR[0,1,%2]" == "." .OR. "%@INSTR[0,1,%2]" == "/" .OR. "%@INSTR[0,1,%2]" == "\" .OR. "%@INSTR[1,1,%2]" == ":" then | |
189 set tc_furtherincludes=%tc_furtherincludes% -I %2 | |
190 else | |
191 set tc_furtherincludes=%tc_furtherincludes% -I %TDSDIR%/%2 | |
192 endiff | |
193 shift 2 | |
194 goto check_options | |
195 endiff | |
196 | |
197 @if %#% GT 2 goto How2Use | |
198 if "%@INSTR[0,1,%1]" == "-" goto unknown_option | |
199 | |
200 iff %tc_allin1% == 1 then | |
201 set decl_extr=%GPF%\BIN\decl-extr.exe | |
202 iff NOT exist %decl_extr% then | |
203 echo You need %decl_extr% to generate test cases | |
204 goto error | |
205 endiff | |
206 endiff | |
207 | |
208 iff %tc_tdc% == 1 then | |
209 set msdev=%@search[msdev] | |
210 iff "x%msdev%" == "x" then | |
211 echo You need MSDEV in your Path to generate TDC test cases | |
212 goto error | |
213 endiff | |
214 endiff | |
215 | |
216 iff "x%2" != "x" then | |
217 iff "x%tc_testconfig" != "x" then | |
218 echo Warning: parameter "%2" ignored, because -eut was set | |
219 else | |
220 set tc_testconfig=%@UPPER[%2] | |
221 endiff | |
222 else | |
223 if "x%tc_testconfig" == "x" set tc_testconfig=%@UPPER[%1] | |
224 endiff | |
225 set ENTI=%@LOWER[%1] | |
226 if "x%tc_bnam%" == "x" set tc_bnam=%ENTI% | |
227 if "x%tc_tdcenti%" == "x" set tc_tdcenti=%ENTI% | |
228 | |
229 @rem Stack-Specifics | |
230 iff "x%TCDIR%" == "x" then | |
231 iff "%PROST" == "WARP" .OR. "%PROST%" == "g23net" then | |
232 set TCDIR=%BINDIR% | |
233 else | |
234 set TCDIR=%TESTROOT%\%SIDE%\TEST | |
235 endiff | |
236 endiff | |
237 iff %tc_tdc% == 1 then | |
238 iff %PROST% == generic then | |
239 set TDCSRCDIR=%TESTROOT%\spec\test\%ENTI% | |
240 else | |
241 iff exist %TESTROOT%\ms\src\%tc_tdcenti%\%tc_bnam%_test then | |
242 set TDCSRCDIR=%TESTROOT%\ms\src\%tc_tdcenti%\%tc_bnam%_test | |
243 elseiff exist %TESTROOT%\ms\src\%tc_tdcenti%\test_%tc_bnam% then | |
244 set TDCSRCDIR=%TESTROOT%\ms\src\%tc_tdcenti%\test_%tc_bnam% | |
245 else | |
246 echo No test case directory | |
247 echo Neither %TESTROOT%\ms\src\%tc_tdcenti%\%tc_bnam%_test | |
248 echo ^s^s^s^snor %TESTROOT%\ms\src\%tc_tdcenti%\test_%tc_bnam% exist | |
249 goto error | |
250 endiff | |
251 endiff | |
252 endiff | |
253 | |
254 %TESTDRIVE% | |
255 | |
256 rem check if test case directory is substructured | |
257 iff "x%tc_testdlldir" =="x" then | |
258 iff "x%TCNOTSUBSTRUCT" == "x" then | |
259 set TESTDLLDIR=%TCDIR%\%tc_testpref%%ENTI%_test | |
260 else | |
261 set TESTDLLDIR=%TCDIR% | |
262 endiff | |
263 else | |
264 iff "%@INSTR[0,1,%tc_testdlldir%]" == "." .OR. "%@INSTR[0,1,%tc_testdlldir%]" == "/" .OR. "%@INSTR[0,1,%tc_testdlldir%]" == "\" .OR. "%@INSTR[1,1,%tc_testdlldir%]" == ":" then | |
265 set TESTDLLDIR=%tc_testdlldir% | |
266 else | |
267 set TESTDLLDIR=%TCDIR%\%tc_testdlldir% | |
268 endiff | |
269 endiff | |
270 | |
271 iff NOT exist %TESTDLLDIR% .AND. %tc_tdc% != 1 then | |
272 echo "Creating test directory %TESTDLLDIR% ..." | |
273 mkdir /S %TESTDLLDIR% | |
274 endiff | |
275 | |
276 rem check if configstring is like EUT=ACI or like MFW | |
277 set EQINP2=%@WORDS["=",%tc_testconfig] | |
278 @iff %EQINP2% GT 1 then | |
279 set TSTDLLCONF="%tc_testconfig%" | |
280 @else | |
281 set TSTDLLCONF="CONFDLL=%tc_testconfig%" | |
282 @endiff | |
283 | |
284 | |
285 iff %tc_tdc% == 1 then | |
286 set tcerr=%TDCSRCDIR%\%ENTI%.err | |
287 iff exist %TDCSRCDIR%\makefile then | |
288 echo Building Testlib with %TDCSRCDIR%\makefile | |
289 call gnumake > %tcerr% | |
290 else | |
291 iff exist %TDCSRCDIR%\%ENTI%_test.dsp then | |
292 set msdevfile=%TDCSRCDIR%\%ENTI%_test.dsp | |
293 elseiff exist %TDCSRCDIR%\%ENTI%_test.dsw then | |
294 set msdevfile=%TDCSRCDIR%\%ENTI%_test.dsw | |
295 elseiff exist %TDCSRCDIR%\test_%ENTI%.dsp then | |
296 set msdevfile=%TDCSRCDIR%\test_%ENTI%.dsp | |
297 elseiff exist %TDCSRCDIR%\test_%ENTI%.dsw then | |
298 set msdevfile=%TDCSRCDIR%\test_%ENTI%.dsw | |
299 else | |
300 set msdevfile=_not_found_ | |
301 endiff | |
302 iff %msdevfile% == _not_found_ then | |
303 echo No Project/Workspace file %ENTI%_test found in %TDCSRCDIR% | |
304 goto error | |
305 endiff | |
306 echo Building Testlib with %msdevfile% | |
307 call msdev.exe %msdevfile% /MAKE "%@NAME[%msdevfile%] - Win32 Debug" /CLEAN > %tcerr% | |
308 iff %? == 0 then | |
309 call msdev.exe %msdevfile% /MAKE "%@NAME[%msdevfile%] - Win32 Debug" /REBUILD >> %tcerr% | |
310 endiff | |
311 endiff | |
312 | |
313 iff %? == 0 then | |
314 echo ...done. | |
315 if exist %tcerr% del /q %tcerr% | |
316 else echo See errors %tcerr & goto end | |
317 endiff | |
318 goto end | |
319 else | |
320 set tcerr=%TDSDIR%\%ENTI%\%ENTI%.err | |
321 endiff | |
322 | |
323 @if %tc_genc == 1 goto gen_c | |
324 @if %TC_COMPILE_ONLY == 1 goto compile_only | |
325 | |
326 @if NOT exist %TSTDOCDIR%\%ENTI%.doc goto NoDoc | |
327 | |
328 @rem Check for tdsgen | |
329 set tdsgen=%GPF%\BIN\tdsGen.exe% | |
330 iff NOT exist %tdsgen% then | |
331 echo You need %tdsgen% to generate test cases | |
332 goto error | |
333 @endiff | |
334 | |
335 rem Check for doc2txt | |
336 set doc2txt=%GPF%\tools\bin\Doc2txt.exe | |
337 iff NOT exist %doc2txt% then | |
338 echo You need %doc2txt% to generate test cases | |
339 goto error | |
340 endiff | |
341 set doc2txt_opts=-O -w -f wdFormatTextLineBreaks | |
342 | |
343 rem Check for tdscheck.exe | |
344 iff %enable_check% == 1 then | |
345 set tdscheck=%GPF%\BIN\tdscheck.exe | |
346 iff NOT EXIST %tdscheck% then | |
347 echo You need %tdscheck% to check your tds files | |
348 goto error | |
349 endiff | |
350 endiff | |
351 | |
352 rem check if tds directory exists | |
353 @iff NOT exist %TDSDIR%\%ENTI% then | |
354 @echo "Creating test directory %TDSDIR%\%ENTI% ..." | |
355 @mkdir /S %TDSDIR%\%ENTI% | |
356 @endiff | |
357 | |
358 @if exist %TDSDIR%\%ENTI%\*.tds del /q %TDSDIR%\%ENTI%\*.tds | |
359 | |
360 %doc2txt% %doc2txt_opts% %TSTDOCDIR%\%ENTI%.doc | |
361 rem hack for office 2000 where a blank is inserted after a backslash-newline | |
362 move /q %TSTDOCDIR%\%ENTI%.txt %TSTDOCDIR%\%ENTI%.txt_ | |
363 %sed% -e "s/\\ $/\\/" %TSTDOCDIR%\%ENTI%.txt_ > %TSTDOCDIR%\%ENTI%.txt | |
364 del /q %TSTDOCDIR%\%ENTI%.txt_ > nul | |
365 rem end of hack | |
366 %tdsgen% %TCDIR% %ENTI% %TSTDOCDIR% %TDSDIR%\%ENTI% | |
367 if %tc_cons_output% == 1 type %tcerr% | |
368 if errorlevel GT 0 goto tdsgenerr | |
369 gosub gen_suites | |
370 @iff %enable_check% == 1 then | |
371 %tdscheck% %TDSDIR%\%ENTI% %ENTI% | |
372 @if errorlevel GT 1 goto tapcheckerrors | |
373 @endiff | |
374 if %tc_gen_only == 1 goto end | |
375 | |
376 :gen_c | |
377 :compile_only | |
378 @if NOT exist %TDSDIR%\%ENTI%\*.tds goto NoTds | |
379 cd %TDSDIR%\%ENTI% | |
380 set tc_exmp_=%@FINDFIRST[*.tds] | |
381 set tc_exmp=%@NAME[%tc_exmp_] | |
382 set tc_exmp_=%@FINDCLOSE[*.tds] | |
383 iff %tc_testenv% == new then | |
384 %grep% SCRIPT_BEGIN %tc_exmp%.tds > nul | |
385 iff %? == 0 then | |
386 set tc_testlanguage=TCSL | |
387 else | |
388 set tc_testlanguage=TDS | |
389 endiff | |
390 endiff | |
391 | |
392 if %tc_allin1% == 0 goto not_allin1 | |
393 | |
394 @if %TC_COMPILE_ONLY == 1 goto compile_c | |
395 echo #include "%ENTI%.h" > %ENTI%.c | |
396 | |
397 @FOR %tcase IN (%TDSDIR%\%ENTI%\*.tds) do ( | |
398 %sed% -e 1,2d -e "s/TESTCASE (\([a-zA-Z0-9_]*\))/EXPORT UBYTE \1(){&/" -e "s/ENDCASE/&;return (%tc_tap_errfunc%());}/" -e "s/#include \"\([a-zA-Z0-9_]*\).[tT][dD][sS]\"/\1();/" %tcase% >> %ENTI%.c | |
399 ) | |
400 | |
401 %grep% EXPORT %ENTI%.c | sed s/{.*/;/ > %ENTI%.h | |
402 %decl_extr% %ENTI%.def %ENTI%.decl | |
403 %grep% #include %ENTI%.def >> %ENTI%.decl | |
404 | |
405 :compile_c | |
406 cdd %tc_gendir% | |
407 call gnumake -f testdll.mk OUTDLL=%TESTDLLDIR%/%ENTI%.DLL %TSTDLLCONF% ALL_IN_ONE=1 TSTDOCNAM=%ENTI% TC_FURTHERINCLUDES="%tc_furtherincludes" TC_TESTLANGUAGE=%tc_testlanguage% all >%tcerr% | |
408 | |
409 iff %? == 0 then | |
410 echo Generated Testlib %TESTDLLDIR%\%ENTI%.DLL. | |
411 if exist %tcerr% del /q %tcerr% | |
412 else echo See %tcerr & goto end | |
413 endiff | |
414 goto end | |
415 | |
416 :not_allin1 | |
417 rem Check ranges | |
418 iff %tc_range_supplied% == 1 then | |
419 set tc_ords=%@SUBSTR[%tc_exmp,%@LEN[%tc_bnam%]] | |
420 set tc_len=%@LEN[%tc_ords] | |
421 if %@NUMERIC[%tc_ords] == 0 set tc_len=%@DEC[%tc_len%] | |
422 iff x%tc_firsttc == x then | |
423 iff %tc_len% == 4 then | |
424 set tc_firsttc=0000 | |
425 else | |
426 set tc_firsttc=000 | |
427 endiff | |
428 else | |
429 set tc_len_=%@LEN[%tc_firsttc] | |
430 if %@NUMERIC[%tc_firsttc] == 0 set tc_len_=%@DEC[%tc_len_%] | |
431 if %tc_len != %tc_len_ echo Warning: your range "%tc_firsttc" is ambigious | |
432 endiff | |
433 iff x%tc_lasttc == x then | |
434 iff %tc_len% == 4 then | |
435 set tc_lasttc=9999Z | |
436 else | |
437 set tc_lasttc=999Z | |
438 endiff | |
439 else | |
440 set tc_len_=%@LEN[%tc_lasttc] | |
441 if %@NUMERIC[%tc_lasttc] == 0 set tc_len_=%@DEC[%tc_len_%] | |
442 if %tc_len != %tc_len_ echo Warning: your range "%tc_lasttc" is ambigious | |
443 endiff | |
444 endiff | |
445 | |
446 rem Deleting all old .err-Files | |
447 @if exist %TDSDIR%\%ENTI%\*.err del /q %TDSDIR%\%ENTI%\%ENTI%*.err | |
448 | |
449 iff %tc_delete_olds == 1 then | |
450 iff exist %TESTDLLDIR%\%tc_bnam%*.dll .OR. exist %TESTDLLDIR%\sui\%tc_bnam%*.dll then | |
451 echo Deleting all old .dll-Files | |
452 if exist %TESTDLLDIR%\%tc_bnam%*.dll del /q %TESTDLLDIR%\%tc_bnam%*.dll | |
453 if exist %TESTDLLDIR%\sui\%tc_bnam%*.dll del /q %TESTDLLDIR%\sui\%tc_bnam%*.dll | |
454 endiff | |
455 endiff | |
456 | |
457 iff %TC_FINALTESTS% == 1 then | |
458 set tc_nonfdummy=%TDSDIR%\%ENTI%\%ENTI%_nonfdummy.txt | |
459 if exist %tc_nonfdummy% del /q %tc_nonfdummy | |
460 %grep% -hi "#include.*tds" %TDSDIR%\%ENTI%\*.tds | %sed% -e "s/#include *[\"^<]\([a-zA-Z0-9]*\).*[\"^>]/\1.td_/" > %tc_nonfdummy% | |
461 iff %tc_testlanguage% == TCSL then | |
462 if exist %ENTI%.sui echo Warning: option -f in combination with Suites and test language TCSL cannot always work properly | |
463 else | |
464 %grep% -Li "#include.*tds" %TDSDIR%\%ENTI%\*.tds | %sed% -e "s/.*\\//" -e "s/tds/td_/" >> %tc_nonfdummy | |
465 endiff | |
466 %sort% < %tc_nonfdummy% | %uniq% | %gawk% -- "{ print $1 > $1 }" | |
467 iff exist %ENTI%.sui then | |
468 %sort% < %tc_nonfdummy% | %uniq% | %sed% -e "s/\(.*\)\.td_/\/\1\/{ print \"\1\"}/" > %ENTI%.awk | |
469 %gawk% -f %ENTI%.awk %ENTI%.sui | %sort% | %uniq% | %sed% -e "s/.*/&.td__/" | %gawk% -- "{ print $1 > $1}" | |
470 del /q %ENTI%.awk | |
471 if NOT isdir %TESTDLLDIR%\sui .AND. exist *.td__ mkdir %TESTDLLDIR%\sui | |
472 endiff | |
473 del /q %tc_nonfdummy | |
474 endiff | |
475 | |
476 cdd %tc_gendir% | |
477 @echo Compiling testcases | |
478 set tc_error_occurred=0 | |
479 FOR %tcase IN (%TDSDIR%\%ENTI%\*.tds) do ( | |
480 if %tc_error_occurred == 0 gosub mk_test | |
481 ) | |
482 goto clean_up | |
483 | |
484 :mk_test | |
485 set tcname=%@NAME[%tcase] | |
486 iff %tc_range_supplied% == 1 then | |
487 set tc_ords=%@SUBSTR[%tcname,%@LEN[%tc_bnam%]] | |
488 set tc_namparam=%tc_bnam%%tc_ords% | |
489 iff %tc_ords% GE %tc_firsttc% .AND. %tc_ords% LE %tc_lasttc% then | |
490 set tc_inrange=1 | |
491 else | |
492 set tc_inrange=0 | |
493 endiff | |
494 else | |
495 set tc_namparam=%tcname% | |
496 set tc_inrange=1 | |
497 endiff | |
498 iff %tc_inrange% == 1 then | |
499 iff EXIST %TDSDIR%\%ENTI%\%tcname%.td__ then | |
500 set OUTDLL=%TESTDLLDIR%/sui/%tcname%.dll | |
501 elseiff NOT EXIST %TDSDIR%\%ENTI%\%tcname%.td_ then | |
502 set OUTDLL=%TESTDLLDIR%/%tcname%.dll | |
503 else | |
504 set OUTDLL= | |
505 endiff | |
506 iff "x%OUTDLL" != "x" then | |
507 %gnumake% -f testdll.mk OUTDLL=%OUTDLL% TSTDOCNAM=%ENTI% TC_NAME=%tc_namparam% %TSTDLLCONF% TC_FURTHERINCLUDES="%tc_furtherincludes" TC_TESTLANGUAGE=%tc_testlanguage% all >%tcerr% | |
508 iff %tc_cons_output% == 1 then | |
509 if %? != 0 set tc_error_occurred=1 | |
510 type %tcerr% | |
511 else | |
512 iff %? == 0 then | |
513 echo %@NAME[%tcase] done. | |
514 else echo Error (%tcname%): See %tcerr & set tc_error_occurred=1 | |
515 endiff | |
516 endiff | |
517 endiff | |
518 return | |
519 | |
520 :gen_suites | |
521 %grep% Suites %TSTDOCDIR%\%ENTI%.txt > nul | |
522 iff %? == 0 then | |
523 set gensuites=%GPF%\BIN\gensuites.awk | |
524 iff NOT EXIST %gensuites% .OR. NOT EXIST %gawk% then | |
525 echo Warning: You need %gensuites% and %gawk% to generate suites | |
526 return | |
527 endiff | |
528 %gawk% -f %gensuites% %TSTDOCDIR%\%ENTI%.txt | tee %TDSDIR%\%ENTI%\%ENTI%.sui > %TESTDLLDIR%\%ENTI%.sui | |
529 echo Generated %TDSDIR%\%ENTI%\%ENTI%.sui | |
530 echo ^s^s^s^s^s^sand %TESTDLLDIR%\%ENTI%.sui | |
531 else | |
532 echo No Suites | |
533 endiff | |
534 return | |
535 | |
536 :clean_up | |
537 iff %tc_error_occurred% == 0 then | |
538 echo Generated Test Cases are in %TESTDLLDIR% | |
539 if exist %tcerr% del /q %tcerr% | |
540 endiff | |
541 | |
542 if exist %TDSDIR%\%ENTI%\*.td_ del /q %TDSDIR%\%ENTI%\*.td_ | |
543 if exist %TDSDIR%\%ENTI%\*.td__ del /q %TDSDIR%\%ENTI%\*.td__ | |
544 goto end | |
545 | |
546 | |
547 :NoDoc | |
548 @echo "%TSTDOCDIR%\%ENTI%.doc does not exist" | |
549 goto error | |
550 | |
551 :NoTds | |
552 @echo "No tds-Files in %TDSDIR%\%ENTI%" | |
553 goto error | |
554 | |
555 :tdsgenerr | |
556 iff %?%==2 @echo Parse error in test case document. See %TDSDIR%\%ENTI%\%ENTI%.err | |
557 iff %?%==3 @echo Error while opening file during generation of test cases | |
558 goto error | |
559 | |
560 :tapcheckerrors | |
561 @echo "tapcheck has found problems in %TSTDOCDIR%\%ENTI%.doc" | |
562 @echo "inspect %TDSDIR%\%ENTI%\%ENTI%.chk" | |
563 goto error | |
564 | |
565 :still_open | |
566 @echo "%TSTDOCDIR%\%ENTI%.doc is still open" | |
567 goto error | |
568 | |
569 :Need4NT | |
570 @echo "Error: 4DOS or 4NT is needed | |
571 goto error | |
572 | |
573 :unknown_option | |
574 echo Unknown Option: %1 | |
575 | |
576 :How2Use | |
577 text | |
578 MkAllTc : Create test cases | |
579 Usage : MkAllTc [-chk] [-co] [-to] [-f] [-r [<first>]-[<last>]] [-k] [-tty] [-oe] [-oed] [-i <incdir>] [-tc <tcbase>] [-eut <entity>] [-td <testdlldir>] [-tdc] <Tdoc> [config] | |
580 Example : MkAllTc CC - creates all available test cases for CC (from CC.doc) | |
581 -chk: call TDSCheck after generating TDS files | |
582 -co : compile only - do not regenerate tds-Files from word source | |
583 -to : generate TDS files only; don't compile test cases | |
584 -f : generate final test only (test, that are not preambles) | |
585 -r : generate range from <first> to <last> | |
586 -k : keep (don't delete) older testcases (useful when using -r) | |
587 -tty: write tools output to console | |
588 -i : set <incdir> as additional include directory for test case compilation | |
589 -td : set <testdlldir> as directory for the test cases | |
590 -oe : old environment; generate test case for Tap on old frame | |
591 -oed: same as -oe, but create test cases in a differently named directory | |
592 -eut: same as EUT=<entity> as last parameter | |
593 -tc : set test case base name | |
594 -tdc: use dedicated makefile or msdev project to generate tdc test cases | |
595 config: EUT=<entity> where the names of testdoc and entity differ | |
596 like: MkAllTc BMIT EUT=ACI | |
597 endtext | |
598 | |
599 :error | |
600 set tc_exitcode=1 | |
601 | |
602 :end | |
603 endlocal | |
604 popd | |
605 quit %tc_exitcode% |