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

Clean up AcademyFixedUpdateStepper when playmode changed #4532

Merged
merged 18 commits into from
Oct 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions .yamato/com.unity.ml-agents-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,23 @@ test_editors:
- version: 2018.4
# 2018.4 doesn't support code-coverage
enableCodeCoverage: !!bool false
# We want some scene tests to run in the DevProject, but packages there only support 2019+
testProject: Project
- version: 2019.4
enableCodeCoverage: !!bool true
testProject: DevProject
- version: 2020.1
enableCodeCoverage: !!bool true
testProject: DevProject
- version: 2020.2
enableCodeCoverage: !!bool true
testProject: DevProject

trunk_editor:
- version: trunk
enableCodeCoverage: !!bool true
testProject: DevProject

test_platforms:
- name: win
type: Unity::VM
Expand All @@ -24,6 +32,7 @@ test_platforms:
type: Unity::VM
image: package-ci/ubuntu:stable
flavor: b1.medium

packages:
- name: com.unity.ml-agents
assembly: Unity.ML-Agents
Expand Down Expand Up @@ -70,7 +79,7 @@ test_{{ package.name }}_{{ platform.name }}_{{ editor.version }}:
flavor: {{ platform.flavor}}
commands:
- npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
- upm-ci project test -u {{ editor.version }} --project-path Project --package-filter {{ package.name }} {{ coverageOptions }} --extra-utr-arg "reruncount=2"
- upm-ci project test -u {{ editor.version }} --project-path {{ editor.testProject }} --package-filter {{ package.name }} {{ coverageOptions }} --extra-utr-arg "reruncount=2"
{% if editor.enableCodeCoverage %}
- python3 ml-agents/tests/yamato/check_coverage_percent.py upm-ci~/test-results/ {{ package.minCoveragePct }}
{% endif %}
Expand All @@ -88,6 +97,7 @@ test_{{ package.name }}_{{ platform.name }}_{{ editor.version }}:
pull_request.target match "release.+") AND
NOT pull_request.draft AND
(pull_request.changes.any match "com.unity.ml-agents/**" OR
pull_request.changes.any match " {{ editor.testProject }}/**" OR
{% if package.name == "com.unity.ml-agents.extensions" %}
pull_request.changes.any match "com.unity.ml-agents.extensions/**" OR
{% endif %}
Expand Down Expand Up @@ -116,7 +126,7 @@ test_{{ package.name }}_{{ platform.name }}_trunk:
- python -m pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple --upgrade
- unity-downloader-cli -u trunk -c editor --wait --fast
- npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
- upm-ci project test -u {{ editor.version }} --project-path Project --package-filter {{ package.name }} {{ coverageOptions }} --extra-utr-arg "reruncount=2"
- upm-ci project test -u {{ editor.version }} --project-path {{ editor.testProject }} --package-filter {{ package.name }} {{ coverageOptions }} --extra-utr-arg "reruncount=2"
{% if editor.enableCodeCoverage %}
- python3 ml-agents/tests/yamato/check_coverage_percent.py upm-ci~/test-results/ {{ package.minCoveragePct }}
{% endif %}
Expand Down
8 changes: 8 additions & 0 deletions DevProject/Assets/ML-Agents/Scripts/Tests/Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions DevProject/Assets/ML-Agents/Scripts/Tests/Runtime.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Collections;
using NUnit.Framework;
using UnityEngine.TestTools;
using UnityEngine;
using UnityEngine.SceneManagement;
using Unity.MLAgents;
#if UNITY_EDITOR
using UnityEditor.SceneManagement;
#endif

namespace Tests
{
public class AcademyStepperTest
{
[SetUp]
public void Setup()
{
SceneManager.LoadScene("ML-Agents/Scripts/Tests/Runtime/AcademyTest/AcademyStepperTestScene");
}

/// <summary>
/// Verify in each update, the Academy is only stepped once.
/// </summary>
[UnityTest]
public IEnumerator AcademyStepperCleanupPasses()
{
var academy = Academy.Instance;
int initStepCount = academy.TotalStepCount;
for (var i = 0; i < 5; i++)
{
yield return new WaitForFixedUpdate();
Assert.True(academy.TotalStepCount - initStepCount == i + 1);
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading