UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    MirOil-for-Lomiri

    Scheduled Pinned Locked Moved Lomiri (was Unity8)
    13 Posts 2 Posters 2.5k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      This topic has been deleted. Only users with topic management privileges can see it.
      • E Offline
        erlend @alan_g
        last edited by

        Okey... Shall I wait until you have updated it to 20.04? or can I start now?
        What do you think?

        Github id is: 58894514 (erlend-g)

        alan_gA 1 Reply Last reply Reply Quote 0
        • alan_gA Offline
          alan_g @erlend
          last edited by

          @erlend don't wait for me.

          E 1 Reply Last reply Reply Quote 0
          • E Offline
            erlend @alan_g
            last edited by

            @alan_g Okey

            1 Reply Last reply Reply Quote 0
            • E Offline
              erlend
              last edited by

              Hi!

              I still haven't got write permission to qtmir... Need it to create a branch... I tried forking the project but that does not work since i have already forked ubports/qtmir. I can't fork it more that once.

              Can you fix that?

              alan_gA 1 Reply Last reply Reply Quote 0
              • alan_gA Offline
                alan_g @erlend
                last edited by

                @erlend said in MirOil-for-Lomiri:

                I still haven't got write permission to qtmir

                Try now

                E 1 Reply Last reply Reply Quote 0
                • E Offline
                  erlend @alan_g
                  last edited by

                  @alan_g Yes,Works.. Thank You!

                  1 Reply Last reply Reply Quote 0
                  • E Offline
                    erlend
                    last edited by

                    I'm trying to find a good way to solve qtmir tests. For the test to work they need a lot of mocks that are based on internal mir stuff. And since they are used directly into mir it is not possible to build wrappers.

                    Include file Object test file Defined in
                    mir/main_loop.h mir::MainLoop tests/framework/mock_main_loop.h src/include/server/mir/main_loop.h
                    mir/scene/prompt_session.h mir::scene::PromptSession tests/framework/mock_prompt_session.h src/include/server/mir/scene/prompt_session.h
                    mir/scene/surface.h> mir::scene::Surface tests/framework/mock_surface.h src/include/server/mir/scene/surface.h
                    mir/shell/persistent_surface_store.h mir::shell::PersistentSurfaceStore tests/framework/mock_persistent_surface_store.h src/include/server/mir/shell/persistent_surface_store.h
                    mir/scene/session.h mir::scene::Session tests/framework/mock_mir_session.h src/include/server/mir/scene/session.h

                    So the best solution (or least bad) that I have come up with is...
                    to move all those mocks to miroil and make them accessible through a MockFactory... Something like:

                    class MockFactory
                    {
                        auto get_mock_surface()                  -> std::shared_ptr<mir::scene::Surface>;
                        auto get_mock_main_loop()                -> std::shared_ptr<mir::MainLoop>;
                        auto get_mock_prompt_session()           -> std::shared_ptr<mir::scene::PromptSession>;
                        auto get_mock_persistent_surface_store() -> std::shared_ptr<mir::shell::PersistentSurfaceStore>;
                        auto get_mock_session()                  -> std::shared_ptr<mir::scene::Session>;    
                        
                        std::shared_ptr<mir::scene::Surface>                   surfaces;
                        std::shared_ptr<mir::MainLoop>                         main_loops;
                        std::shared_ptr<mir::scene::PromptSession>             prompt_sessions;
                        std::shared_ptr<mir::shell::PersistentSurfaceStore>    persistent_surface_stores;
                        std::shared_ptr<mir::scene::Session>                   sessions;       
                    };
                    

                    The problem is that qtmir does not know the destructor of this objects, to they will have to be deleted inside miroil.
                    Therefore I have added a reference in MockFactor to the objects. Which are deleted by MockFactory. This will only work if MockFactory is the last object to be deleted, so we have to make sure it is.

                    So do you guys see any better solutions than this?

                    alan_gA 1 Reply Last reply Reply Quote 2
                    • alan_gA Offline
                      alan_g @erlend
                      last edited by

                      @erlend thanks for bringing this up.

                      I don't have the headspace right now to look at the problematic tests. But, for background, Mir used to publish a test helpers library containing various stubs, mocked objects and test fixtures. That got unpublished along with the mirclient stuff that it depended heavily on. (It is on my "tech debt" list to reinstate something appropriate to the current APIs.)

                      I think a separate "testing support" library is a better place to support mocks than libmiroil.

                      Another possibility would be that at least some of these tests belong as tests of miroil (i.e. in the Mir project).

                      I will have a closer look, but not sure when I'll have time.

                      E 1 Reply Last reply Reply Quote 1
                      • E Offline
                        erlend @alan_g
                        last edited by

                        @alan_g Okey good, I'll start by upstream what is left, and then return to the test after that.

                        alan_gA 1 Reply Last reply Reply Quote 0
                        • alan_gA Offline
                          alan_g @erlend
                          last edited by

                          @erlend I've had a first look, and three of those test doubles are unused in the current codebase. There's a PR dropping them for your review.

                          The others are used in a range of tests I've yet to work through.

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post