Recent

Author Topic: FPCUnit on MacOS (/Catalina)  (Read 874 times)

Grahame Grieve

  • Full Member
  • ***
  • Posts: 156
FPCUnit on MacOS (/Catalina)
« on: October 16, 2020, 02:15:37 pm »
I run my FPCUnit tests using the GuiTestRunner on OSC, and when I click on go, I get an error:

[Debugger Exception Notification]


[Break]
Project MarkdownTestProgram raised exception class 'EFCreateError' with message:
Unable to create file \"MarkdownTestProgram.fpcunit.ini\": Read-only file system

 At address 1000173E0


[Ignore this exception type]

[Continue]

I'm compiling to the application bundle - I don't seem to have any choice about that? (I can't find any other way that it works).

The problem occurs at this line of code:

  FConfStore := TIniFile.Create(ExtractFileNameOnly(ParamStr(0)) + '.fpcunit.ini'); // Prevent ini file names conflict if tests are embedded in application

in GuiTestRunner. I don't have any control over the ini file, and I don't seem to have any options to make that location writeable (finder says that I have read/write access to the folder, but apparently not in practice.

Has anyone else run into this, and figured out what to do?

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1441
  • Former Delphi 1-7, 10.2 user
Re: FPCUnit on MacOS (/Catalina)
« Reply #1 on: October 20, 2020, 01:42:00 am »
It sounds like you are trying to write to the system volume which is read-only (since Catalina), hence the error "Read-only file system".

Using ParamStr(0) is not advised under any UNIX operating system for a whole host of reasons best summarised in the Multiplatform Programming Guide. That link will also direct you to details on how and where to store your ini file on macOS.
Lazarus 2.1 r65061 FPC 3.3.1 r49223 macOS 10.14.6 Xcode 11.3.1
Lazarus 2.1 r65070 FPC 3.3.1 r49223 macOS 11.2.3 aarch64 Xcode 12.4
Lazarus 2.1 r61574 FPC 3.3.1 r42318 FreeBSD 12.1 amd64 VMware VM
Lazarus 2.1 r61574 FPC 3.0.4 Ubuntu 20.04 Parallels VM
Lazarus 2.0.10 FPC 3.2.0 Win10 Parallels VM

jwdietrich

  • Hero Member
  • *****
  • Posts: 1174
    • formatio reticularis
Re: FPCUnit on MacOS (/Catalina)
« Reply #2 on: October 20, 2020, 07:57:10 am »
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.0.12 | FPC 3.2.0 | PPC, Intel, ARM | macOS, Windows, Linux

Grahame Grieve

  • Full Member
  • ***
  • Posts: 156
Re: FPCUnit on MacOS (/Catalina)
« Reply #3 on: October 24, 2020, 03:04:24 am »
it's not a fixed issue though ;-(

 

TinyPortal © 2005-2018