mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-10 10:28:21 +02:00
tools: snapshots monitor: use masks unit to match file names, it supports ????? like masks too.
git-svn-id: trunk@14929 -
This commit is contained in:
parent
8a7e588df6
commit
9b8fd9c590
@ -2,7 +2,7 @@
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="5"/>
|
||||
<Version Value="6"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
|
@ -51,7 +51,7 @@ begin
|
||||
FtpFile := TFtpFile.Create(FtpLine);
|
||||
try
|
||||
AssertEquals('Wrong file name:', 'Lazarus-0.9.19-fpc-2.0.4-20061022-win32.exe', FtpFile.FileName);
|
||||
AssertEquals('Wrong file date', '22-10-2007 14:34:00', DateTimeToStr(FtpFile.FileDate));
|
||||
AssertEquals('Wrong file date', '22-10-2008 14:34:00', DateTimeToStr(FtpFile.FileDate));
|
||||
finally
|
||||
FtpFile.Free;
|
||||
end;
|
||||
|
@ -17,16 +17,32 @@
|
||||
/>
|
||||
<File
|
||||
Mask="Lazarus-$LAZVER-fpc-$FPCRELEASEVER-*-win32.exe"
|
||||
Description="Lazarus win32 with fpc fixes branch ($FPCRELEASEVER)"
|
||||
Description="Lazarus win32 with fpc release ($FPCRELEASEVER)"
|
||||
/>
|
||||
<File
|
||||
Mask="Lazarus-$LAZVER-fpc-$FPCFIXESVER-*-win32.exe"
|
||||
Mask="Lazarus-$LAZVER-fpc-$FPCFIXESVER-????????-win32.exe"
|
||||
Description="Lazarus win32 with fpc fixes branch ($FPCFIXESVER)"
|
||||
/>
|
||||
<File
|
||||
Mask="Lazarus-$LAZVER-fpc-$FPCFIXESVER-????????-cross-arm-wince-win32.exe"
|
||||
Description="Lazarus win32 cross arm-wince with fpc fixes branch ($FPCFIXESVER)"
|
||||
/>
|
||||
<File
|
||||
Mask="Lazarus-$LAZVER-fpc-$FPCDEVELVER-????????-win32.exe"
|
||||
Description="Lazarus win32 with fpc development branch ($FPCDEVELVER)"
|
||||
/>
|
||||
<File
|
||||
Mask="Lazarus-$LAZVER-fpc-$FPCRELEASEVER-*-win64.exe"
|
||||
Description="Lazarus win64 with fpc release ($FPCRELEASEVER)"
|
||||
/>
|
||||
<File
|
||||
Mask="Lazarus-$LAZVER-fpc-$FPCFIXESVER-*-win64.exe"
|
||||
Description="Lazarus win64 with fpc fixes branch ($FPCFIXESVER)"
|
||||
/>
|
||||
<File
|
||||
Mask="Lazarus-$LAZVER-fpc-$FPCDEVELVER-*-win64.exe"
|
||||
Description="Lazarus win64 with fpc fixes branch ($FPCDEVELVER)"
|
||||
/>
|
||||
<File
|
||||
Mask="fpc-$FPCRELEASEVER-*-powerpc-macosx.dmg"
|
||||
Description="fpc $FPCRELEASEVER Mac OS X powerpc"
|
||||
@ -40,12 +56,12 @@
|
||||
Description="lazarus Mac OS X powerpc"
|
||||
/>
|
||||
<File
|
||||
Mask="fpc-$FPCFIXESVER-*-i386-macosx.dmg"
|
||||
Description="fpc $FPCFIXESVER Mac OS X i386"
|
||||
Mask="fpc-$FPCRELEASEVER-*-i386-macosx.dmg"
|
||||
Description="fpc $FPCRELEASEVER Mac OS X i386"
|
||||
/>
|
||||
<File
|
||||
Mask="fpcsrc-$FPCFIXESVER-*-i386-macosx.dmg"
|
||||
Description="fpc source $FPCFIXESVER Mac OS X i386"
|
||||
Mask="fpcsrc-$FPCRELEASEVER-*-i386-macosx.dmg"
|
||||
Description="fpc source $FPCRELEASEVER Mac OS X i386"
|
||||
/>
|
||||
<File
|
||||
Mask="lazarus-$LAZVER-*-i386-macosx.dmg"
|
||||
|
@ -22,7 +22,7 @@ type
|
||||
property MatchingFiles: TStrings read GetMatchingFiles;
|
||||
public
|
||||
class function FileMaskSuite(const AName, AFileMask: string): TTestSuite;
|
||||
constructor Create(const AName, AFileMask, ATestName: string);
|
||||
constructor Create(const AName, AFileMask, ATestName: string); reintroduce;
|
||||
destructor Destroy; override;
|
||||
published
|
||||
procedure TestHookUp;
|
||||
@ -33,7 +33,7 @@ type
|
||||
implementation
|
||||
|
||||
uses
|
||||
monitorcfg;
|
||||
monitorcfg, masks;
|
||||
|
||||
var
|
||||
FileList: TStrings;
|
||||
@ -53,25 +53,19 @@ end;
|
||||
function TFtpMonitorTestcase.GetMatchingFiles: TStrings;
|
||||
var
|
||||
i: integer;
|
||||
starpos: integer;
|
||||
FirstPart, LastPart: string;
|
||||
FtpFile : TFtpFile;
|
||||
FileMask: TMask;
|
||||
FtpFile: TFtpFile;
|
||||
begin
|
||||
if not assigned(FMatchingFiles) then begin
|
||||
starpos := pos('*', FFileMask);
|
||||
if starpos=0 then
|
||||
Fail('Invalid Filemask: '+ FFileMask);
|
||||
FirstPart := Copy(FFileMask, 1, starpos-1);
|
||||
LastPart := Copy(FFileMask, starpos + 1, Length(FFileMask)-starpos);
|
||||
FileMask := TMask.Create(FFileMask);
|
||||
FMatchingFiles := TStringList.Create;
|
||||
for i := 0 to Files.Count-1 do begin
|
||||
for i := 0 to Files.Count-1 do
|
||||
begin
|
||||
FtpFile := TFtpFile.Create(Files[i]);
|
||||
if (copy(FtpFile.FileName, 1, starpos-1)=FirstPart)
|
||||
and (copy(FtpFile.FileName, Length(FtpFile.FileName)-Length(LastPart)+1, Length(LastPart))=LastPart) then
|
||||
FMatchingFiles.AddObject(FtpFile.FileName, FtpFile)
|
||||
else
|
||||
FtpFile.Free;
|
||||
if FileMask.Matches(FtpFile.FileName) then
|
||||
FMatchingFiles.AddObject(FtpFile.FileName, FtpFile);
|
||||
end;
|
||||
FileMask.Free;
|
||||
end;
|
||||
Result := FMatchingFiles;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user