mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-14 14:59:32 +02:00
+ test for #39873
This commit is contained in:
parent
7bcefd287d
commit
0440749562
47
tests/webtbs/tw39873.pp
Normal file
47
tests/webtbs/tw39873.pp
Normal file
@ -0,0 +1,47 @@
|
||||
{ %TARGET=darwin }
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
{$packrecords c}
|
||||
|
||||
uses
|
||||
Classes, SysUtils, UnixType;
|
||||
|
||||
|
||||
{$IF DEFINED(DARWIN)}
|
||||
function getfsstat(buf: pstatfs; bufsize: cint; flags: cint): cint; cdecl; external 'c' name 'getfsstat';
|
||||
{$ELSE}
|
||||
function getfsstat(struct_statfs: PStatFS; const buffsize: int64; const int_flags: integer): integer;
|
||||
{$ENDIF}
|
||||
|
||||
const
|
||||
MAX_FS = 128;
|
||||
MNT_WAIT = 1; // synchronously wait for I/O to complete
|
||||
MNT_NOWAIT = 2; // start all I/O, but do not wait for it
|
||||
MNT_LAZY = 3; // push data not written by filesystem syncer
|
||||
MNT_SUSPEND = 4; // suspend file system after sync
|
||||
|
||||
procedure AssertTrue(const s : string;b : boolean);
|
||||
begin
|
||||
if not(b) then
|
||||
begin
|
||||
writeln(s);
|
||||
halt(1);
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
fs: tstatfs;
|
||||
fsList: array[0..MAX_FS] of tstatfs;
|
||||
count: integer;
|
||||
i: integer;
|
||||
begin
|
||||
count := getfsstat( @fsList, SizeOf(fsList), MNT_WAIT );
|
||||
for i := 0 to count - 1 do
|
||||
begin
|
||||
fs := fsList[i];
|
||||
AssertTrue( 'tstatfs.fstypename error' , fs.fstypename[0] <> char(0) );
|
||||
AssertTrue( 'tstatfs.mountpoint error' , fs.mountpoint[0] <> char(0) );
|
||||
AssertTrue( 'tstatfs.mntfromname error' , fs.mntfromname[0] <> char(0) );
|
||||
WriteLn( IntToStr(i) + ':' + fs.fstypename + ''#9'' + fs.mountpoint + ''#9'' + fs.mntfromname );
|
||||
end;
|
||||
end.
|
Loading…
Reference in New Issue
Block a user