dotest.pp 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321
  1. {
  2. This file is part of the Free Pascal test suite.
  3. Copyright (c) 1999-2002 by the Free Pascal development team.
  4. This program makes the compilation and
  5. execution of individual test sources.
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. {$H+}
  13. {$goto on}
  14. program dotest;
  15. uses
  16. dos,
  17. {$ifdef macos}
  18. macutils,
  19. {$endif}
  20. teststr,
  21. testu,
  22. redir,
  23. bench,
  24. classes;
  25. {$ifdef go32v2}
  26. {$define LIMIT83FS}
  27. {$endif}
  28. {$ifdef os2}
  29. {$define LIMIT83FS}
  30. {$endif}
  31. type
  32. tcompinfo = (compver,comptarget,compcpu);
  33. tdelexecutable = (deBefore, deAfter);
  34. tdelexecutables = set of tdelexecutable;
  35. const
  36. ObjExt='o';
  37. PPUExt='ppu';
  38. {$ifdef UNIX}
  39. ExeExt='';
  40. {$else UNIX}
  41. {$ifdef MACOS}
  42. ExeExt='';
  43. {$else MACOS}
  44. ExeExt='exe';
  45. {$endif MACOS}
  46. {$endif UNIX}
  47. DefaultTimeout=60;
  48. var
  49. Config : TConfig;
  50. CompilerLogFile,
  51. ExeLogFile,
  52. LongLogfile,
  53. FailLogfile,
  54. RTLUnitsDir,
  55. TestOutputDir,
  56. OutputDir : string;
  57. CompilerBin,
  58. CompilerCPU,
  59. CompilerTarget,
  60. CompilerVersion,
  61. DefaultCompilerCPU,
  62. DefaultCompilerTarget,
  63. DefaultCompilerVersion : string;
  64. PPFile : TStringList;
  65. PPFileInfo : TStringList;
  66. TestName : string;
  67. Current : longint;
  68. const
  69. DoGraph : boolean = false;
  70. DoInteractive : boolean = false;
  71. DoExecute : boolean = false;
  72. DoKnown : boolean = false;
  73. DoAll : boolean = false;
  74. DoUsual : boolean = true;
  75. TargetDir : string = '';
  76. BenchmarkInfo : boolean = false;
  77. ExtraCompilerOpts : string = '';
  78. DelExecutable : TDelExecutables = [];
  79. RemoteAddr : string = '';
  80. RemotePath : string = '/tmp';
  81. RemotePara : string = '';
  82. rshprog : string = 'rsh';
  83. rcpprog : string = 'rcp';
  84. rquote : char = '''';
  85. UseTimeout : boolean = false;
  86. emulatorname : string = '';
  87. Function FileExists (Const F : String) : Boolean;
  88. {
  89. Returns True if the file exists, False if not.
  90. }
  91. Var
  92. info : searchrec;
  93. begin
  94. FindFirst (F,anyfile,Info);
  95. FileExists:=DosError=0;
  96. FindClose (Info);
  97. end;
  98. Function PathExists (Const F : String) : Boolean;
  99. {
  100. Returns True if the file exists, False if not.
  101. }
  102. Var
  103. info : searchrec;
  104. begin
  105. FindFirst (F,anyfile,Info);
  106. PathExists:=(DosError=0) and (Info.Attr and Directory=Directory);
  107. FindClose (Info);
  108. end;
  109. function ToStr(l:longint):string;
  110. var
  111. s : string;
  112. begin
  113. Str(l,s);
  114. ToStr:=s;
  115. end;
  116. function ToStrZero(l:longint;nbzero : byte):string;
  117. var
  118. s : string;
  119. begin
  120. Str(l,s);
  121. while length(s)<nbzero do
  122. s:='0'+s;
  123. ToStrZero:=s;
  124. end;
  125. function trimspace(const s:string):string;
  126. var
  127. i,j : longint;
  128. begin
  129. i:=length(s);
  130. while (i>0) and (s[i] in [#9,' ']) do
  131. dec(i);
  132. j:=1;
  133. while (j<i) and (s[j] in [#9,' ']) do
  134. inc(j);
  135. trimspace:=Copy(s,j,i-j+1);
  136. end;
  137. function IsInList(const entry,list:string):boolean;
  138. var
  139. i,istart : longint;
  140. begin
  141. IsInList:=false;
  142. i:=0;
  143. while (i<length(list)) do
  144. begin
  145. { Find list item }
  146. istart:=i+1;
  147. while (i<length(list)) and
  148. (list[i+1]<>',') do
  149. inc(i);
  150. if Upcase(entry)=Upcase(TrimSpace(Copy(list,istart,i-istart+1))) then
  151. begin
  152. IsInList:=true;
  153. exit;
  154. end;
  155. { skip , }
  156. inc(i);
  157. end;
  158. end;
  159. procedure SetPPFileInfo;
  160. Var
  161. info : searchrec;
  162. dt : DateTime;
  163. begin
  164. FindFirst (PPFile[current],anyfile,Info);
  165. If DosError=0 then
  166. begin
  167. UnpackTime(info.time,dt);
  168. PPFileInfo.Insert(current,PPFile[current]+' '+ToStr(dt.year)+'/'+ToStrZero(dt.month,2)+'/'+
  169. ToStrZero(dt.day,2)+' '+ToStrZero(dt.Hour,2)+':'+ToStrZero(dt.min,2)+':'+ToStrZero(dt.sec,2));
  170. end
  171. else
  172. PPFileInfo.Insert(current,PPFile[current]);
  173. FindClose (Info);
  174. end;
  175. function SplitPath(const s:string):string;
  176. var
  177. i : longint;
  178. begin
  179. i:=Length(s);
  180. while (i>0) and not(s[i] in ['/','\'{$IFDEF MACOS},':'{$ENDIF}]) do
  181. dec(i);
  182. SplitPath:=Copy(s,1,i);
  183. end;
  184. Function SplitFileName(const s:string):string;
  185. var
  186. p : dirstr;
  187. n : namestr;
  188. e : extstr;
  189. begin
  190. FSplit(s,p,n,e);
  191. SplitFileName:=n+e;
  192. end;
  193. function ForceExtension(Const HStr,ext:String):String;
  194. {
  195. Return a filename which certainly has the extension ext
  196. }
  197. var
  198. j : longint;
  199. begin
  200. j:=length(Hstr);
  201. while (j>0) and (Hstr[j]<>'.') do
  202. dec(j);
  203. if j=0 then
  204. j:=255;
  205. if Ext<>'' then
  206. ForceExtension:=Copy(Hstr,1,j-1)+'.'+Ext
  207. else
  208. ForceExtension:=Copy(Hstr,1,j-1);
  209. end;
  210. procedure mkdirtree(const s:string);
  211. var
  212. hs : string;
  213. begin
  214. if s='' then
  215. exit;
  216. if s[length(s)] in ['\','/'{$IFDEF MACOS},':'{$ENDIF}] then
  217. hs:=Copy(s,1,length(s)-1)
  218. else
  219. hs:=s;
  220. if not PathExists(hs) then
  221. begin
  222. { Try parent first }
  223. mkdirtree(SplitPath(hs));
  224. { make this dir }
  225. Verbose(V_Debug,'Making Directory '+s);
  226. {$I-}
  227. mkdir(s);
  228. {$I+}
  229. ioresult;
  230. end;
  231. end;
  232. Function RemoveFile(const f:string):boolean;
  233. var
  234. g : file;
  235. begin
  236. assign(g,f);
  237. {$I-}
  238. erase(g);
  239. {$I+}
  240. RemoveFile:=(ioresult=0);
  241. end;
  242. procedure Copyfile(const fn1,fn2:string;append:boolean);
  243. const
  244. bufsize = 16384;
  245. var
  246. f,g : file;
  247. i : longint;
  248. buf : pointer;
  249. begin
  250. if Append then
  251. Verbose(V_Debug,'Appending '+fn1+' to '+fn2)
  252. else
  253. Verbose(V_Debug,'Copying '+fn1+' to '+fn2);
  254. assign(f,fn1);
  255. assign(g,fn2);
  256. {$I-}
  257. reset(f,1);
  258. {$I+}
  259. if ioresult<>0 then
  260. Verbose(V_Error,'Can''t open '+fn1);
  261. if append then
  262. begin
  263. {$I-}
  264. reset(g,1);
  265. {$I+}
  266. if ioresult<>0 then
  267. append:=false
  268. else
  269. seek(g,filesize(g));
  270. end;
  271. if not append then
  272. begin
  273. {$I-}
  274. rewrite(g,1);
  275. {$I+}
  276. if ioresult<>0 then
  277. Verbose(V_Error,'Can''t open '+fn2+' for output');
  278. end;
  279. getmem(buf,bufsize);
  280. repeat
  281. blockread(f,buf^,bufsize,i);
  282. blockwrite(g,buf^,i);
  283. until i<bufsize;
  284. freemem(buf,bufsize);
  285. close(f);
  286. close(g);
  287. end;
  288. procedure AddLog(const logfile,s:string);
  289. var
  290. t : text;
  291. begin
  292. assign(t,logfile);
  293. {$I-}
  294. append(t);
  295. {$I+}
  296. if ioresult<>0 then
  297. begin
  298. {$I-}
  299. rewrite(t);
  300. {$I+}
  301. if ioresult<>0 then
  302. Verbose(V_Abort,'Can''t append to '+logfile);
  303. end;
  304. writeln(t,s);
  305. close(t);
  306. end;
  307. function GetCompilerInfo(c:tcompinfo):boolean;
  308. function GetToken(var s:string):string;
  309. var
  310. i : longint;
  311. begin
  312. i:=pos(' ',s);
  313. if i=0 then
  314. i:=length(s)+1;
  315. GetToken:=Copy(s,1,i-1);
  316. Delete(s,1,i);
  317. end;
  318. var
  319. t : text;
  320. hs : string;
  321. begin
  322. GetCompilerInfo:=false;
  323. { Try to get all information in one call, this is
  324. supported in 1.1. Older compilers 1.0.x will only
  325. return the first info }
  326. case c of
  327. compver :
  328. begin
  329. if DefaultCompilerVersion<>'' then
  330. begin
  331. GetCompilerInfo:=true;
  332. exit;
  333. end;
  334. hs:='-iVTPTO';
  335. end;
  336. compcpu :
  337. begin
  338. if DefaultCompilerCPU<>'' then
  339. begin
  340. GetCompilerInfo:=true;
  341. exit;
  342. end;
  343. hs:='-iTPTOV';
  344. end;
  345. comptarget :
  346. begin
  347. if DefaultCompilerTarget<>'' then
  348. begin
  349. GetCompilerInfo:=true;
  350. exit;
  351. end;
  352. hs:='-iTOTPV';
  353. end;
  354. end;
  355. ExecuteRedir(CompilerBin,hs,'','out','');
  356. assign(t,'out');
  357. {$I-}
  358. reset(t);
  359. readln(t,hs);
  360. close(t);
  361. erase(t);
  362. {$I+}
  363. if ioresult<>0 then
  364. Verbose(V_Error,'Can''t get Compiler Info')
  365. else
  366. begin
  367. Verbose(V_Debug,'Retrieved Compiler Info: "'+hs+'"');
  368. case c of
  369. compver :
  370. begin
  371. DefaultCompilerVersion:=GetToken(hs);
  372. DefaultCompilerCPU:=GetToken(hs);
  373. DefaultCompilerTarget:=GetToken(hs);
  374. end;
  375. compcpu :
  376. begin
  377. DefaultCompilerCPU:=GetToken(hs);
  378. DefaultCompilerTarget:=GetToken(hs);
  379. DefaultCompilerVersion:=GetToken(hs);
  380. end;
  381. comptarget :
  382. begin
  383. DefaultCompilerTarget:=GetToken(hs);
  384. DefaultCompilerCPU:=GetToken(hs);
  385. DefaultCompilerVersion:=GetToken(hs);
  386. end;
  387. end;
  388. GetCompilerInfo:=true;
  389. end;
  390. end;
  391. function GetCompilerVersion:boolean;
  392. begin
  393. if CompilerVersion='' then
  394. begin
  395. GetCompilerVersion:=GetCompilerInfo(compver);
  396. CompilerVersion:=DefaultCompilerVersion;
  397. end
  398. else
  399. GetCompilerVersion:=true;
  400. if GetCompilerVersion then
  401. Verbose(V_Debug,'Compiler Version: "'+CompilerVersion+'"');
  402. end;
  403. function GetCompilerCPU:boolean;
  404. begin
  405. if CompilerCPU='' then
  406. begin
  407. GetCompilerCPU:=GetCompilerInfo(compcpu);
  408. CompilerCPU:=DefaultCompilerCPU;
  409. end
  410. else
  411. GetCompilerCPU:=true;
  412. if GetCompilerCPU then
  413. Verbose(V_Debug,'Compiler CPU: "'+CompilerCPU+'"');
  414. end;
  415. function GetCompilerTarget:boolean;
  416. begin
  417. if CompilerTarget='' then
  418. begin
  419. GetCompilerTarget:=GetCompilerInfo(comptarget);
  420. CompilerTarget:=DefaultCompilerTarget;
  421. end
  422. else
  423. GetCompilerTarget:=true;
  424. if GetCompilerTarget then
  425. Verbose(V_Debug,'Compiler Target: "'+CompilerTarget+'"');
  426. end;
  427. function CompilerFullTarget:string;
  428. begin
  429. CompilerFullTarget:=CompilerCPU+'-'+CompilerTarget;
  430. end;
  431. function OutputFileName(Const s,ext:String):String;
  432. begin
  433. {$ifndef macos}
  434. OutputFileName:=OutputDir+'/'+ForceExtension(s,ext);
  435. {$else macos}
  436. OutputFileName:=ConcatMacPath(OutputDir,ForceExtension(s,ext));
  437. {$endif macos}
  438. end;
  439. function TestOutputFileName(Const s,ext:String):String;
  440. begin
  441. {$ifndef macos}
  442. TestOutputFileName:=TestOutputDir+'/'+ForceExtension(SplitFileName(s),ext);
  443. {$else macos}
  444. TestOutputFileName:=ConcatMacPath(TestOutputDir,ForceExtension(SplitFileName(s),ext));
  445. {$endif macos}
  446. end;
  447. function ExitWithInternalError(const OutName:string):boolean;
  448. var
  449. t : text;
  450. s : string;
  451. begin
  452. ExitWithInternalError:=false;
  453. { open logfile }
  454. assign(t,Outname);
  455. {$I-}
  456. reset(t);
  457. {$I+}
  458. if ioresult<>0 then
  459. exit;
  460. while not eof(t) do
  461. begin
  462. readln(t,s);
  463. if pos('Fatal: Internal error ',s)>0 then
  464. begin
  465. ExitWithInternalError:=true;
  466. break;
  467. end;
  468. end;
  469. close(t);
  470. end;
  471. function RunCompiler:boolean;
  472. var
  473. args,
  474. wpoargs : string;
  475. passnr,
  476. passes : longint;
  477. execres : boolean;
  478. begin
  479. RunCompiler:=false;
  480. args:='-n -T'+CompilerTarget+' -Fu'+RTLUnitsDir;
  481. args:=args+' -FE'+TestOutputDir;
  482. {$ifdef macos}
  483. args:=args+' -WT '; {tests should be compiled as MPWTool}
  484. {$endif macos}
  485. if ExtraCompilerOpts<>'' then
  486. args:=args+ExtraCompilerOpts;
  487. {$ifdef unix}
  488. { Add runtime library path to current dir to find .so files }
  489. if Config.NeedLibrary then
  490. {$ifndef darwin}
  491. args:=args+' -Fl'+TestOutputDir+' ''-k-rpath .''';
  492. {$else darwin}
  493. args:=args+' -Fl'+TestOutputDir;
  494. {$endif darwin}
  495. {$endif unix}
  496. if Config.NeedOptions<>'' then
  497. args:=args+' '+Config.NeedOptions;
  498. wpoargs:='';
  499. if (Config.WpoPasses=0) or
  500. (Config.WpoParas='') then
  501. passes:=1
  502. else
  503. passes:=config.wpopasses+1;
  504. args:=args+' '+PPFile[current];
  505. for passnr:=1 to passes do
  506. begin
  507. if (passes>1) then
  508. begin
  509. wpoargs:=' -OW'+config.wpoparas+' -FW'+TestOutputFileName(PPFile[current],'wp'+tostr(passnr));
  510. if (passnr>1) then
  511. wpoargs:=wpoargs+' -Ow'+config.wpoparas+' -Fw'+TestOutputFileName(PPFile[current],'wp'+tostr(passnr-1));
  512. end;
  513. Verbose(V_Debug,'Executing '+compilerbin+' '+args+wpoargs);
  514. { also get the output from as and ld that writes to stderr sometimes }
  515. {$ifndef macos}
  516. execres:=ExecuteRedir(CompilerBin,args+wpoargs,'',CompilerLogFile,'stdout');
  517. {$else macos}
  518. {Due to that Toolserver is not reentrant, we have to asm and link via script.}
  519. execres:=ExecuteRedir(CompilerBin,'-s '+args+wpoargs,'',CompilerLogFile,'stdout');
  520. if execres then
  521. execres:=ExecuteRedir(TestOutputDir + ':ppas','','',CompilerLogFile,'stdout');
  522. {$endif macos}
  523. Verbose(V_Debug,'Exitcode '+ToStr(ExecuteResult));
  524. { Error during execution? }
  525. if (not execres) and (ExecuteResult=0) then
  526. begin
  527. AddLog(FailLogFile,TestName);
  528. AddLog(ResLogFile,failed_to_compile+PPFileInfo[current]);
  529. AddLog(LongLogFile,line_separation);
  530. AddLog(LongLogFile,failed_to_compile+PPFileInfo[current]);
  531. CopyFile(CompilerLogFile,LongLogFile,true);
  532. { avoid to try again }
  533. AddLog(ExeLogFile,failed_to_compile+PPFileInfo[current]);
  534. Verbose(V_Warning,'IOStatus: '+ToStr(IOStatus));
  535. exit;
  536. end;
  537. { Check for internal error }
  538. if ExitWithInternalError(CompilerLogFile) then
  539. begin
  540. AddLog(FailLogFile,TestName);
  541. if Config.Note<>'' then
  542. AddLog(FailLogFile,Config.Note);
  543. AddLog(ResLogFile,failed_to_compile+PPFileInfo[current]+' internalerror generated');
  544. AddLog(LongLogFile,line_separation);
  545. AddLog(LongLogFile,failed_to_compile+PPFileInfo[current]);
  546. if Config.Note<>'' then
  547. AddLog(LongLogFile,Config.Note);
  548. CopyFile(CompilerLogFile,LongLogFile,true);
  549. { avoid to try again }
  550. AddLog(ExeLogFile,'Failed to compile '+PPFileInfo[current]);
  551. Verbose(V_Warning,'Internal error in compiler');
  552. exit;
  553. end;
  554. end;
  555. { Should the compile fail ? }
  556. if Config.ShouldFail then
  557. begin
  558. if ExecuteResult<>0 then
  559. begin
  560. AddLog(ResLogFile,success_compilation_failed+PPFileInfo[current]);
  561. { avoid to try again }
  562. AddLog(ExeLogFile,success_compilation_failed+PPFileInfo[current]);
  563. RunCompiler:=true;
  564. end
  565. else
  566. begin
  567. AddLog(FailLogFile,TestName);
  568. if Config.Note<>'' then
  569. AddLog(FailLogFile,Config.Note);
  570. AddLog(ResLogFile,failed_compilation_successful+PPFileInfo[current]);
  571. AddLog(LongLogFile,line_separation);
  572. AddLog(LongLogFile,failed_compilation_successful+PPFileInfo[current]);
  573. { avoid to try again }
  574. AddLog(ExeLogFile,failed_compilation_successful+PPFileInfo[current]);
  575. if Config.Note<>'' then
  576. AddLog(LongLogFile,Config.Note);
  577. CopyFile(CompilerLogFile,LongLogFile,true);
  578. end;
  579. end
  580. else
  581. begin
  582. if (ExecuteResult<>0) and
  583. (((Config.KnownCompileNote<>'') and (Config.KnownCompileError=0)) or
  584. ((Config.KnownCompileError<>0) and (ExecuteResult=Config.KnownCompileError))) then
  585. begin
  586. AddLog(FailLogFile,TestName+known_problem+Config.KnownCompileNote);
  587. AddLog(ResLogFile,failed_to_run+PPFileInfo[current]+known_problem+Config.KnownCompileNote);
  588. AddLog(LongLogFile,line_separation);
  589. AddLog(LongLogFile,known_problem+Config.KnownCompileNote);
  590. AddLog(LongLogFile,failed_to_compile+PPFileInfo[current]+' ('+ToStr(ExecuteResult)+')');
  591. Copyfile(CompilerLogFile,LongLogFile,true);
  592. Verbose(V_Warning,known_problem+'exitcode: '+ToStr(ExecuteResult));
  593. end
  594. else if ExecuteResult<>0 then
  595. begin
  596. AddLog(FailLogFile,TestName);
  597. if Config.Note<>'' then
  598. AddLog(FailLogFile,Config.Note);
  599. AddLog(ResLogFile,failed_to_compile+PPFileInfo[current]);
  600. AddLog(LongLogFile,line_separation);
  601. AddLog(LongLogFile,failed_to_compile+PPFileInfo[current]);
  602. if Config.Note<>'' then
  603. AddLog(LongLogFile,Config.Note);
  604. CopyFile(CompilerLogFile,LongLogFile,true);
  605. { avoid to try again }
  606. AddLog(ExeLogFile,failed_to_compile+PPFileInfo[current]);
  607. Verbose(V_Warning,'Exitcode: '+ToStr(ExecuteResult)+' (expected 0)');
  608. end
  609. else
  610. begin
  611. AddLog(ResLogFile,successfully_compiled+PPFileInfo[current]);
  612. RunCompiler:=true;
  613. end;
  614. end;
  615. end;
  616. function CheckTestExitCode(const OutName:string):boolean;
  617. var
  618. t : text;
  619. s : string;
  620. i,code : integer;
  621. begin
  622. CheckTestExitCode:=false;
  623. { open logfile }
  624. assign(t,Outname);
  625. {$I-}
  626. reset(t);
  627. {$I+}
  628. if ioresult<>0 then
  629. exit;
  630. while not eof(t) do
  631. begin
  632. readln(t,s);
  633. i:=pos('TestExitCode: ',s);
  634. if i>0 then
  635. begin
  636. delete(s,1,i+14-1);
  637. val(s,ExecuteResult,code);
  638. if code=0 then;
  639. CheckTestExitCode:=true;
  640. break;
  641. end;
  642. end;
  643. close(t);
  644. end;
  645. function RunExecutable:boolean;
  646. const
  647. {$ifdef unix}
  648. CurrDir = './';
  649. {$else}
  650. CurrDir = '';
  651. {$endif}
  652. var
  653. s,
  654. OldDir,
  655. FullExeLogFile,
  656. TestRemoteExe,
  657. TestExe : string;
  658. LocalFile, RemoteFile: string;
  659. LocalPath: string;
  660. execcmd : string;
  661. execres : boolean;
  662. index : integer;
  663. EndTicks,
  664. StartTicks : int64;
  665. function ExecuteRemote(const prog,args:string):boolean;
  666. begin
  667. Verbose(V_Debug,'RemoteExecuting '+Prog+' '+args);
  668. StartTicks:=GetMicroSTicks;
  669. ExecuteRemote:=ExecuteRedir(prog,args,'',EXELogFile,'stdout');
  670. EndTicks:=GetMicroSTicks;
  671. end;
  672. function ExecuteEmulated(const prog,args:string):boolean;
  673. begin
  674. Verbose(V_Debug,'EmulatorExecuting '+Prog+' '+args);
  675. StartTicks:=GetMicroSTicks;
  676. ExecuteEmulated:=ExecuteRedir(prog,args,'',FullExeLogFile,'stdout');
  677. EndTicks:=GetMicroSTicks;
  678. end;
  679. label
  680. done;
  681. begin
  682. RunExecutable:=false;
  683. execres:=true;
  684. { when remote testing, leave extension away }
  685. if RemoteAddr='' then
  686. TestExe:=OutputFileName(PPFile[current],ExeExt)
  687. else
  688. TestExe:=OutputFileName(PPFile[current],'');
  689. if EmulatorName<>'' then
  690. begin
  691. { Get full name out log file, because we change the directory during
  692. execution }
  693. FullExeLogFile:=FExpand(EXELogFile);
  694. {$I-}
  695. GetDir(0,OldDir);
  696. ChDir(TestOutputDir);
  697. {$I+}
  698. ioresult;
  699. s:=CurrDir+SplitFileName(TestExe);
  700. execres:=ExecuteEmulated(EmulatorName,s);
  701. {$I-}
  702. ChDir(OldDir);
  703. {$I+}
  704. end
  705. else if RemoteAddr<>'' then
  706. begin
  707. { We don't want to create subdirs, remove paths from the test }
  708. TestRemoteExe:=RemotePath+'/'+SplitFileName(TestExe);
  709. if deBefore in DelExecutable then
  710. ExecuteRemote(rshprog,RemotePara+' '+RemoteAddr+' rm -f '+TestRemoteExe);
  711. execres:=ExecuteRemote(rcpprog,RemotePara+' '+TestExe+' '+RemoteAddr+':'+TestRemoteExe);
  712. if not execres then
  713. begin
  714. Verbose(V_Abort, 'Could not copy executable '+TestExe);
  715. goto done;
  716. end;
  717. s:=Config.Files;
  718. if length(s) > 0 then
  719. begin
  720. LocalPath:=SplitPath(PPFile[current]);
  721. if Length(LocalPath) > 0 then
  722. LocalPath:=LocalPath+'/';
  723. repeat
  724. index:=pos(' ',s);
  725. if index=0 then
  726. LocalFile:=s
  727. else
  728. LocalFile:=copy(s,1,index-1);
  729. RemoteFile:=RemotePath+'/'+SplitFileName(LocalFile);
  730. LocalFile:=LocalPath+LocalFile;
  731. execres:=ExecuteRemote(rcpprog,RemotePara+' '+LocalFile+' '+RemoteAddr+':'+RemoteFile);
  732. if not execres then
  733. begin
  734. Verbose(V_Abort, 'Could not copy required file '+LocalFile);
  735. goto done;
  736. end;
  737. if index=0 then
  738. break;
  739. s:=copy(s,index+1,length(s)-index);
  740. until false;
  741. end;
  742. { rsh doesn't pass the exitcode, use a second command to print the exitcode
  743. on the remoteshell to stdout }
  744. execcmd:=RemotePara+' '+RemoteAddr+' '+rquote+'chmod 755 '+TestRemoteExe+
  745. ' ; cd '+RemotePath+' ;';
  746. if UseTimeout then
  747. begin
  748. execcmd:=execcmd+'timeout -9 ';
  749. if Config.Timeout=0 then
  750. Config.Timeout:=DefaultTimeout;
  751. str(Config.Timeout,s);
  752. execcmd:=execcmd+s;
  753. end;
  754. execcmd:=execcmd+' '+TestRemoteExe+' ; echo "TestExitCode: $?"';
  755. if deAfter in DelExecutable then
  756. execcmd:=execcmd+' ; rm -f '+TestRemoteExe;
  757. execcmd:=execcmd+rquote;
  758. execres:=ExecuteRemote(rshprog,execcmd);
  759. { Check for TestExitCode error in output, sets ExecuteResult }
  760. CheckTestExitCode(EXELogFile);
  761. end
  762. else
  763. begin
  764. { Get full name out log file, because we change the directory during
  765. execution }
  766. FullExeLogFile:=FExpand(EXELogFile);
  767. Verbose(V_Debug,'Executing '+TestExe);
  768. {$I-}
  769. GetDir(0,OldDir);
  770. ChDir(TestOutputDir);
  771. {$I+}
  772. ioresult;
  773. { don't redirect interactive and graph programs }
  774. StartTicks:=GetMicroSTicks;
  775. if Config.IsInteractive or Config.UsesGraph then
  776. execres:=ExecuteRedir(CurrDir+SplitFileName(TestExe),'','','','')
  777. else
  778. execres:=ExecuteRedir(CurrDir+SplitFileName(TestExe),'','',FullExeLogFile,'stdout');
  779. EndTicks:=GetMicroSTicks;
  780. {$I-}
  781. ChDir(OldDir);
  782. {$I+}
  783. ioresult;
  784. end;
  785. { Error during execution? }
  786. Verbose(V_Debug,'Exitcode '+ToStr(ExecuteResult));
  787. if BenchmarkInfo then
  788. begin
  789. Verbose(V_Normal,'Execution took '+ToStr(EndTicks-StartTicks)+' us');
  790. end;
  791. done:
  792. if (not execres) and (ExecuteResult=0) then
  793. begin
  794. AddLog(FailLogFile,TestName);
  795. AddLog(ResLogFile,failed_to_run+PPFileInfo[current]);
  796. AddLog(LongLogFile,line_separation);
  797. AddLog(LongLogFile,failed_to_run+PPFileInfo[current]);
  798. CopyFile(EXELogFile,LongLogFile,true);
  799. { avoid to try again }
  800. AddLog(ExeLogFile,failed_to_run+PPFileInfo[current]);
  801. Verbose(V_Warning,'IOStatus: '+ToStr(IOStatus));
  802. exit;
  803. end;
  804. if ExecuteResult<>Config.ResultCode then
  805. begin
  806. if (ExecuteResult<>0) and
  807. (ExecuteResult=Config.KnownRunError) then
  808. begin
  809. AddLog(FailLogFile,TestName+known_problem+Config.KnownRunNote);
  810. AddLog(ResLogFile,failed_to_run+PPFileInfo[current]+known_problem+Config.KnownRunNote);
  811. AddLog(LongLogFile,line_separation);
  812. AddLog(LongLogFile,known_problem+Config.KnownRunNote);
  813. AddLog(LongLogFile,failed_to_run+PPFileInfo[current]+' ('+ToStr(ExecuteResult)+')');
  814. Copyfile(EXELogFile,LongLogFile,true);
  815. Verbose(V_Warning,known_problem+'exitcode: '+ToStr(ExecuteResult)+' (expected '+ToStr(Config.ResultCode)+')');
  816. end
  817. else
  818. begin
  819. AddLog(FailLogFile,TestName);
  820. AddLog(ResLogFile,failed_to_run+PPFileInfo[current]);
  821. AddLog(LongLogFile,line_separation);
  822. AddLog(LongLogFile,failed_to_run+PPFileInfo[current]+' ('+ToStr(ExecuteResult)+')');
  823. Copyfile(EXELogFile,LongLogFile,true);
  824. Verbose(V_Warning,'Exitcode: '+ToStr(ExecuteResult)+' (expected '+ToStr(Config.ResultCode)+')');
  825. end
  826. end
  827. else
  828. begin
  829. AddLog(ResLogFile,successfully_run+PPFileInfo[current]);
  830. RunExecutable:=true;
  831. end;
  832. if deAfter in DelExecutable then
  833. begin
  834. Verbose(V_Debug,'Deleting executable '+TestExe);
  835. RemoveFile(TestExe);
  836. RemoveFile(ForceExtension(TestExe,ObjExt));
  837. RemoveFile(ForceExtension(TestExe,PPUExt));
  838. end;
  839. end;
  840. procedure getargs;
  841. var
  842. ch : char;
  843. para : string;
  844. i,j : longint;
  845. procedure helpscreen;
  846. begin
  847. writeln('dotest [Options] <File>');
  848. writeln;
  849. writeln('Options can be:');
  850. writeln(' -B delete executable before remote upload');
  851. writeln(' -C<compiler> set compiler to use');
  852. writeln(' -V verbose');
  853. writeln(' -E execute test also');
  854. writeln(' -X don''t use COMSPEC');
  855. writeln(' -A include ALL tests');
  856. writeln(' -G include graph tests');
  857. writeln(' -K include known bug tests');
  858. writeln(' -I include interactive tests');
  859. writeln(' -O use timeout wrapper for (remote) execution');
  860. writeln(' -M<emulator> run the tests using the given emulator');
  861. writeln(' -R<remote> run the tests remotely with the given rsh/ssh address');
  862. writeln(' -S use ssh instead of rsh');
  863. writeln(' -T[cpu-]<os> run tests for target cpu and os');
  864. writeln(' -P<path> path to the tests tree on the remote machine');
  865. writeln(' -U<remotepara>');
  866. writeln(' pass additional parameter to remote program. Multiple -U can be used');
  867. writeln(' -V be verbose');
  868. writeln(' -W use putty compatible file names when testing (plink and pscp)');
  869. writeln(' -Y<opts> extra options passed to the compiler. Several -Y<opt> can be given.');
  870. writeln(' -Z remove temporary files (executable,ppu,o)');
  871. halt(1);
  872. end;
  873. begin
  874. if exeext<>'' then
  875. CompilerBin:='ppc386.'+exeext
  876. else
  877. CompilerBin:='ppc386';
  878. for i:=1 to paramcount do
  879. begin
  880. para:=Paramstr(i);
  881. if (para[1]='-') then
  882. begin
  883. ch:=Upcase(para[2]);
  884. delete(para,1,2);
  885. case ch of
  886. 'A' :
  887. begin
  888. DoGraph:=true;
  889. DoInteractive:=true;
  890. DoKnown:=true;
  891. DoAll:=true;
  892. end;
  893. 'B' : Include(DelExecutable,deBefore);
  894. 'C' : CompilerBin:=Para;
  895. 'E' : DoExecute:=true;
  896. 'G' : begin
  897. DoGraph:=true;
  898. if para='-' then
  899. DoUsual:=false;
  900. end;
  901. 'I' : begin
  902. DoInteractive:=true;
  903. if para='-' then
  904. DoUsual:=false;
  905. end;
  906. 'K' : begin
  907. DoKnown:=true;
  908. if para='-' then
  909. DoUsual:=false;
  910. end;
  911. 'M' : EmulatorName:=Para;
  912. 'O' : UseTimeout:=true;
  913. 'P' : RemotePath:=Para;
  914. 'R' : RemoteAddr:=Para;
  915. 'S' :
  916. begin
  917. rshprog:='ssh';
  918. rcpprog:='scp';
  919. end;
  920. 'T' :
  921. begin
  922. j:=Pos('-',Para);
  923. if j>0 then
  924. begin
  925. CompilerCPU:=Copy(Para,1,j-1);
  926. CompilerTarget:=Copy(Para,j+1,255);
  927. end
  928. else
  929. CompilerTarget:=Para
  930. end;
  931. 'U' :
  932. RemotePara:=RemotePara+' '+Para;
  933. 'V' : DoVerbose:=true;
  934. 'W' :
  935. begin
  936. rshprog:='plink';
  937. rcpprog:='pscp';
  938. rquote:=' ';
  939. end;
  940. 'X' : UseComSpec:=false;
  941. 'Y' : ExtraCompilerOpts:= ExtraCompilerOpts +' '+ Para;
  942. 'Z' : Include(DelExecutable,deAfter);
  943. end;
  944. end
  945. else
  946. begin
  947. PPFile.Insert(current,ForceExtension(Para,'pp'));
  948. inc(current);
  949. end;
  950. end;
  951. if current=0 then
  952. HelpScreen;
  953. { disable graph,interactive when running remote }
  954. if RemoteAddr<>'' then
  955. begin
  956. DoGraph:=false;
  957. DoInteractive:=false;
  958. end;
  959. end;
  960. procedure RunTest;
  961. var
  962. PPDir : string;
  963. Res : boolean;
  964. begin
  965. Res:=GetConfig(PPFile[current],Config);
  966. if Res then
  967. begin
  968. Res:=GetCompilerCPU;
  969. Res:=GetCompilerTarget;
  970. {$ifndef MACOS}
  971. RTLUnitsDir:='units/'+{$ifdef LIMIT83FS}CompilerTarget{$else}CompilerFullTarget{$endif};
  972. {$else MACOS}
  973. RTLUnitsDir:=':units:'+CompilerFullTarget;
  974. {$endif MACOS}
  975. if not PathExists(RTLUnitsDir) then
  976. Verbose(V_Abort,'Unit path "'+RTLUnitsDir+'" does not exists');
  977. {$ifndef MACOS}
  978. OutputDir:='output/'+{$ifdef LIMIT83FS}CompilerTarget{$else}CompilerFullTarget{$endif};
  979. {$else MACOS}
  980. OutputDir:=':output:'+CompilerFullTarget;
  981. {$endif MACOS}
  982. if not PathExists(OutputDir) then
  983. Verbose(V_Abort,'Output path "'+OutputDir+'" does not exists');
  984. { Global log files }
  985. ResLogFile:=OutputFileName('log','');
  986. LongLogFile:=OutputFileName('longlog','');
  987. FailLogFile:=OutputFileName('faillist','');
  988. { Make subdir in output if needed }
  989. PPDir:=SplitPath(PPFile[current]);
  990. if PPDir[length(PPDir)] in ['/','\'{$ifdef MACOS},':'{$endif MACOS}] then
  991. Delete(PPDir,length(PPDir),1);
  992. if PPDir<>'' then
  993. begin
  994. {$ifndef MACOS}
  995. TestOutputDir:=OutputDir+'/'+PPDir;
  996. {$else MACOS}
  997. TestOutputDir:=OutputDir+PPDir;
  998. {$endif MACOS}
  999. mkdirtree(TestOutputDir);
  1000. end
  1001. else
  1002. TestOutputDir:=OutputDir;
  1003. { Per test logfiles }
  1004. CompilerLogFile:=TestOutputFileName(SplitFileName(PPFile[current]),'log');
  1005. ExeLogFile:=TestOutputFileName(SplitFileName(PPFile[current]),'elg');
  1006. Verbose(V_Debug,'Using Compiler logfile: '+CompilerLogFile);
  1007. Verbose(V_Debug,'Using Execution logfile: '+ExeLogFile);
  1008. end;
  1009. if Res then
  1010. begin
  1011. if Config.UsesGraph and (not DoGraph) then
  1012. begin
  1013. AddLog(ResLogFile,skipping_graph_test+PPFileInfo[current]);
  1014. { avoid a second attempt by writing to elg file }
  1015. AddLog(EXELogFile,skipping_graph_test+PPFileInfo[current]);
  1016. Verbose(V_Warning,skipping_graph_test);
  1017. Res:=false;
  1018. end;
  1019. end;
  1020. if Res then
  1021. begin
  1022. if Config.IsInteractive and (not DoInteractive) then
  1023. begin
  1024. { avoid a second attempt by writing to elg file }
  1025. AddLog(EXELogFile,skipping_interactive_test+PPFileInfo[current]);
  1026. AddLog(ResLogFile,skipping_interactive_test+PPFileInfo[current]);
  1027. Verbose(V_Warning,skipping_interactive_test);
  1028. Res:=false;
  1029. end;
  1030. end;
  1031. if Res then
  1032. begin
  1033. if Config.IsKnownCompileError and (not DoKnown) then
  1034. begin
  1035. { avoid a second attempt by writing to elg file }
  1036. AddLog(EXELogFile,skipping_known_bug+PPFileInfo[current]);
  1037. AddLog(ResLogFile,skipping_known_bug+PPFileInfo[current]);
  1038. Verbose(V_Warning,skipping_known_bug);
  1039. Res:=false;
  1040. end;
  1041. end;
  1042. if Res and not DoUsual then
  1043. res:=(Config.IsInteractive and DoInteractive) or
  1044. (Config.IsKnownRunError and DoKnown) or
  1045. (Config.UsesGraph and DoGraph);
  1046. if Res then
  1047. begin
  1048. if (Config.MinVersion<>'') and not DoAll then
  1049. begin
  1050. Verbose(V_Debug,'Required compiler version: '+Config.MinVersion);
  1051. Res:=GetCompilerVersion;
  1052. if CompilerVersion<Config.MinVersion then
  1053. begin
  1054. { avoid a second attempt by writing to elg file }
  1055. AddLog(EXELogFile,skipping_compiler_version_too_low+PPFileInfo[current]);
  1056. AddLog(ResLogFile,skipping_compiler_version_too_low+PPFileInfo[current]);
  1057. Verbose(V_Warning,'Compiler version too low '+CompilerVersion+' < '+Config.MinVersion);
  1058. Res:=false;
  1059. end;
  1060. end;
  1061. end;
  1062. if Res then
  1063. begin
  1064. if (Config.MaxVersion<>'') and not DoAll then
  1065. begin
  1066. Verbose(V_Debug,'Highest compiler version: '+Config.MaxVersion);
  1067. Res:=GetCompilerVersion;
  1068. if CompilerVersion>Config.MaxVersion then
  1069. begin
  1070. { avoid a second attempt by writing to elg file }
  1071. AddLog(EXELogFile,skipping_compiler_version_too_high+PPFileInfo[current]);
  1072. AddLog(ResLogFile,skipping_compiler_version_too_high+PPFileInfo[current]);
  1073. Verbose(V_Warning,'Compiler version too high '+CompilerVersion+' > '+Config.MaxVersion);
  1074. Res:=false;
  1075. end;
  1076. end;
  1077. end;
  1078. if Res then
  1079. begin
  1080. if Config.NeedCPU<>'' then
  1081. begin
  1082. Verbose(V_Debug,'Required compiler cpu: '+Config.NeedCPU);
  1083. if not IsInList(CompilerCPU,Config.NeedCPU) then
  1084. begin
  1085. { avoid a second attempt by writing to elg file }
  1086. AddLog(EXELogFile,skipping_other_cpu+PPFileInfo[current]);
  1087. AddLog(ResLogFile,skipping_other_cpu+PPFileInfo[current]);
  1088. Verbose(V_Warning,'Compiler cpu "'+CompilerCPU+'" is not in list "'+Config.NeedCPU+'"');
  1089. Res:=false;
  1090. end;
  1091. end;
  1092. end;
  1093. if Res then
  1094. begin
  1095. if Config.SkipCPU<>'' then
  1096. begin
  1097. Verbose(V_Debug,'Skip compiler cpu: '+Config.SkipCPU);
  1098. if IsInList(CompilerCPU,Config.SkipCPU) then
  1099. begin
  1100. { avoid a second attempt by writing to elg file }
  1101. AddLog(EXELogFile,skipping_other_cpu+PPFileInfo[current]);
  1102. AddLog(ResLogFile,skipping_other_cpu+PPFileInfo[current]);
  1103. Verbose(V_Warning,'Compiler cpu "'+CompilerCPU+'" is in list "'+Config.SkipCPU+'"');
  1104. Res:=false;
  1105. end;
  1106. end;
  1107. end;
  1108. if Res then
  1109. begin
  1110. if Config.SkipEmu<>'' then
  1111. begin
  1112. Verbose(V_Debug,'Skip emulator: '+emulatorname);
  1113. if IsInList(emulatorname,Config.SkipEmu) then
  1114. begin
  1115. { avoid a second attempt by writing to elg file }
  1116. AddLog(EXELogFile,skipping_other_cpu+PPFileInfo[current]);
  1117. AddLog(ResLogFile,skipping_other_cpu+PPFileInfo[current]);
  1118. Verbose(V_Warning,'Emulator "'+emulatorname+'" is in list "'+Config.SkipEmu+'"');
  1119. Res:=false;
  1120. end;
  1121. end;
  1122. end;
  1123. if Res then
  1124. begin
  1125. if Config.NeedTarget<>'' then
  1126. begin
  1127. Verbose(V_Debug,'Required compiler target: '+Config.NeedTarget);
  1128. if not IsInList(CompilerTarget,Config.NeedTarget) then
  1129. begin
  1130. { avoid a second attempt by writing to elg file }
  1131. AddLog(EXELogFile,skipping_other_target+PPFileInfo[current]);
  1132. AddLog(ResLogFile,skipping_other_target+PPFileInfo[current]);
  1133. Verbose(V_Warning,'Compiler target "'+CompilerTarget+'" is not in list "'+Config.NeedTarget+'"');
  1134. Res:=false;
  1135. end;
  1136. end;
  1137. end;
  1138. if Res then
  1139. begin
  1140. if Config.SkipTarget<>'' then
  1141. begin
  1142. Verbose(V_Debug,'Skip compiler target: '+Config.NeedTarget);
  1143. if IsInList(CompilerTarget,Config.SkipTarget) then
  1144. begin
  1145. { avoid a second attempt by writing to elg file }
  1146. AddLog(EXELogFile,skipping_other_target+PPFileInfo[current]);
  1147. AddLog(ResLogFile,skipping_other_target+PPFileInfo[current]);
  1148. Verbose(V_Warning,'Compiler target "'+CompilerTarget+'" is in list "'+Config.SkipTarget+'"');
  1149. Res:=false;
  1150. end;
  1151. end;
  1152. end;
  1153. if Res then
  1154. begin
  1155. Res:=RunCompiler;
  1156. if Res and Config.NeedRecompile then
  1157. Res:=RunCompiler;
  1158. end;
  1159. if Res and (not Config.ShouldFail) then
  1160. begin
  1161. if (Config.NoRun) then
  1162. begin
  1163. { avoid a second attempt by writing to elg file }
  1164. AddLog(EXELogFile,skipping_run_test+PPFileInfo[current]);
  1165. AddLog(ResLogFile,skipping_run_test+PPFileInfo[current]);
  1166. Verbose(V_Debug,skipping_run_test);
  1167. end
  1168. else if Config.IsKnownRunError and (not DoKnown) then
  1169. begin
  1170. { avoid a second attempt by writing to elg file }
  1171. AddLog(EXELogFile,skipping_known_bug+PPFileInfo[current]);
  1172. AddLog(ResLogFile,skipping_known_bug+PPFileInfo[current]);
  1173. Verbose(V_Warning,skipping_known_bug);
  1174. end
  1175. else
  1176. begin
  1177. if DoExecute then
  1178. begin
  1179. if FileExists(TestOutputFilename(PPFile[current],'ppu')) or
  1180. FileExists(TestOutputFilename(PPFile[current],'ppo')) or
  1181. FileExists(TestOutputFilename(PPFile[current],'ppw')) then
  1182. begin
  1183. AddLog(ExeLogFile,skipping_run_unit+PPFileInfo[current]);
  1184. AddLog(ResLogFile,skipping_run_unit+PPFileInfo[current]);
  1185. Verbose(V_Debug,'Unit found, skipping run test')
  1186. end
  1187. else
  1188. Res:=RunExecutable;
  1189. end;
  1190. end;
  1191. end;
  1192. end;
  1193. begin
  1194. Current:=0;
  1195. PPFile:=TStringList.Create;
  1196. PPFile.Capacity:=10;
  1197. PPFileInfo:=TStringList.Create;
  1198. PPFileInfo.Capacity:=10;
  1199. GetArgs;
  1200. Verbose(V_Debug,'Found '+ToStr(PPFile.Count)+' tests to run');
  1201. if current>0 then
  1202. for current:=0 to PPFile.Count-1 do
  1203. begin
  1204. SetPPFileInfo;
  1205. TestName:=Copy(PPFile[current],1,Pos('.pp',PPFile[current])-1);
  1206. Verbose(V_Normal,'Running test '+TestName+', file '+PPFile[current]);
  1207. RunTest;
  1208. end;
  1209. PPFile.Free;
  1210. PPFileInfo.Free;
  1211. end.