mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2026-02-19 19:16:30 +01:00
tests: ppus: test -Ur with a cycle of two units
This commit is contained in:
parent
060425cab6
commit
b32ecf3459
0
tests/tppu/ancestorchange1/ppus/.gitignore
vendored
Normal file
0
tests/tppu/ancestorchange1/ppus/.gitignore
vendored
Normal file
@ -15,6 +15,7 @@ type
|
||||
private
|
||||
FCompiled: TStringList;
|
||||
FMainSrc: string;
|
||||
FOptionUr: boolean;
|
||||
FOutDir: string;
|
||||
FPP: string;
|
||||
FStep: string;
|
||||
@ -33,6 +34,7 @@ type
|
||||
property OutDir: string read FOutDir write FOutDir;
|
||||
property MainSrc: string read FMainSrc write FMainSrc;
|
||||
property Compiled: TStringList read FCompiled write FCompiled;
|
||||
property OptionUr: boolean read FOptionUr write FOptionUr;
|
||||
property Step: string read FStep write FStep;
|
||||
public
|
||||
constructor Create; override;
|
||||
@ -48,6 +50,9 @@ type
|
||||
procedure TestCycle3_ChangeC; // prog->ant->bird->cat, cat.impl->ant, change cat
|
||||
procedure TestCycleImpl3_ChangeC; // prog->ant.impl->bird.impl->cat, cat.impl->ant, change cat
|
||||
|
||||
// -Ur Generate release unit files (never automatically recompiled)
|
||||
procedure TestUr_cycle2;
|
||||
|
||||
procedure TestChangeInlineBodyBug; // Bug: prog+1 unit plus a package of 2 units, change of inline body should change crc, but does not
|
||||
|
||||
procedure TestBug41457; // two cycles of size 2 and 3
|
||||
@ -79,6 +84,7 @@ begin
|
||||
UnitPath:='';
|
||||
OutDir:='';
|
||||
MainSrc:='';
|
||||
OptionUr:=false;
|
||||
Compiled:=TStringList.Create;
|
||||
end;
|
||||
|
||||
@ -158,6 +164,8 @@ begin
|
||||
try
|
||||
Params.Add('-Fu'+UnitPath);
|
||||
Params.Add('-FE'+OutDir);
|
||||
if OptionUr then
|
||||
Params.Add('-Ur');
|
||||
Params.Add(MainSrc);
|
||||
if not RunTool(PP,Params,'',false,true,Lines) then
|
||||
Fail('compile failed, Step='+Step);
|
||||
@ -427,6 +435,34 @@ begin
|
||||
CheckCompiled(['cycleimpl3_changec_prg.pas','cycleimpl3_changec_cat.pas']);
|
||||
end;
|
||||
|
||||
procedure TTestRecompile.TestUr_cycle2;
|
||||
// ant->bird, bird.impl->ant
|
||||
var
|
||||
Dir: String;
|
||||
begin
|
||||
Dir:='ur_cycle2';
|
||||
UnitPath:=Dir;
|
||||
OutDir:=Dir+PathDelim+'ppus';
|
||||
MainSrc:=Dir+PathDelim+'ur_cycle2_ant.pas';
|
||||
OptionUr:=true;
|
||||
|
||||
Step:='First compile';
|
||||
CleanOutputDir;
|
||||
Compile;
|
||||
CheckCompiled(['ur_cycle2_ant.pas','ur_cycle2_bird.pas']);
|
||||
|
||||
Step:='Second compile, only ant';
|
||||
Compile;
|
||||
// the main src is always compiled, bird is kept even though it is part of the cycle
|
||||
CheckCompiled(['ur_cycle2_ant.pas']);
|
||||
|
||||
Step:='Third compile, only bird';
|
||||
MainSrc:=Dir+PathDelim+'ur_cycle2_bird.pas';
|
||||
Compile;
|
||||
// the main src is always compiled, ant is kept even though it is part of the cycle
|
||||
CheckCompiled(['ur_cycle2_bird.pas']);
|
||||
end;
|
||||
|
||||
procedure TTestRecompile.TestChangeInlineBodyBug;
|
||||
var
|
||||
ProgDir, PkgDir, PkgOutDir: String;
|
||||
|
||||
0
tests/tppu/ur_cycle2/ppus/.gitignore
vendored
Normal file
0
tests/tppu/ur_cycle2/ppus/.gitignore
vendored
Normal file
18
tests/tppu/ur_cycle2/ur_cycle2_ant.pas
Normal file
18
tests/tppu/ur_cycle2/ur_cycle2_ant.pas
Normal file
@ -0,0 +1,18 @@
|
||||
unit ur_cycle2_ant;
|
||||
|
||||
{$mode objfpc}
|
||||
|
||||
interface
|
||||
|
||||
uses ur_cycle2_bird;
|
||||
|
||||
function Walk(w: word): word;
|
||||
|
||||
implementation
|
||||
|
||||
function Walk(w: word): word;
|
||||
begin
|
||||
Result:=2*w;
|
||||
end;
|
||||
|
||||
end.
|
||||
18
tests/tppu/ur_cycle2/ur_cycle2_bird.pas
Normal file
18
tests/tppu/ur_cycle2/ur_cycle2_bird.pas
Normal file
@ -0,0 +1,18 @@
|
||||
unit ur_cycle2_bird;
|
||||
|
||||
{$mode objfpc}
|
||||
|
||||
interface
|
||||
|
||||
function Fly(w: word): word;
|
||||
|
||||
implementation
|
||||
|
||||
uses ur_cycle2_ant;
|
||||
|
||||
function Fly(w: word): word;
|
||||
begin
|
||||
Result:=3*Walk(w);
|
||||
end;
|
||||
|
||||
end.
|
||||
Loading…
Reference in New Issue
Block a user