Test suite results for test file test/units/dos/tfattr.pp

Test run data :

Free Pascal Compiler Test Suite Results

View Test suite results

Please specify search criteria:
File:
Operating system:
Processor:
Version
Date
Submitter
Machine
Comment
Limit
Cond
Category
Only failed tests
Hide skipped tests
List all tests

Test file "test/units/dos/tfattr.pp" information:

t_id 252
t_adddate 2003/10/03
t_result 0
t_knownrunerror 0

Detailed test run results:

Record count: 50

Total = 50

OK=47 Percentage= 94.00

Result type Cat. Count Percentage First date Last Date
Failed to run 3 6.0 2024/10/19 09:39:00 55 2024/10/19 11:13:00 63
i386 3 100.0 2024/10/19 09:39:00 55 2024/10/19 11:13:00 63
go32v2 3 100.0 2024/10/19 09:39:00 55 2024/10/19 11:13:00 63
3.3.1 3 100.0 2024/10/19 09:39:00 55 2024/10/19 11:13:00 63
Successfully run 47 94.0 2024/10/19 08:05:00 45 2024/10/19 13:36:00 24
i386 1 2.1 2024/10/19 09:40:00 209 2024/10/19 09:40:00 209
m68k 2 4.3 2024/10/19 09:50:00 39 2024/10/19 10:22:00 40
sparc 4 8.5 2024/10/19 08:05:00 45 2024/10/19 11:16:00 40
powerpc 7 14.9 2024/10/19 08:40:00 51 2024/10/19 13:26:00 65
arm 1 2.1 2024/10/19 10:03:00 32 2024/10/19 10:03:00 32
x86_64 10 21.3 2024/10/19 08:27:00 30 2024/10/19 13:36:00 24
powerpc64 8 17.0 2024/10/19 10:06:00 62 2024/10/19 11:23:00 69
mips 2 4.3 2024/10/19 09:54:00 35 2024/10/19 10:28:00 38
mipsel 2 4.3 2024/10/19 09:59:00 38 2024/10/19 10:35:00 142
aarch64 4 8.5 2024/10/19 08:15:00 27 2024/10/19 09:57:00 26
sparc64 2 4.3 2024/10/19 09:25:00 118 2024/10/19 10:46:00 141
riscv64 2 4.3 2024/10/19 10:25:00 33 2024/10/19 11:10:00 26
loongarch64 2 4.3 2024/10/19 09:45:00 25 2024/10/19 10:17:00 30
linux 31 66.0 2024/10/19 08:05:00 45 2024/10/19 11:16:00 40
solaris 7 14.9 2024/10/19 13:22:00 24 2024/10/19 13:36:00 24
aix 9 19.1 2024/10/19 08:40:00 51 2024/10/19 13:26:00 65
3.3.1 29 61.7 2024/10/19 08:05:00 45 2024/10/19 13:26:00 65
3.2.3 18 38.3 2024/10/19 08:15:00 27 2024/10/19 13:36:00 24

Source:

{******************************************}
{  Used to check the DOS unit              }
{------------------------------------------}
{  SetFAttr / GetFAttr testing             }
{******************************************}
Program tfattr;

uses dos;

{$IFDEF MSDOS}
        {$DEFINE EXTATTR}
{$ENDIF}
{$IFDEF DPMI}
        {$DEFINE EXTATTR}
{$ENDIF}
{$IFDEF GO32V1}
        {$DEFINE EXTATTR}
{$ENDIF}
{$IFDEF GO32V2}
        {$DEFINE EXTATTR}
{$ENDIF}
{$IFDEF OS2}
        {$DEFINE EXTATTR}
{$ENDIF}
{$IFDEF WIN32}
        {$DEFINE EXTATTR}
{$ENDIF}
{$IFDEF ATARI}
        {$DEFINE EXTATTR}
{$ENDIF}


CONST
{ what is the root path }
{$IFDEF EXTATTR}
  RootPath = 'C:';
{$ENDIF}
{$IFDEF UNIX}
  RootPath = '/';
{$ENDIF}
 Week:Array[0..6] of String =
 ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');

 TestFName = 'TESTDOS.DAT';  { CASE SENSITIVE DON'T TOUCH! }
 TestFName1 = 'TESTFILE';    { CASE SENSITIVE DON'T TOUCH! }
 TestDir = 'MYDIR';          { CASE SENSITIVE DON'T TOUCH! }
 TestExt   = 'DAT';
{$IFDEF TP}
  DirectorySeparator = '';
{$ENDIF}
  has_errors : boolean = false;


{ verifies that the DOSError variable is equal to }
{ the value requested.                            }
Procedure CheckDosError(err: Integer);
 var
  x : integer;
  s :string;
 Begin
  x := DosError;
  case x of
  0 : s := '(0): No Error.';
  2 : s := '(2): File not found.';
  3 : s := '(3): Path not found.';
  5 : s := '(5): Access Denied.';
  6 : s := '(6): Invalid File Handle.';
  8 : s := '(8): Not enough memory.';
  10 : s := '(10) : Invalid Environment.';
  11 : s := '(11) : Invalid format.';
  18 : s := '(18) : No more files.';
  else
    s := 'INVALID DOSERROR';
  end;
  if err <> x then
    Begin
      WriteLn('FAILURE. (Value of DOSError should be ',err,' '+s+')');
      has_errors:=true;
    end;
 end;

procedure fail;
Begin
  WriteLn('Failed!');
  has_errors:=true;
End;

Procedure TestFAttr1;
Var
 F: File;
 Attr: Word;
 s: string;
Begin
 WriteLn('Opening an invalid file...Success!');
 Assign(f,'');
 GetFAttr(f,Attr);
 CheckDosError(3);
 Assign(f,TestFName);
 WriteLn('Trying to open a valid file...Success!');
 GetFAttr(f,Attr);
 CheckDosError(0);
 Write('Trying to open the current directory file...');
 Assign(f,'.');
 GetFAttr(f,Attr);
 if (attr and Directory) = 0 then
   fail
 else
   WriteLn('Success!');
 CheckDosError(0);
 Write('Trying to open the parent directory file...');
 Assign(f,'..');
 GetFAttr(f,Attr);
 if (attr and Directory) = 0 then
   fail
 else
   WriteLn('Success!');
 CheckDosError(0);
{ This is completely platform dependent
 Write('Trying to open the parent directory file when in root...');
 Getdir(0,s);
 ChDir(RootPath);
 Assign(f,'..');
 GetFAttr(f,Attr);
 ChDir(s);
 CheckDosError(3);
 WriteLn('Success!');
}
{$ifdef go32v2}
 { Should normally fail, because of end directory separator. This is
   allowed under unixes so the test is go32v2 only }
 WriteLn('Trying to open a directory file...Success!');
 GetDir(0,s);
 Assign(f,s+DirectorySeparator);
 GetFAttr(f, Attr);
 CheckDosError(3);
{$endif}

 Write('Trying to open a directory file...');
 GetDir(0,s);
 Assign(f,s);
 GetFAttr(f, Attr);
 if (attr and Directory) = 0 then
   fail
 else
   WriteLn('Success!');
 CheckDosError(0);
end;

Procedure TestFAttr;
Var
 F: File;
 Attr: Word;
 s: string;
Begin
 Assign(f, TestFname);
 {----------------------------------------------------------------}
 { This routine causes problems, because it all depends on the    }
 { operating system. It is assumed here that HIDDEN is available  }
 { to all operating systems.                                      }
 {----------------------------------------------------------------}
 s:='Setting read-only attribute on '+TestFName+'...';
 SetFAttr(f,ReadOnly);
 CheckDosError(0);
{$IFDEF EXTATTR}
 GetFAttr(f,Attr);
 CheckDosError(0);
 if Attr and ReadOnly<> 0 then
   WriteLn(s+'Success.')
 else
  Begin
    WriteLn(s+'FAILURE. Read-only attribute not set.');
    has_errors:=true;
  end;
 { file should no longer be read only }
 s:='Removing read-only attribute...';
 SetFAttr(f,Archive);
 CheckDosError(0);
 GetFAttr(f,Attr);
 CheckDosError(0);
 if Attr and ReadOnly<> 0 then
  Begin
    WriteLn(s+'FAILURE. Read-only attribute still set.');
    has_errors:=true;
  end
 else
   WriteLn(s+'Success.');
{$ENDIF}

 s:='Setting hidden attribute on '+TestFName+'...';
 SetFAttr(f,Hidden);
 CheckDosError(0);
{$IFDEF EXTATTR}
 GetFAttr(f,Attr);
 CheckDosError(0);
 if Attr and Hidden<> 0 then
   WriteLn(s+'Success.')
 else
  Begin
    WriteLn(s+'FAILURE. Hidden attribute not set.');
    has_errors:=true;
  end;

 { file should no longer be read only }
 s:='Removing hidden attribute...';
 SetFAttr(f,Archive);
 CheckDosError(0);
 GetFAttr(f,Attr);
 CheckDosError(0);
 if Attr and Hidden<> 0 then
  Begin
    WriteLn(s+'FAILURE. Hidden attribute still set.');
    has_errors:=true;
  end
 else
   WriteLn(s+'Success.');
{$ENDIF}

{$IFDEF EXTATTR}

 s:='Setting system attribute on '+TestFName+'...';
 SetFAttr(f,SysFile);
 CheckDosError(0);
 GetFAttr(f,Attr);
 CheckDosError(0);
 if Attr and SysFile<> 0 then
   WriteLn(s+'Success.')
 else
  Begin
    WriteLn(s+'FAILURE. SysFile attribute not set.');
    has_errors:=true;
  end;
 { file should no longer be read only }
 s:='Removing Sysfile attribute...';
 SetFAttr(f,0);
 CheckDosError(0);
 GetFAttr(f,Attr);
 CheckDosError(0);
 if Attr and Sysfile<> 0 then
  Begin
    WriteLn(s+'FAILURE. SysFile attribute still set.');
    has_errors:=true;
  end
 else
   WriteLn(s+'Success.');
{$ENDIF}
{
 s:='Setting Directory attribute on '+TestFName+'...';
 SetFAttr(f,Directory);
 CheckDosError(5);
 GetFAttr(f,Attr);
 CheckDosError(0);
 if Attr and Directory<> 0 then
  Begin
    WriteLn(s+'FAILURE. Directory Attribute set.');
    has_errors:=true;
  end
 else
   WriteLn(s+'Success.');
}
 {**********************************************************************}
 {********************** TURBO PASCAL BUG ******************************}
 { The File is not a volume name, and DosError = 0, which is incorrect  }
 { it shoulf not be so in FPC.                                          }
 {**********************************************************************}
 {********************** TURBO PASCAL BUG ******************************}
 s:='Setting Volume attribute on '+TestFName+'...';
 SetFAttr(f,VolumeID);
{$ifndef tp}
 CheckDosError(5);
{$else}
 CheckDosError(0);
{$endif}
 GetFAttr(f,Attr);
 CheckDosError(0);
 if Attr and VolumeID<> 0 then
  Begin
    WriteLn(s+'FAILURE. Volume Attribute set.');
    has_errors:=true;
  end
 else
   WriteLn(s+'Success.');
end;




var
 f: file;
 oldexit : pointer;

  procedure MyExit;far;
   begin
     ExitProc := OldExit;
     RmDir(TestDir);
     Assign(f, TestFname);
     Erase(f);
     Assign(f, TestFname1);
     Erase(f);
   end;


Begin
  WriteLn('File should never be executed in root path!');
  OldExit := ExitProc;
  ExitProc := @MyExit;
  Assign(f,TestFName);
  Rewrite(f,1);
  BlockWrite(f,Week,sizeof(Week));
  Close(f);
  Assign(f,TestFName1);
  Rewrite(f,1);
  Close(F);
  MkDir(TestDir);
  testfattr1;
  testfattr;
  if has_errors then
    halt(1);
end.
{
  $Log: tfattr.pp,v $
  Revision 1.3  2002/12/06 16:48:02  peter
    * Not supporting an ending slash is Dos specific

  Revision 1.2  2002/11/18 09:49:49  pierre
   * tried to make as many as possible tests non interactive

  Revision 1.1  2002/11/08 21:01:18  carl
    * separated some tests
    * make tfexpand more portable

}

Link to SVN view of test/units/dos/tfattr.pp source.