浏览代码

* ensure that the executable path used in the test is absolute

(cherry picked from commit 8028a769f408d54a475bab50ec467531e547c13f)
florian 3 年之前
父节点
当前提交
92fc7edd7e
共有 1 个文件被更改,包括 9 次插入6 次删除
  1. 9 6
      tests/test/units/sysutils/tfileage.pp

+ 9 - 6
tests/test/units/sysutils/tfileage.pp

@@ -1,18 +1,21 @@
 uses
 uses
   sysutils;
   sysutils;
+var
+  ExecutableName: String;
 begin
 begin
-  if 3600*24*(now()-FileDateToDateTime(FileAge(paramstr(0))))>7200 then
+  ExecutableName:=ExpandFileName(paramstr(0));
+  if 3600*24*(now()-FileDateToDateTime(FileAge(ExecutableName)))>7200 then
     begin
     begin
-      writeln('FileAge returns: ',FileDateToDateTime(FileAge(paramstr(0))));
-      writeln('Compilation time and run time differ too much, SysUtils.FileAge buggy?');
+      writeln('FileAge returns: ',FileDateToDateTime(FileAge(ExecutableName)));
+      writeln('Executable file time and run time differ too much, SysUtils.FileAge buggy?');
       halt(1);
       halt(1);
     end;
     end;
 
 
   { test with relative path }
   { test with relative path }
-  if 3600*24*(now()-FileDateToDateTime(FileAge(ExtractRelativePath(GetCurrentDir+DirectorySeparator,paramstr(0)))))>7200 then
+  if 3600*24*(now()-FileDateToDateTime(FileAge(ExtractRelativePath(GetCurrentDir+DirectorySeparator,ExecutableName))))>7200 then
     begin
     begin
-      writeln('FileAge returns: ',FileDateToDateTime(FileAge(paramstr(0))));
-      writeln('Compilation time and run time differ too much, SysUtils.FileAge buggy?');
+      writeln('FileAge returns: ',FileDateToDateTime(FileAge(ExecutableName)));
+      writeln('Executable file time (relative path) and run time differ too much, SysUtils.FileAge buggy?');
       halt(1);
       halt(1);
     end;
     end;
 end.
 end.