Skip to content

Commit f8b3cb2

Browse files
arttu-peltonenEvergreen
authored andcommitted
[Yamato] Fix & re-enable unstable IsAssetPreviewCorrect test
Fix unstable test: https://jira.unity3d.com/browse/UUM-59403 which was disabled earlier due to instability. The test was unstable because it sometimes took too long and timed out. The instability was actually introduced by this PR https://github.cds.internal.unity3d.com/unity/unity/pull/41268 that tracks timeouts correctly, meaning that the highly varying runtimes of this test (usually 100-300sec but up to 700 sec sometimes) were not being enforced before. After the UTF 1.4.2 release the timeouts started correctly failing the test, and the test became unstable as a consequence. This PR fixes the issue by refactoring it: it used to be a edit mode test that manually enters playmode (triggering domain reload) before running the test logic. It was originally done this way to more closely follow the repro steps where asset preview bugs would happen. But given the long runtime, it makes more sense to just implement it as a playmode test instead, so that we don't need to enter playmode separately which is time-consuming. As a result, the test is now passing reliably and only taking ~5sec. cc @alex-vazquez - There was a separate issue with URP_Foundation project where the playmode test assembly was being excluded from editor, meaning that we had tests that were not being run when they should have been. These tests have now been fixed and enabled too.
1 parent 5e3c342 commit f8b3cb2

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if UNITY_EDITOR
12
using System.Collections;
23
using NUnit.Framework;
34
using Unity.Graphics.Tests;
@@ -8,20 +9,14 @@
89
public class PreviewTests : MonoBehaviour
910
{
1011
[UnityTest]
11-
[Ignore("Disabled for Instability https://jira.unity3d.com/browse/UUM-59403")]
1212
public IEnumerator AssetPreviewIsCorrect()
1313
{
14-
EditorApplication.EnterPlaymode();
15-
yield return new WaitForDomainReload(); // Avoid errors on domain reload
16-
while (!EditorApplication.isPlaying)
17-
yield return null;
1814
var threshold = 0.003f;
1915

2016
yield return AssetPreviewTesting.CompareAssetPreview<Material>(
2117
"Assets/CommonAssets/Materials/Roofing.mat",
2218
"Assets/ReferenceImagesBase/Roofing.png",
2319
threshold);
24-
25-
EditorApplication.ExitPlaymode();
2620
}
2721
}
22+
#endif

Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Test/Runtime/URPGlobalSettingsStrippingTests.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,15 @@
66
public class URPGlobalSettingsStrippingTests
77
{
88
[Test]
9+
// Runtime settings
910
[TestCase(typeof(ShaderStrippingSetting), true)]
10-
[TestCase(typeof(URPShaderStrippingSetting), true)]
1111
[TestCase(typeof(URPDefaultVolumeProfileSettings), true)]
1212
[TestCase(typeof(RenderGraphSettings), true)]
13+
[TestCase(typeof(UniversalRendererResources), true)]
14+
[TestCase(typeof(UniversalRenderPipelineRuntimeTextures), true)]
15+
[TestCase(typeof(UniversalRenderPipelineRuntimeShaders), true)]
16+
// Editor-only settings
17+
[TestCase(typeof(URPShaderStrippingSetting), false)]
1318
public void IsAvailableOnPlayerBuilds(System.Type type, bool expectedAvailable)
1419
{
1520
MethodInfo method = typeof(GraphicsSettings).GetMethod(nameof(GraphicsSettings.GetRenderPipelineSettings));

Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Test/Runtime/Unity.Testing.SRP.Universal.Foundation.Runtime.asmdef

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@
1111
"GUID:c579267770062bf448e75eb160330b7f",
1212
"GUID:15fc0a57446b3144c949da3e2b9737a9",
1313
"GUID:36d514892e55d4340b470c29fcab8b44",
14-
"GUID:df380645f10b7bc4b97d4f5eb6303d95"
14+
"GUID:df380645f10b7bc4b97d4f5eb6303d95",
15+
"GUID:343deaaf83e0cee4ca978e7df0b80d21",
16+
"GUID:2bafac87e7f4b9b418d9448d219b01ab",
17+
"GUID:adf6f42bac617413dbcd97c993ab7077"
1518
],
1619
"includePlatforms": [],
17-
"excludePlatforms": [
18-
"Editor"
19-
],
20+
"excludePlatforms": [],
2021
"allowUnsafeCode": false,
2122
"overrideReferences": true,
2223
"precompiledReferences": [
@@ -28,4 +29,4 @@
2829
],
2930
"versionDefines": [],
3031
"noEngineReferences": false
31-
}
32+
}

0 commit comments

Comments
 (0)