Is anyone using DUnitX to run unit tests on Linux?

Is anyone using DUnitX to run unit tests on Linux?
I keep getting an AV (see https://github.com/VSoftTechnologies/DUnitX/issues/201)

DUnit just works.

Comments

  1. I think I can help you on that, from what I remember, you need to decorate a local variable with the Unsafe attribute, and the issue is gone. I will have a lunch and come back with more details :)

    ReplyDelete
  2. Please, try this and see if it works:
    TWeakReference = class(TInterfacedObject, IWeakReference)
    private
    - FData : TObject;
    + [Unsafe] FData : TObject;
    protected
    function IsAlive : boolean;
    function Data : T;

    ReplyDelete
  3. Horácio Filho And now the question on everyones lips... Why does Linux support need that change?

    ReplyDelete
  4. Seems Horácio got himself a twin brother (;

    ReplyDelete
  5. Graeme Geldenhuys Because Linux(Like the Mobile compilers) uses ARC (and not manual MM like Windows&Mac)

    ReplyDelete
  6. Graeme Geldenhuys Not only for Linux but for ARC platforms at all. Using TObject causes ARC to trigger and cause a strong reference to the object behind a weak references interface.
    FWIW I also changed the TObject cast in TWeakReferencedObject.BeforeDestruction - otherwise it refcounted below zero.

    Vincent does not care for those platforms much unfortunately - which is why I keep using DUnit for all tests I have as it just works.

    ReplyDelete
  7. Thanks for the explanation. That all sounds nasty though... Developers having to jump through hoops to make the compiler happy. Fragmenting the Object Pascal language in the process.

    ReplyDelete
  8. Graeme Geldenhuys Developers have to know what they are doing and know about different memory models when doing things like this weakreference implementation for interfaces which is trickery anyway.

    ReplyDelete
  9. Stefan Glienke which is extremely time-intensive to do when there is no ARC available for Windows.

    ReplyDelete
  10. Jeroen Wiert Pluimers That is true, however apart from the shitty debugging experience I found Linux quite useful for testing ARC related things. Just deploy some tests to the Ubuntu VM. If developing FMX applications though thats a different story.

    ReplyDelete
  11. Jeroen Wiert Pluimers I was cloned after having lunch hehehehe :-)

    ReplyDelete
  12. Horácio Filho Looks like the one - I submitted a PR that fixes that issue.

    ReplyDelete

Post a Comment