Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Bug Logs not getting picked up by LogAssert on Linux/CI

Discussion in 'Testing & Automation' started by Hertzole, Oct 25, 2022.

  1. Hertzole


    Jul 27, 2013
    Hey there

    I have some tests that require logs to be picked up and I do that with LogAssert. These tests work fine on Windows but when I upload it for GitHub actions to handle, or just plainly run it on Ubuntu, these tests fail.

    I test if a particular log is called when leaving play mode, so the setup is a bit convoluted so I'll just provide some example code.

    Code (CSharp):
    1. // Editor test
    2. [UnityTest]
    3. public IEnumerator Test()
    4. {
    5.     MySO instance = ScriptableObject.CreateInstance<MySO>();
    6.     instance.hideFlags = HideFlags.DontSave;
    8.     Assert.IsFalse(Application.isPlaying, "Already in play mode when entering play mode.");
    10.     yield return new EnterPlayMode(false);
    12.     Assert.IsTrue(Application.isPlaying, "Didn't enter play mode.");
    14.     LogAssert.Expect(LogType.Warning, "Warning log");
    16.     yield return new ExitPlayMode();
    18.     yield return null;
    19. }
    It fails on the LogAssert as the log is never logged. However, here's the "funny" thing. The log is indeed being logged and shows up in the console (and output logs in CI) but the test never picks it up. I've even tried adding several frame delays before each action with no luck, so there's no timing issue.

    As I mentioned before, this works fine on Windows and only happens on (from my testing) Ubuntu.

    I'm using the latest stable release on the test tools, 1.1.33. I also tested with the new experimental 2.0 with no luck.
  2. Hertzole


    Jul 27, 2013
    I finally got around to making a bug report for this. IN-21343