View Issue Details

IDProjectCategoryView StatusLast Update
0029283LazarusIDEpublic2020-10-24 03:09
ReporterJohannes W. Dietrich Assigned ToMattias Gaertner  
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionopen 
PlatformMacintoshOSMac OS X 
Product Version1.6RC1 
Summary0029283: Unit testing fails due to .ini file that cannot be created.
DescriptionAll unit test projects fail directly in the beginning with the error message 'Unable to create file "<project>.fpcunit.ini".'
Steps To ReproduceOccurs at every start of a unit test project.
Tags1.6RC1, 10.11.0, 2.0RC3, Carbon, cocoa, fpcunit, test, unit
Fixed in Revision
LazTarget
WidgetsetCarbon
Attached Files

Relationships

related to 0027629 closedMattias Gaertner [patch] fpcunit GUI Test runner save & restore windows size and position 

Activities

Johannes W. Dietrich

2015-12-29 23:59

reporter  

fpcunit_error_screenshot.png (46,137 bytes)   
fpcunit_error_screenshot.png (46,137 bytes)   

Johannes W. Dietrich

2015-12-30 00:07

reporter   ~0088420

This bug seems to result from the fix that patched the issue 0027629.

Johannes W. Dietrich

2015-12-30 00:27

reporter   ~0088422

The issue can be resolved by modifying of line 327 of file GuiTestRunner.pas (/Developer/lazarus/components/fpcunit/guitestrunner.pas):

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

to be replaced by new form:

 {$IFDEF DARWIN}
 FConfStore := TIniFile.Create(GetUserDir + ExtractFileNameOnly(ParamStr(0)) + '.fpcunit.ini'); // Prevent ini file names conflict if tests are embedded in application
 {$ELSE}
 FConfStore := TIniFile.Create(ExtractFileNameOnly(ParamStr(0)) + '.fpcunit.ini'); // Prevent ini file names conflict if tests are embedded in application
 {$ENDIF}

Johannes W. Dietrich

2019-01-30 20:52

reporter   ~0113743

This problem is still unresolved in Lazarus 2.0RC3. However, the affected line is now 349.

In order to allow for Cocoa development, too, the new patched form should now be:

  {$IFDEF DARWIN}
  FConfStore := TIniFile.Create(GetUserDir + ExtractFileNameOnly(ParamStr(0)) + '.fpcunit.ini');
  {$ELSE}
  FConfStore := TIniFile.Create(GetUserDir + ExtractFileNameOnly(ParamStr(0)) + '.fpcunit.ini');
  {$IFDEF LCLCocoa}
  {$ELSE}
  FConfStore := TIniFile.Create(ExtractFileNameOnly(ParamStr(0)) + '.fpcunit.ini'); // Prevent ini file names conflict if tests are embedded in application
  {$ENDIF}
  {$ENDIF}

Grahame Grieve

2020-10-24 03:05

reporter   ~0126500

The ini path should be using getAppConfigDir()

Trevor Roydhouse

2020-10-24 03:09

reporter   ~0126501

getAppConfigDir() is not Mac appropriate. See https://bugs.freepascal.org/view.php?id=20706

Issue History

Date Modified Username Field Change
2015-12-29 23:59 Johannes W. Dietrich New Issue
2015-12-29 23:59 Johannes W. Dietrich File Added: fpcunit_error_screenshot.png
2015-12-30 00:01 Johannes W. Dietrich Tag Attached: Carbon
2015-12-30 00:01 Johannes W. Dietrich Tag Attached: cocoa
2015-12-30 00:01 Johannes W. Dietrich Tag Attached: fpcunit
2015-12-30 00:01 Johannes W. Dietrich Tag Attached: test
2015-12-30 00:01 Johannes W. Dietrich Tag Attached: unit
2015-12-30 00:01 Johannes W. Dietrich Tag Attached: 1.6RC1
2015-12-30 00:01 Johannes W. Dietrich Tag Attached: 10.11.0
2015-12-30 00:07 Johannes W. Dietrich Note Added: 0088420
2015-12-30 00:27 Johannes W. Dietrich Note Added: 0088422
2015-12-30 10:20 Juha Manninen Relationship added related to 0027629
2015-12-30 10:25 Juha Manninen Assigned To => Mattias Gaertner
2015-12-30 10:25 Juha Manninen Status new => assigned
2019-01-30 20:51 Johannes W. Dietrich Tag Attached: 2.0RC3
2019-01-30 20:52 Johannes W. Dietrich Note Added: 0113743
2020-10-24 03:05 Grahame Grieve Note Added: 0126500
2020-10-24 03:09 Trevor Roydhouse Note Added: 0126501