Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test runner does not work on windows-latest, but does on ubuntu-latest #200

Closed
dev-cmurphy opened this issue Nov 9, 2022 · 10 comments
Closed
Labels
bug Something isn't working

Comments

@dev-cmurphy
Copy link

DESCRIPTION

I've got an error when I try to run the latest (2.10) release of the test runner:

 ##[group***Run game-ci/unity-test-runner@v2.1.0
with:
  artifactsPath: test-artifacts
  githubToken: ***
  checkName: All Modes Test Results
  coverageOptions: generateAdditionalMetrics;generateHtmlReport;generateBadgeReport;assemblyFilters:+Aleo.*-Aleo.Tests.*
  unityVersion: auto
  testMode: all
  useHostNetwork: false
env:
  UNITY_LICENSE: ***
##[endgroup***
D:\a\_actions\game-ci\unity-test-runner\v2.1.0\dist\main.js:1
index.js
^

ReferenceError: index is not defined
    at Object.<anonymous> (D:\a\_actions\game-ci\unity-test-runner\v2.1.0\dist\main.js:1:1)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain*** (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47

But it works fine when I run it on ubuntu-latest.
The issue seems to be with the file dist\main.js which seems to be a recent addition to the unity-test-runner repo.
How to reproduce

REPRO STEPS & EXPECTED BEHAVIOUR

Use windows-latest as the value of the job runs-on parameter.

Expected: the action runs as normal.
Actual:

D:\a\_actions\game-ci\unity-test-runner\v2.1.0\dist\main.js:1
index.js
^

ReferenceError: index is not defined
    at Object.<anonymous> (D:\a\_actions\game-ci\unity-test-runner\v2.1.0\dist\main.js:1:1)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain*** (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47

CONTEXT

Just tried to run the test-runner on windows-latest with the latest release of the test-runner (2.1.0).

@dev-cmurphy dev-cmurphy added the bug Something isn't working label Nov 9, 2022
@webbertakken
Copy link
Member

Probably related to #198 and #199

@vayan
Copy link

vayan commented Feb 6, 2023

Still happening for now, any older version of the windows runner that is working?

@timcassell
Copy link
Contributor

Looks like it's only working on v2.0.3.

@zeroZshadow
Copy link

zeroZshadow commented Apr 14, 2023

The issue is the symlinks introduced in #198 these are no resolved on windows machines.

I would LOVE if this could be resolved. I need to be able to run on windows machines for code coverage analysis with sonar.

@Cyantoo
Copy link

Cyantoo commented May 2, 2023

Very interested in this too.

@codegefluester
Copy link

Is there any workaround for this? We're very keen to trial GameCI but this is blocking us hard right now

@sokuhatiku
Copy link
Contributor

Hello there.

I am trying to fix this problem and found that it is very complex. I have been able to fix some of the issues but it still does not work completely and I need help to resolve it.

symlink issue (resolved)

As already pointed out, symlink did not work properly on Windows, so I wrote JavaScript in main.js and post.js to call main() and post() in index.js and it worked fine.

Unity execution path issue (resolved)

Next, I noticed that artifacts were not being uploaded. I looked at the logs and found that the cause was an incorrect Unity.exe path passed to Start-Process in run_tests.ps1. This was fixed by pasting the correct path from activate.ps1.

Graphics initialization error

Additionally, an error Failed to initialize unity graphics. was logged. I did not know how to solve the underlying problem, as I have little knowledge of virtual environments. Adding the -nographics option stopped the error, but this has the side effect of disabling some graphics APIs, so it may need a better solution.

GfxDevice: creating device client; threaded=0; jobified=0
d3d11: failed to create device and context (887a0004).
GfxDevice: creating device client; threaded=0; jobified=0
d3d11: failed to create device and context (887a0004).
GfxDevice: creating device client; threaded=0; jobified=0
d3d11: failed to create device and context (887a0004).
Failed to initialize graphics.

Make sure you have DirectX 11 installed, have up to date

drivers for your graphics card and have not disabled

3D acceleration in display settings.
Failed to initialize unity graphics.
Editor exited with error(s): Failed to initialize graphics.
Make sure you have DirectX 11 installed, have up to date
drivers for your graphics card and have not disabled
3D acceleration in display settings.
Fatal Error! Failed to initialize unity graphics.
Editor exited with error(s): Failed to initialize graphics.
Make sure you have DirectX 11 installed, have up to date
drivers for your graphics card and have not disabled
3D acceleration in display settings.
Crash!!!

Standalone testing issues

Finally, at the moment I am facing a problem with the standalone test not completing until the workflow times out. I checked the editor logs and found that the error Test execution timed out. No activity received from the player in 600 seconds. was logged. My guess is that the built client is also not starting properly due to the graphics not being available in the container, but I couldn't find any solution.

Test execution timed out. No activity received from the player in 600 seconds.
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:LogError (object)
UnityEditor.TestTools.TestRunner.Api.CallbacksDelegator:RunFailed (string) (at ./Library/PackageCache/com.unity.test-framework@1.1.33/UnityEditor.TestRunner/Api/CallbacksDelegator.cs:64)
UnityEditor.TestRunner.TestLaunchers.RemoteTestRunController:TimeoutCallback () (at ./Library/PackageCache/com.unity.test-framework@1.1.33/UnityEditor.TestRunner/TestLaunchers/RemotePlayerTestController.cs:91)
UnityEditor.TestTools.TestRunner.DelayedCallback:Update () (at ./Library/PackageCache/com.unity.test-framework@1.1.33/UnityEditor.TestRunner/TestLaunchers/DelayedCallback.cs:32)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()

(Filename: ./Library/PackageCache/com.unity.test-framework@1.1.33/UnityEditor.TestRunner/Api/CallbacksDelegator.cs Line: 64)

Currentry results of my work so far are in my forked repository.

@timcassell
Copy link
Contributor

timcassell commented Jan 8, 2024

@sokuhatiku That standalone issue is strange. It shouldn't be executing the tests from the editor or waiting at all. The player should be built separately with the WaitForPlayerConnection disabled. Maybe the test-standalone-scripts scripts are not getting copied in?

// Do not launch the player after the build completes. Disable the PlayerConnection.
playerOptions.options &= ~(BuildOptions.AutoRunPlayer | BuildOptions.ConnectToHost | BuildOptions.WaitForPlayerConnection);

@sokuhatiku
Copy link
Contributor

@timcassell Thanks for letting me know.

I checked the code and found that $Env:UNITY_PROJECT_PATH was used in the code that copies the assets for the Standalone build to the project in run_test.ps1. This variable is not an environment variable, so $UNITY_PROJECT_PATH is correct. After fixing it, the test seems to pass successfully. ( https://github.com/sokuhatiku/unity-test-runner/actions/runs/7463004561/job/20306702517 )

@timcassell
Copy link
Contributor

I think this issue can be closed. It seems to be working now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants