Skip to content

update readme or add script to check for compilation issues #1106

Closed

Description

@tomholub

@IvanPizhenko

Now just want to see if semaphore passes.

It was compilation issues. To prevent such an issue you can use 2 ways (for both way you have to have at least 1 connected device - an emulator or a real device):

  1. Use Android Studio to just print tests names(Print all tests)
    image

If that task passes there are no compilation issues

  1. Use the following command ./gradlew clean :FlowCrypt:connectedDevTestDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.log=true. If the task fails you will see compilation errors like this
    image

Originally posted by @DenBond7 in #1102 (comment)

Activity

  1. added this to the 1.1.6 milestone on Mar 22, 2021
  2. tomholub commented on Mar 22, 2021

    @tomholub
    CollaboratorAuthor

    I'm pulling this out into an issue - maybe can add ./script/compile.sh or something similar. Either that, or update the readme - this is useful to know.

  3. IvanPizhenko commented on Mar 23, 2021

    @IvanPizhenko
    Contributor

    I'd say test.sh

  4. IvanPizhenko commented on Mar 23, 2021

    @IvanPizhenko
    Contributor

    There's a trouble with running tests inside the cloud Linux VM according to Den's instructions:

    > Task :FlowCrypt:connectedDevTestDebugAndroidTest FAILED
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':FlowCrypt:connectedDevTestDebugAndroidTest'.
    > com.android.builder.testing.api.DeviceException: No connected devices!
    

    I just can't run native x86 Android emulator.

    Unfortunately, your computer does not support hardware accelerated virtualization.
    Here are some of your options:
     1) Use a physical device for testing
     2) Develop on a Windows/OSX computer with an Intel processor that supports VT-x and NX
     3) Develop on a Linux computer that supports VT-x or SVM
     4) Use an Android Virtual Device based on an ARM system image
       (This is 10x slower than hardware accelerated virtualization)
    

    Will try ARM one - looks like the only option.

    The other option is to purchase dedicated physical box for Linux -$500 min for something reasonable (Core i5 Mobile, 16GB, SSD) - did not plan to do that.

  5. IvanPizhenko commented on Mar 23, 2021

    @IvanPizhenko
    Contributor

    But tests run in the CI. How is that possible? Does CI use physical machines?

  6. DenBond7 commented on Mar 23, 2021

    @DenBond7
    Collaborator

    CI supports virtualization. We can run x86 emulators

  7. DenBond7 commented on Mar 23, 2021

    @DenBond7
    Collaborator

    I'd say test.sh

    Actually, you just print all tests. I think it'll be better to call it print-all-tests.sh.

  8. IvanPizhenko commented on Mar 23, 2021

    @IvanPizhenko
    Contributor

    @DenBond7 I've found that there's already a script named run-all-test.sh with a following content:

    ./gradlew --console=verbose :FlowCrypt:connectedDevTestDebugAndroidTest

    Isn't this the same?

    You've added -Pandroid.testInstrumentationRunnerArguments.log=true. What does it mean?
    Maybe just update that script and add this extra option?

  9. IvanPizhenko commented on Mar 23, 2021

    @IvanPizhenko
    Contributor

    Found something about "nested virtualization" - will try to enable it on the VM. But meanwhile trying the ARM image.

  10. IvanPizhenko commented on Mar 23, 2021

    @IvanPizhenko
    Contributor

    Hmm... no luck with ARM either...

    The emulator process for AVD ARM_Nexus_S_API_S was killed.
    

    seems like need to try that "nested virtualization"

  11. DenBond7 commented on Mar 23, 2021

    @DenBond7
    Collaborator

    @IvanPizhenko

    Isn't this the same?

    Almost the same. run-all-test.sh runs all tests. print-all-tests.sh should be just print all tests.

    You've added -Pandroid.testInstrumentationRunnerArguments.log=true. What does it mean?

    From here

    To run in 'log only' mode -e log true This option will load and iterate through all test classes and methods, but will bypass actual test execution. Useful for quickly obtaining info on the tests to be executed by an instrumentation command.

    Maybe just update that script and add this extra option?

    Yes, we can do that.

  12. DenBond7 commented on Mar 23, 2021

    @DenBond7
    Collaborator

    Hmm... no luck with ARM either...

    The emulator process for AVD ARM_Nexus_S_API_S was killed.
    

    seems like need to try that "nested virtualization"

    @IvanPizhenko Please look at this line

    sudo apt-get -qq install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils > /dev/null

    That's how we enable virtualization.

  13. IvanPizhenko commented on Mar 23, 2021

    @IvanPizhenko
    Contributor

    I am talking about enabling nested virtualization in the VM settings. At the moment VM itself does not support it. Android studio has already installed emulator but it cannot be used because no any virtualization available in the my Linux VM.

  14. IvanPizhenko commented on Mar 23, 2021

    @IvanPizhenko
    Contributor
  15. tomholub commented on Mar 23, 2021

    @tomholub
    CollaboratorAuthor

    @IvanPizhenko are you in fact on Windows, and running a linux box in a VM itself? Is it VMWare or something else?

    That would indeed explain why you cannot easily virtualize. Our CI most likely runs Ubuntu in a VM on top of Ubuntu, that may be a different situation than what you are doing, since they may be using different software to virtualize their host Ubuntu system.

  16. tomholub commented on Mar 23, 2021

    @tomholub
    CollaboratorAuthor

    I'm thinking, if you are on Windows it may be more worthwhile to focus on #1076 which would allow you to skip these nested virtualization issues.

  17. IvanPizhenko commented on Mar 23, 2021

    @IvanPizhenko
    Contributor

    I am currently using GCloud instance. I'd like to use VirtualBox locally, but things like IntellIJ are just very slow in it (the host system is laptop with 2nd generation Core i7 and 16GB memory purchased back in the 2011, I'd like to upgrade, but that can't be done immediately). So I think it is now faster to just recreate instance with nested virtualization enabled than solve #1076. Another problem with Windows is that tests use Docker. Docker on Windows requires WSL2, and WSL2 works bad with VirtualBox, which I have to use for some other stuff. So in sense of running tests Windows unfortunately is not a variant for me.

  18. tomholub commented on Mar 23, 2021

    @tomholub
    CollaboratorAuthor

    In that case, you may be able to follow the semaphore.yml file more or less step by step to get tests working there.

  19. IvanPizhenko commented on Mar 23, 2021

    @IvanPizhenko
    Contributor

    Just recreated VM with nested virtualization, started AVD via AVD Manger and it just works. Just if someone else needs to do the same - one extra step is to add your Linux user into the group kvm.

  20. added
    PR submittedPR is submitted for this issue
    and removed
    in progresswork on the issue is in progress
    on Mar 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

PR submittedPR is submitted for this issue

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions