mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 07:26:24 +02:00
* Added test for source-dependencies
* Removed miced-case package-name. Better keep the basic tests simple git-svn-id: trunk@35796 -
This commit is contained in:
parent
4f1755b174
commit
a799d6465b
@ -32,6 +32,7 @@ type
|
|||||||
procedure TestMissingSource;
|
procedure TestMissingSource;
|
||||||
procedure TestBuildWithInstalledDependency;
|
procedure TestBuildWithInstalledDependency;
|
||||||
procedure TestFakePackageDir;
|
procedure TestFakePackageDir;
|
||||||
|
procedure TestSourceDependency;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TFullFPCInstallationSetup }
|
{ TFullFPCInstallationSetup }
|
||||||
@ -328,19 +329,19 @@ begin
|
|||||||
|
|
||||||
// Test installation
|
// Test installation
|
||||||
s := RunFppkgIndir(TFullFPCInstallationSetup.GetCurrentTestPath, ['list'], 'list packages');
|
s := RunFppkgIndir(TFullFPCInstallationSetup.GetCurrentTestPath, ['list'], 'list packages');
|
||||||
Check(pos('PackageA', s) > 0, 'Just installed PackageA is not in package-list');
|
Check(pos('packagea', s) > 0, 'Just installed PackageA is not in package-list');
|
||||||
Check(FileExists(ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestPath,'user','lib','fpc', TFullFPCInstallationSetup.GetCompilerVersion, 'units',TFullFPCInstallationSetup.GetTargetString,'PackageA','PackageAUnitA.ppu'])), 'PackageAUnitA.ppu not found');
|
Check(FileExists(ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestPath,'user','lib','fpc', TFullFPCInstallationSetup.GetCompilerVersion, 'units',TFullFPCInstallationSetup.GetTargetString,'packagea','PackageAUnitA.ppu'])), 'PackageAUnitA.ppu not found');
|
||||||
Check(FileExists(ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestPath,'user','lib','fpc', TFullFPCInstallationSetup.GetCompilerVersion, 'units',TFullFPCInstallationSetup.GetTargetString,'PackageA','PackageAUnitA.o'])), 'PackageAUnitA.o not found');
|
Check(FileExists(ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestPath,'user','lib','fpc', TFullFPCInstallationSetup.GetCompilerVersion, 'units',TFullFPCInstallationSetup.GetTargetString,'packagea','PackageAUnitA.o'])), 'PackageAUnitA.o not found');
|
||||||
Check(FileExists(ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestPath,'user','lib','fpc', TFullFPCInstallationSetup.GetCompilerVersion, 'fpmkinst',TFullFPCInstallationSetup.GetTargetString,'PackageA.fpm'])), 'PackageAUnitA.fpm not found');
|
Check(FileExists(ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestPath,'user','lib','fpc', TFullFPCInstallationSetup.GetCompilerVersion, 'fpmkinst',TFullFPCInstallationSetup.GetTargetString,'packagea.fpm'])), 'PackageAUnitA.fpm not found');
|
||||||
|
|
||||||
// uninstall package
|
// uninstall package
|
||||||
RunFppkgIndir(TFullFPCInstallationSetup.GetCurrentTestBasePackagesPath + 'packagea', ['uninstall'], 'install PackageA');
|
RunFppkgIndir(TFullFPCInstallationSetup.GetCurrentTestBasePackagesPath + 'packagea', ['uninstall'], 'install PackageA');
|
||||||
|
|
||||||
// check uninstallation
|
// check uninstallation
|
||||||
s := RunFppkgIndir(TFullFPCInstallationSetup.GetCurrentTestPath, ['list'], 'list packages');
|
s := RunFppkgIndir(TFullFPCInstallationSetup.GetCurrentTestPath, ['list'], 'list packages');
|
||||||
Check(pos('PackageA', s) = 0, 'Just de-installed PackageA is still in package-list');
|
Check(pos('packagea', s) = 0, 'Just de-installed PackageA is still in package-list');
|
||||||
CheckFalse(DirectoryExists(ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestPath,'user','lib','fpc', TFullFPCInstallationSetup.GetCompilerVersion, 'units',TFullFPCInstallationSetup.GetTargetString,'PackageA'])), 'PackageAUnitA-directory found after uninstall');
|
CheckFalse(DirectoryExists(ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestPath,'user','lib','fpc', TFullFPCInstallationSetup.GetCompilerVersion, 'units',TFullFPCInstallationSetup.GetTargetString,'packagea'])), 'PackageAUnitA-directory found after uninstall');
|
||||||
CheckFalse(FileExists(ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestPath,'user','lib','fpc', TFullFPCInstallationSetup.GetCompilerVersion, 'fpmkinst',TFullFPCInstallationSetup.GetTargetString,'PackageA.fpm'])), 'PackageAUnitA.fpm found after uninstall');
|
CheckFalse(FileExists(ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestPath,'user','lib','fpc', TFullFPCInstallationSetup.GetCompilerVersion, 'fpmkinst',TFullFPCInstallationSetup.GetTargetString,'packagea.fpm'])), 'PackageAUnitA.fpm found after uninstall');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFullFPCInstallationTests.TestLooseFPMFile;
|
procedure TFullFPCInstallationTests.TestLooseFPMFile;
|
||||||
@ -366,12 +367,12 @@ begin
|
|||||||
RunFppkgIndir(TFullFPCInstallationSetup.GetCurrentTestBasePackagesPath + 'packagea', ['install'], 'install PackageA');
|
RunFppkgIndir(TFullFPCInstallationSetup.GetCurrentTestBasePackagesPath + 'packagea', ['install'], 'install PackageA');
|
||||||
|
|
||||||
// Destroy the installation
|
// Destroy the installation
|
||||||
DeleteFile(ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestPath,'user','lib','fpc', TFullFPCInstallationSetup.GetCompilerVersion, 'units',TFullFPCInstallationSetup.GetTargetString,'PackageA','PackageAUnitA.ppu']));
|
DeleteFile(ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestPath,'user','lib','fpc', TFullFPCInstallationSetup.GetCompilerVersion, 'units',TFullFPCInstallationSetup.GetTargetString,'packagea','PackageAUnitA.ppu']));
|
||||||
|
|
||||||
// Re-install
|
// Re-install
|
||||||
RunFppkgIndir(TFullFPCInstallationSetup.GetTestPath, ['install', 'packagea'], 're-install PackageA');
|
RunFppkgIndir(TFullFPCInstallationSetup.GetTestPath, ['install', 'packagea'], 're-install PackageA');
|
||||||
|
|
||||||
Check(FileExists(ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestPath,'user','lib','fpc', TFullFPCInstallationSetup.GetCompilerVersion, 'units',TFullFPCInstallationSetup.GetTargetString,'PackageA','PackageAUnitA.ppu'])), 'PackageAUnitA.ppu not found after re-install');
|
Check(FileExists(ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestPath,'user','lib','fpc', TFullFPCInstallationSetup.GetCompilerVersion, 'units',TFullFPCInstallationSetup.GetTargetString,'packagea','PackageAUnitA.ppu'])), 'PackageAUnitA.ppu not found after re-install');
|
||||||
|
|
||||||
// Remove the original sources
|
// Remove the original sources
|
||||||
DeleteDirectory(TFullFPCInstallationSetup.GetCurrentTestBasePackagesPath + 'packagea', False);
|
DeleteDirectory(TFullFPCInstallationSetup.GetCurrentTestBasePackagesPath + 'packagea', False);
|
||||||
@ -392,9 +393,9 @@ begin
|
|||||||
|
|
||||||
// Test installation
|
// Test installation
|
||||||
s := RunFppkgIndir(TFullFPCInstallationSetup.GetCurrentTestPath, ['list'], 'list packages');
|
s := RunFppkgIndir(TFullFPCInstallationSetup.GetCurrentTestPath, ['list'], 'list packages');
|
||||||
Check(pos('PackageA', s) > 0, 'Just installed PackageA is not in package-list');
|
Check(pos('packagea', s) > 0, 'Just installed PackageA is not in package-list');
|
||||||
Check(pos('PackageB', s) > 0, 'Just installed PackageB is not in package-list');
|
Check(pos('PackageB', s) > 0, 'Just installed PackageB is not in package-list');
|
||||||
Check(FileExists(ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestPath,'user','lib','fpc', TFullFPCInstallationSetup.GetCompilerVersion, 'units',TFullFPCInstallationSetup.GetTargetString,'PackageA','PackageAUnitA.ppu'])), 'PackageAUnitA.ppu not found');
|
Check(FileExists(ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestPath,'user','lib','fpc', TFullFPCInstallationSetup.GetCompilerVersion, 'units',TFullFPCInstallationSetup.GetTargetString,'packagea','PackageAUnitA.ppu'])), 'PackageAUnitA.ppu not found');
|
||||||
Check(FileExists(ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestPath,'user','lib','fpc', TFullFPCInstallationSetup.GetCompilerVersion, 'units',TFullFPCInstallationSetup.GetTargetString,'PackageB','PackageBUnitB.ppu'])), 'PackageBUnitB.ppu not found');
|
Check(FileExists(ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestPath,'user','lib','fpc', TFullFPCInstallationSetup.GetCompilerVersion, 'units',TFullFPCInstallationSetup.GetTargetString,'PackageB','PackageBUnitB.ppu'])), 'PackageBUnitB.ppu not found');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -413,12 +414,36 @@ begin
|
|||||||
|
|
||||||
// Test installation
|
// Test installation
|
||||||
s := RunFppkgIndir(TFullFPCInstallationSetup.GetCurrentTestPath, ['list'], 'list packages');
|
s := RunFppkgIndir(TFullFPCInstallationSetup.GetCurrentTestPath, ['list'], 'list packages');
|
||||||
Check(pos('PackageA', s) > 0, 'Just installed PackageA is not in package-list');
|
Check(pos('packagea', s) > 0, 'Just installed PackageA is not in package-list');
|
||||||
Check(pos('PackageB', s) > 0, 'Just installed PackageB is not in package-list');
|
Check(pos('PackageB', s) > 0, 'Just installed PackageB is not in package-list');
|
||||||
Check(FileExists(ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestPath,'lib','fpc', TFullFPCInstallationSetup.GetCompilerVersion, 'units',TFullFPCInstallationSetup.GetTargetString,'PackageA','PackageAUnitA.ppu'])), 'PackageAUnitA.ppu not found');
|
Check(FileExists(ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestPath,'lib','fpc', TFullFPCInstallationSetup.GetCompilerVersion, 'units',TFullFPCInstallationSetup.GetTargetString,'packagea','PackageAUnitA.ppu'])), 'PackageAUnitA.ppu not found');
|
||||||
Check(FileExists(ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestPath,'user','lib','fpc', TFullFPCInstallationSetup.GetCompilerVersion, 'units',TFullFPCInstallationSetup.GetTargetString,'PackageB','PackageBUnitB.ppu'])), 'PackageBUnitB.ppu not found');
|
Check(FileExists(ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestPath,'user','lib','fpc', TFullFPCInstallationSetup.GetCompilerVersion, 'units',TFullFPCInstallationSetup.GetTargetString,'PackageB','PackageBUnitB.ppu'])), 'PackageBUnitB.ppu not found');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TFullFPCInstallationTests.TestSourceDependency;
|
||||||
|
var
|
||||||
|
CompilerStr,
|
||||||
|
FpcSearchpath,
|
||||||
|
PackageSearchpath: string;
|
||||||
|
begin
|
||||||
|
// This is to test if fpmkunit works correctly when a dependency is available
|
||||||
|
// not as an installed but as a (compiled) source-package. This happens for
|
||||||
|
// example if you try to compile _one_ fpmake-packages in fpcsrc/packages,
|
||||||
|
// using 'make clean all' and it needs one of the other packages in
|
||||||
|
// fpcsrc/packages.
|
||||||
|
TFullFPCInstallationSetup.SyncPackageIntoCurrentTest('packagea');
|
||||||
|
TFullFPCInstallationSetup.SyncPackageIntoCurrentTest('packageb');
|
||||||
|
|
||||||
|
RunFppkgIndir(TFullFPCInstallationSetup.GetCurrentTestBasePackagesPath + 'packagea', ['build'], 'build PackageA');
|
||||||
|
|
||||||
|
CompilerStr := ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestPath, 'bin', 'fpc']);
|
||||||
|
FpcSearchpath := ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestPath, 'lib', 'fpc', TFullFPCInstallationSetup.GetCompilerVersion]);
|
||||||
|
PackageSearchpath := TFullFPCInstallationSetup.GetCurrentTestBasePackagesPath;
|
||||||
|
|
||||||
|
RunFppkgIndir(TFullFPCInstallationSetup.GetCurrentTestBasePackagesPath + 'packageb', ['build'], 'create fpmake-executable', 1);
|
||||||
|
RunTestCommandIndir(ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestBasePackagesPath,'packageb']), ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestBasePackagesPath,'packageb', 'fpmake']), ['build', '--nofpccfg', '--compiler='+CompilerStr, '--searchpath='+FpcSearchpath, '--searchpath='+PackageSearchpath], 'build packagea');
|
||||||
|
end;
|
||||||
|
|
||||||
Initialization
|
Initialization
|
||||||
RegisterTestDecorator(TFullFPCInstallationSetup, TFullFPCInstallationTests);
|
RegisterTestDecorator(TFullFPCInstallationSetup, TFullFPCInstallationTests);
|
||||||
end.
|
end.
|
||||||
|
@ -9,7 +9,7 @@ Var
|
|||||||
begin
|
begin
|
||||||
With Installer do
|
With Installer do
|
||||||
begin
|
begin
|
||||||
P:=AddPackage('PackageA');
|
P:=AddPackage('packagea');
|
||||||
P.Version:='1.2.3';
|
P.Version:='1.2.3';
|
||||||
|
|
||||||
P.Author := 'Joost vam der Sluis';
|
P.Author := 'Joost vam der Sluis';
|
||||||
|
@ -18,7 +18,7 @@ begin
|
|||||||
P.Email := '';
|
P.Email := '';
|
||||||
P.Description := 'Basic test-package that depends on PackageA';
|
P.Description := 'Basic test-package that depends on PackageA';
|
||||||
|
|
||||||
P.Dependencies.Add('PackageA');
|
P.Dependencies.Add('packagea');
|
||||||
|
|
||||||
P.SourcePath.Add('src');
|
P.SourcePath.Add('src');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user