Search Unity

Question How to run Target Platform tests in Docker?

Discussion in 'Testing & Automation' started by ProtoTerminator, Aug 29, 2021.

  1. ProtoTerminator

    ProtoTerminator

    Joined:
    Nov 19, 2013
    Posts:
    586
    I'm trying to run unit tests in a target platform as part of my CI. Running with
    -testPlatform StandaloneWindows64
    works just fine on my PC, but if I try
    -testPlatform StandaloneLinux64
    in a docker image, it times out.

    Code (csharp):
    1. Test execution timed out. No activity received from the player in 600 seconds.
    Is it possible to get this to work?

    P.S. My motivation for doing this is to make sure my library works with all compilers (IL2CPP), not just in editor.
     
    booferei likes this.
  2. ProtoTerminator

    ProtoTerminator

    Joined:
    Nov 19, 2013
    Posts:
    586
    My gut tells me it's due to trying to run with graphics. So is there an option in the test runner to make the built executable headless? I think that would solve this problem.
     
  3. ProtoTerminator

    ProtoTerminator

    Joined:
    Nov 19, 2013
    Posts:
    586
    I tried passing
    -playerGraphicsAPI Null
    which made it run headless on my PC, but it still failed in docker.


    Code (CSharp):
    1. [0901/065714:ERROR:browser_main_loop.cc(161)] Running without the SUID sandbox! See https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment for more information on developing with the sandbox on.
    2. Sending message header failed
    3. (Filename: ./Runtime/Network/PlayerCommunicator/GeneralConnection.cpp Line: 503)
    4.  
    5. Sending message header failed
    6. (Filename: ./Runtime/Network/PlayerCommunicator/GeneralConnection.cpp Line: 503)
    7.  
    8. [0901/065714:ERROR:sandbox_linux.cc(308)] InitializeSandbox() called with multiple threads in process gpu-process
    9. [00:00:00] Enlighten: Finished 3 Bake Ambient Probe jobs (0.00s execute, 0.00s integrate, 26.02s wallclock)
    10. Starting cubemap convolution for '' (size 128)
    11. ...took 0.288 seconds
    12. Test execution timed out. No activity received from the player in 600 seconds.
    I read somewhere that the ERROR:browser_main_loop.cc and ERROR:sandbox_linux.cc are benign and can be ignored...

    I'm not sure what else to try.
     
    Last edited: Sep 1, 2021
  4. ProtoTerminator

    ProtoTerminator

    Joined:
    Nov 19, 2013
    Posts:
    586
    This is a real pain for me. I just made a huge PR on my project and all my tests are passing, then I tried a local platform test with IL2CPP before merging it and the runtime crashed (even though the build succeeded)! I'm still trying to figure out the cause now, but it would be nice if my CI could catch this sooner.
     
  5. unity_880B76DD9F9DB8EED3F7

    unity_880B76DD9F9DB8EED3F7

    Joined:
    Feb 14, 2022
    Posts:
    3
    This is also affecting me - trying to run unit tests in GitHub actions in a docker container. Consistently getting the following error:

    Code (csharp):
    1. [0214/093308:ERROR:browser_main_loop.cc(161)] Running without the SUID sandbox! See https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment for more information on developing with the sandbox on.
    2. Caught fatal signal - signo:11 code:1 errno:0 addr:0x120
    3. Obtained 8 stack frames.
    4. #0  0x007ff6d9ced980 in funlockfile
    5. #1  0x007ff6e39e37c1 in base::RunLoop::Run()
    6. #2  0x007ff6e38c6865 in CefBrowserMessageLoop::DoMessageLoopIteration()
    7. #3  0x0055cafa026dd8 in Application::TickTimer()
    8. #4  0x0055cafad27d72 in InitializeUnity(void*)
    9. #5  0x0055cafad26ec9 in main
    10. #6  0x007ff6d990bbf7 in __libc_start_main
    11. #7  0x0055caf93665af in _start
    12. Aborted

    I can provide a reproducible example with a public repo if there's anyone who could look into this...
     
  6. ProtoTerminator

    ProtoTerminator

    Joined:
    Nov 19, 2013
    Posts:
    586
    Since you're using GitHub Actions, you can use https://github.com/game-ci/unity-test-runner if you're not already. Unfortunately, it does not support target platform tests as they do not work (hopefully Unity will get them to work soon with their Docker support). So you can only run your tests in edit mode or play mode.
     
  7. unity_880B76DD9F9DB8EED3F7

    unity_880B76DD9F9DB8EED3F7

    Joined:
    Feb 14, 2022
    Posts:
    3
    I've been able to get around this issue (which only happens on 2019 Unity BTW) by calling unti via
    `xvfb-run -ae /dev/stdout <unity editor executable> <unity args>`
     
    ProtoTerminator and booferei like this.
  8. ProtoTerminator

    ProtoTerminator

    Joined:
    Nov 19, 2013
    Posts:
    586
    I did manage to get standalone tests working with regular nunit tests (but not [UnityTest]). Solution
     
  9. ProtoTerminator

    ProtoTerminator

    Joined:
    Nov 19, 2013
    Posts:
    586
    arairyo0105 likes this.