Search code examples
android-source

How to disable building and running AOSP tests when building with mm?


In Android 13 when I use mm to build a specific module such as packages/apps/Settings the build system is building tests and running robolectric to execute host-side tests along with building the app itself.

I just want to build the module (in this case Settings) without running the tests since that adds considered time to the development process. How do I skip running the robolectric tests when using mm?

Furthermore in the case of Settings using mm also installs an app named SettingsRoboTestStub.apk into the system.img and now the system won't boot due to permissions errors. I have to manually delete SettingsRoboTestStub.apk and rebuild the system.img to get it to boot which is inconvenient so in additional to not running the tests I would also like to not build any tests as well.


Solution

  • The following command disables running the robolectric tests and specifies the particular module in the specified directory to build which avoids building test modules.

    mmm DISABLE_ROBO_RUN_TESTS=true packages/apps/Settings:Settings
    

    I wasn't able to specify an individual module using mm but with mmm it works. This is mentioned when running hmm:

    - mm:         Builds and installs all of the modules in the current directory, and their
                  dependencies.
    - mmm:        Builds and installs all of the modules in the supplied directories, and
                  their dependencies.
                  To limit the modules being built use the syntax: mmm dir/:target1,target2.